📄 clientlinkinfo.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;
using System.Data.SqlClient;
public partial class Module_Relation_ClientLinkInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserName"] != null)
{
if (Session["Popedom"].ToString() == "0")
{
this.Panel1.Visible = true;
}
}
else
{
Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
}
if (!IsPostBack)
{
SqlData da = new SqlData();
string str = Request["ID"].ToString();
string cmdtxt1 = "select * from tb_ClientLink where ID='" + str + "'";
SqlCommand Com1 = new SqlCommand(cmdtxt1, da.ExceCon());
SqlDataReader dr1 = Com1.ExecuteReader();
dr1.Read();
if (dr1.HasRows)
{
this.txtClientPhone.Text = dr1["ClientPhone"].ToString();
this.txtCity.Text = dr1["City"].ToString();
this.txtCounty.Text = dr1["Country"].ToString();
this.txtEmail.Text = dr1["Email"].ToString();
this.txtFax.Text = dr1["Fax"].ToString();
this.txtName.Text = dr1["ClientName"].ToString();
this.txtPostCode.Text = dr1["PostCode"].ToString();
this.txtProvince.Text = dr1["Province"].ToString();
this.dropClass1.SelectedValue = dr1["ClientClass"].ToString();
this.dropName.SelectedValue = dr1["WriteInMan"].ToString();
this.dropProperty.SelectedValue = dr1["ClientProperty"].ToString();
this.dropRelation.SelectedValue = dr1["ClientRelation"].ToString();
this.txtProName.Text = dr1["WriteInMan"].ToString();
this.txtWriteInTime.Text = Convert.ToDateTime(dr1["WriteInTime"]).ToString("yyyy-MM-dd");
}
dr1.Close();
string cmdtxt2 = "select Distinct Name from tb_User";
SqlCommand Com2 = new SqlCommand(cmdtxt2, da.ExceCon());
SqlDataReader dr2 = Com2.ExecuteReader();
while (dr2.Read())
{
this.dropName.Items.Add(dr2["Name"].ToString());
}
dr2.Close();
}
}
protected void btnEdit_Click(object sender, EventArgs e)
{
this.txtCity.ReadOnly = false;
this.txtClientPhone.ReadOnly = false;
this.txtCounty.ReadOnly = false;
this.txtEmail.ReadOnly = false;
this.txtFax.ReadOnly = false;
this.txtName.ReadOnly = false;
this.txtPostCode.ReadOnly = false;
this.txtProvince.ReadOnly = false;
this.dropClass1.Enabled = true;
this.dropName.Enabled = true;
this.dropProperty.Enabled = true;
this.dropRelation.Enabled = true;
this.btnDelete.Enabled = true ;
this.btnSave.Enabled = true;
this.Panel2.Visible = false;
this.Panel3.Visible = true;
}
protected void btnDelete_Click(object sender, EventArgs e)
{
string cmdtxt = "DELETE FROM tb_ClientLink where ID='"+Request["ID"].ToString()+"'";
SqlData da = new SqlData();
if (da.ExceSQL(cmdtxt))
{
Response.Write("<script language=javascript>alert('操作成功!');location='ClientLink.aspx'</script>");
CommonClass.WriteNote(this.txtName.Text, 3, Session["UserName"].ToString());
}
else
{
Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
SqlData da = new SqlData();
string cmdtxt = "UPDATE tb_ClientLink SET ClientName='" + this.txtName.Text + "',ClientClass='"+this.dropClass1.SelectedValue+"'";
cmdtxt += ",ClientProperty='" + this.dropProperty.SelectedValue + "',ClientPhone='" + this.txtClientPhone.Text + "',Email='" + this.txtEmail.Text + "'";
cmdtxt += ",Country='" + this.txtCounty.Text + "',Province='" + this.txtProvince.Text + "',City='" + this.txtCity.Text + "',PostCode='"+this.txtPostCode.Text+"'";
cmdtxt += ",WriteInMan='" + this.dropName.SelectedValue + "',ClientRelation='"+this.dropRelation.SelectedValue+"',Fax='" + this.txtFax.Text + "',WriteInTime='" + DateTime.Now + "' where ID='" + Request["ID"].ToString() + "'";
if (da.ExceSQL(cmdtxt))
{
Response.Write("<script language=javascript>alert('操作成功!');location='ClientLink.aspx'</script>");
CommonClass.WriteNote(this.txtName.Text, 1, Session["UserName"].ToString());
}
else
{
Response.Write("<script language=javascript>alert('操作失败!')</script>");
}
}
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Write("<script>this.parent.rightFrame.location='ClientLink.aspx'</script>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -