ChanceItemInfo.aspx.cs
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:6k
源码类别:

Email客户端

开发平台:

Visual C++

  1. using 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. using System.Data.SqlClient;
  12. public partial class Module_Relation_ChatItemInfo : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (Session["UserName"] != null)
  17.         {
  18.             if (Session["Popedom"].ToString() == "0")
  19.             {
  20.                 this.Panel5.Visible = true;
  21.             }
  22.         }
  23.         else
  24.         {
  25.             Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
  26.         }
  27.         if (!IsPostBack)
  28.         {
  29.             SqlData da = new SqlData();
  30.             string str = Request["ID"].ToString();
  31.             string cmdtxt1 = "select * from tb_ChanceItem where ID='" + str + "'";
  32.             SqlCommand Com1 = new SqlCommand(cmdtxt1, da.ExceCon());
  33.             SqlDataReader dr1 = Com1.ExecuteReader();
  34.             dr1.Read();
  35.             if (dr1.HasRows)
  36.             {
  37.                 this.txtClientAddress.Text = dr1["ClientAddress"].ToString();
  38.                 this.txtClientEmail.Text = dr1["ClientEmail"].ToString();
  39.                 this.txtClientName.Text = dr1["ClientName"].ToString();
  40.                 this.txtComContent.Text = dr1["CommunionContent"].ToString();
  41.                 this.txtEndTime.Text = Convert.ToDateTime(dr1["EndTime"]).ToString("yyyy-MM-dd");
  42.                 this.txtItemMoney.Text = dr1["ItemMoney"].ToString();
  43.                 this.txtItemName.Text = dr1["ItemName"].ToString();
  44.                 this.txtOrderCode.Text = dr1["OrderCode"].ToString();
  45.                 this.txtPhoneAbout.Text = dr1["PhoneAbout"].ToString();
  46.                 this.txtPostCode.Text = dr1["PostCode"].ToString();
  47.                 this.txtDepName.Text = dr1["DepName"].ToString();
  48.                 this.txtPerson.Text = dr1["ItemPrincipal"].ToString();
  49.                 this.txtStartTime.Text = Convert.ToDateTime(dr1["StartTime"]).ToString("yyyy-MM-dd");
  50.             }
  51.             dr1.Close();
  52.             string cmdtxt2 = "select Distinct Name from tb_User";
  53.             SqlCommand Com2 = new SqlCommand(cmdtxt2, da.ExceCon());
  54.             SqlDataReader dr2 = Com2.ExecuteReader();
  55.             while (dr2.Read())
  56.             {
  57.                 this.dropDepEmployee.Items.Add(dr2["Name"].ToString());
  58.             }
  59.             dr2.Close();
  60.             string cmdtxt3 = "select Distinct DepName from tb_Department";
  61.             SqlCommand Com = new SqlCommand(cmdtxt3, da.ExceCon());
  62.             SqlDataReader dr3 = Com.ExecuteReader();
  63.             while (dr3.Read())
  64.             {
  65.                 this.dropDepAbout.Items.Add(dr3["DepName"].ToString());
  66.             }
  67.             dr3.Close();
  68.         }
  69.     }
  70.     protected void btnDelete_Click(object sender, EventArgs e)
  71.     {
  72.         string cmdtxt = "DELETE FROM tb_ChanceItem where ID='" + Request["ID"].ToString() + "'";
  73.         SqlData da = new SqlData();
  74.         if (da.ExceSQL(cmdtxt))
  75.         {
  76.             Response.Write("<script language=javascript>alert('操作成功!');location='ChanceItem.aspx'</script>");
  77.             CommonClass.WriteNote(this.txtItemName.Text, 2, Session["UserName"].ToString());
  78.         }
  79.         else
  80.         {
  81.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  82.         }      
  83.     }
  84.     protected void btnSave_Click(object sender, EventArgs e)
  85.     {
  86.         SqlData da = new SqlData();
  87.         string cmdtxt = "UPDATE tb_ChanceItem SET ItemName='" + this.txtItemName.Text + "',ClientName='" + this.txtClientName.Text + "'";
  88.         cmdtxt += ",ItemPrincipal='" + this.dropDepEmployee.SelectedValue + "',OrderCode='" + this.txtOrderCode.Text + "',ItemMoney='" + this.txtItemMoney.Text + "'";
  89.         cmdtxt += ",StartTime='" + this.txtStartTime.Text + "',EndTime='" + this.txtEndTime.Text + "',PhoneAbout='" + this.txtPhoneAbout.Text + "'";
  90.         cmdtxt += ",ClientAddress='" + this.txtClientAddress.Text + "',PostCode='" + this.txtPostCode.Text + "',ClientEmail='" + this.txtClientEmail.Text + "'";
  91.         cmdtxt += ",CommunionContent='" + this.txtComContent.Text + "',DepName='" + this.dropDepAbout.SelectedValue + "' where ID='"+Request["ID"].ToString()+"'";
  92.         if (da.ExceSQL(cmdtxt))
  93.         {
  94.             Response.Write("<script language=javascript>alert('操作成功!');location='ChanceItem.aspx'</script>");
  95.             CommonClass.WriteNote(this.txtItemName.Text, 1, Session["UserName"].ToString());
  96.         }
  97.         else
  98.         {
  99.             Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
  100.         }
  101.     }
  102.     protected void btnEdit_Click(object sender, EventArgs e)
  103.     {
  104.         this.txtClientAddress.ReadOnly = false;
  105.         this.txtClientEmail.ReadOnly = false;
  106.         this.txtClientName.ReadOnly = false;
  107.         this.txtComContent.ReadOnly = false;
  108.         this.txtEndTime.ReadOnly = false;
  109.         this.txtItemMoney.ReadOnly = false;
  110.         this.txtItemName.ReadOnly = false;
  111.         this.txtOrderCode.ReadOnly = false;
  112.         this.txtPhoneAbout.ReadOnly = false;
  113.         this.txtPostCode.ReadOnly = false;
  114.         this.txtStartTime.ReadOnly = false;
  115.         this.btnDelete.Enabled = true;
  116.         this.btnSave.Enabled = true;
  117.         this.Panel1.Visible = false;
  118.         this.Panel2.Visible = true;
  119.         this.Panel3.Visible = false;
  120.         this.Panel4.Visible = true;
  121.     }
  122.     protected void btnBack_Click(object sender, EventArgs e)
  123.     {
  124.         Response.Write("<script>this.parent.rightFrame.location='ChanceItem.aspx'</script>");
  125.     }
  126. }