📄 client_edit.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ClientInfo_Client_Edit : System.Web.UI.Page
{
WebService webService = new WebService();
string strSql;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserID"] == null || Session["UserLevel"] == null)
{
Response.Redirect("~/Error.aspx");
}
if (Session["UserLevel"].ToString() == "部门经理")
{
this.lblMsg.Text = "请进行修改,您可以现在审核用户,也可以以后再审核!";
this.CheckBox1.Visible = true;
}
else
{
this.lblMsg.Text = "请进行修改,您所提交的客户信息需等部门经理的审核!";
this.CheckBox1.Visible = false;
}
if (!Page.IsPostBack)
{
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"] + "';";
DataTable table = webService.ExcuteSelect(strSql);
this.tbAgentName.Text = table.Rows[0]["Client_AgentName"].ToString();
this.tbClientName.Text = table.Rows[0]["Client_CompanyName"].ToString();
this.tbEmail.Text = table.Rows[0]["Client_Email"].ToString();
this.tbPhone.Text = table.Rows[0]["Client_Phone"].ToString();
this.tbWeb.Text = table.Rows[0]["Client_WebSite"].ToString();
if (table.Rows[0]["Client_AddPersonID"].ToString() != Session["UserID"].ToString())
{
Response.Redirect("~/Error.aspx");
}
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (this.tbAgentName.Text == "" || this.tbClientName.Text == "" || this.tbEmail.Text == "" || this.tbPhone.Text == "" || this.tbWeb.Text == "")
{
this.lblMsg.Text = "请填写完整信息!";
}
else
{
string strCompanyName = this.tbClientName.Text;
string strAgentName = this.tbAgentName.Text;
string strEmail = this.tbEmail.Text;
string strPhone = this.tbPhone.Text;
string strWeb = this.tbWeb.Text;
if (this.CheckBox1.Checked == true)
{
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"] + "';";
}
else
{
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"] + "';";
}
webService.ExcuteSql(strSql);
Response.Redirect("Client_List3.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
strSql = "Delete from z_Client where Client_ID='" + Request.QueryString["cid"] + "';";
webService.ExcuteSql(strSql);
Response.Redirect("Client_List3.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -