温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:网上办公系统源码
当前文件路径:OfficeOnline/ClientInfo/Client_Add.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
12
public partial class ClientInfo_Client_Add : System.Web.UI.Page 13
{ 14
WebService webService = new WebService(); 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
if (Session["UserID"] == null || Session["UserLevel"] == null) 18
{ 19
Response.Redirect("~/Error.aspx"); 20
} 21
if (Session["UserLevel"].ToString() == "职员") 22
{ 23
this.CheckBox1.Visible = false; 24
this.lblMsg.Text = "您所添加的客户需要得到部门经理的审核!"; 25
} 26
else if (Session["UserLevel"].ToString() == "部门经理") 27
{ 28
this.lblMsg.Text = "您可以在此审核客户,也可以以后再审核!"; 29
} 30
else 31
{ 32
Response.Redirect("~/Error.aspx"); 33
} 34
} 35
protected void btnSubmit_Click(object sender, EventArgs e) 36
{ 37
if (this.tbAgentName.Text == "" || this.tbClientName.Text == "" || this.tbEmail.Text == "" || this.tbPhone.Text == "" || this.tbWeb.Text == "") 38
{ 39
this.lblMsg.Text = "请填写完整信息!"; 40
} 41
else 42
{ 43
string strSql = "SELECT Person_DeptID FROM z_Person where z_Person.Person_ID='" + Session["UserID"].ToString() + "';"; 44
DataTable table = webService.ExcuteSelect(strSql); 45
string strDeptID = table.Rows[0]["Person_DeptID"].ToString(); 46
string strCompanyName = this.tbClientName.Text; 47
string strAgentName = this.tbAgentName.Text; 48
string strEmail = this.tbEmail.Text; 49
string strPhone = this.tbPhone.Text; 50
string strWeb = this.tbWeb.Text; 51
if (this.CheckBox1.Checked) 52
strSql = "Insert into z_Client(Client_AddDate,Client_CompanyName,Client_AgentName,Client_Phone,Client_Email,Client_WebSite,Client_IsConfirm,Client_ConfirmDate,Client_AddPersonID,Dept_ID) values ('" + DateTime.Now + "','" + strCompanyName + "','" + strAgentName + "','" + strPhone + "','" + strEmail + "','" + strWeb + "','1','" + DateTime.Now + "','" + Session["UserID"].ToString() +"','"+strDeptID+ "');"; 53
else 54
strSql = "Insert into z_Client(Client_AddDate,Client_CompanyName,Client_AgentName,Client_Phone,Client_Email,Client_WebSite,Client_IsConfirm,Client_AddPersonID,Dept_ID) values ('" + DateTime.Now + "','" + strCompanyName + "','" + strAgentName + "','" + strPhone + "','" + strEmail + "','" + strWeb + "','0','" + Session["UserID"].ToString() +"','"+strDeptID+ "');"; 55
webService.ExcuteSql(strSql); 56
Response.Redirect("Client_List.aspx"); 57
} 58
} 59
protected void btnCancel_Click(object sender, EventArgs e) 60
{ 61
Response.Redirect("Client_List.aspx"); 62
} 63
} 64




WebService webService 
}
}