温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:网上办公系统源码
当前文件路径:OfficeOnline/ClientInfo/Client_Edit.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_Edit : System.Web.UI.Page 13
{ 14
WebService webService = new WebService(); 15
string strSql; 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
if (Session["UserID"] == null || Session["UserLevel"] == null) 19
{ 20
Response.Redirect("~/Error.aspx"); 21
} 22
23
if (Session["UserLevel"].ToString() == "部门经理") 24
{ 25
this.lblMsg.Text = "请进行修改,您可以现在审核用户,也可以以后再审核!"; 26
this.CheckBox1.Visible = true; 27
} 28
else 29
{ 30
this.lblMsg.Text = "请进行修改,您所提交的客户信息需等部门经理的审核!"; 31
this.CheckBox1.Visible = false; 32
} 33
if (!Page.IsPostBack) 34
{ 35
strSql = "SELECT z_Client.Client_ID,z_Client.Client_AddPersonID, z_Client.Client_CompanyName, z_Client.Client_AgentName, z_Client.Client_Phone, z_Client.Client_Email, z_Client.Client_WebSite from z_Client WHERE z_Client.Client_ID='" + Request.QueryString["cid"] + "';"; 36
DataTable table = webService.ExcuteSelect(strSql); 37
this.tbAgentName.Text = table.Rows[0]["Client_AgentName"].ToString(); 38
this.tbClientName.Text = table.Rows[0]["Client_CompanyName"].ToString(); 39
this.tbEmail.Text = table.Rows[0]["Client_Email"].ToString(); 40
this.tbPhone.Text = table.Rows[0]["Client_Phone"].ToString(); 41
this.tbWeb.Text = table.Rows[0]["Client_WebSite"].ToString(); 42
if (table.Rows[0]["Client_AddPersonID"].ToString() != Session["UserID"].ToString()) 43
{ 44
Response.Redirect("~/Error.aspx"); 45
} 46
} 47
} 48
protected void btnSubmit_Click(object sender, EventArgs e) 49
{ 50
if (this.tbAgentName.Text == "" || this.tbClientName.Text == "" || this.tbEmail.Text == "" || this.tbPhone.Text == "" || this.tbWeb.Text == "") 51
{ 52
this.lblMsg.Text = "请填写完整信息!"; 53
} 54
else 55
{ 56
string strCompanyName = this.tbClientName.Text; 57
string strAgentName = this.tbAgentName.Text; 58
string strEmail = this.tbEmail.Text; 59
string strPhone = this.tbPhone.Text; 60
string strWeb = this.tbWeb.Text; 61
if (this.CheckBox1.Checked == true) 62
{ 63
strSql = "Update z_Client set Client_CompanyName='" + strCompanyName + "',Client_AgentName='" + strAgentName + "',Client_Email='" + strEmail + "',Client_Phone='" + strPhone + "',Client_WebSite='" + strWeb + "',Client_IsConfirm='1',Client_ConfirmDate='" + DateTime.Now + "',Client_AddDate='" + DateTime.Now + " where Client_ID='" + Request.QueryString["cid"] + "';"; 64
} 65
else 66
{ 67
strSql = "Update z_Client set Client_CompanyName='" + strCompanyName + "',Client_AgentName='" + strAgentName + "',Client_Email='" + strEmail + "',Client_Phone='" + strPhone + "',Client_WebSite='" + strWeb + "',Client_AddDate='" + DateTime.Now + "' where Client_ID='" + Request.QueryString["cid"] + "';"; 68
} 69
webService.ExcuteSql(strSql); 70
Response.Redirect("Client_List3.aspx"); 71
} 72
} 73
protected void Button1_Click(object sender, EventArgs e) 74
{ 75
strSql = "Delete from z_Client where Client_ID='" + Request.QueryString["cid"] + "';"; 76
webService.ExcuteSql(strSql); 77
Response.Redirect("Client_List3.aspx"); 78
} 79
} 80




WebService webService 
}
}