ChanceItem.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:6k
源码类别:
Email客户端
开发平台:
Visual C++
- 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_Employee_Relation_ChanceItem : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["UserName"] != null)
- {
- if (Session["Popedom"].ToString() == "0")
- {
- this.lnkbtnAdd.Visible = true;
- }
- }
- else
- {
- Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
- }
- SqlData da = new SqlData();
- string cmdtxt1 = "select * from tb_ChanceItem";
- this.GridView1.DataSource = da.ExceDS(cmdtxt1, "tb_ChanceItem");
- this.GridView1.DataKeyNames = new string[] { "ID" };
- this.GridView1.DataBind();
- if (!IsPostBack)
- {
- string cmdtxt2 = "select Distinct Name from tb_User";
- SqlDataReader dr = da.ExceDr(cmdtxt2);
- while (dr.Read())
- {
- this.dropDepEmployee.Items.Add(dr["Name"].ToString());
- }
- dr.Close();
- string cmdtxt3 = "select Distinct DepName from tb_Department";
- SqlCommand Com = new SqlCommand(cmdtxt3, da.ExceCon());
- SqlDataReader dr1 = Com.ExecuteReader();
- while (dr1.Read())
- {
- this.dropDepAbout.Items.Add(dr1["DepName"].ToString());
- }
- dr.Close();
- }
- }
- protected void btnFind_Click(object sender, EventArgs e)
- {
- if (this.txtKeyWord.Text == "")
- {
- Response.Write("<script language=javascript>alert('关键字不能为空!');location='ChanceItem.aspx'</script>");
- return;
- }
- SqlData da = new SqlData();
- string search = this.dropClass.SelectedValue;
- switch (search)
- {
- case "项目ID":
- da.BindData(this.GridView1, "Select * From tb_ChanceItem Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_ChanceItem");
- break;
- case "项目名称":
- da.BindData(this.GridView1, "Select * From tb_ChanceItem Where ItemName Like '%" + this.txtKeyWord.Text + "%'", "tb_ChanceItem");
- break;
- case "订单编号":
- da.BindData(this.GridView1, "Select * From tb_ChanceItem Where OrderCode Like '%" + this.txtKeyWord.Text + "%'", "tb_ChanceItem");
- break;
- default:
- Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
- break;
- }
- }
- protected void lnkbtnAdd_Click1(object sender, EventArgs e)
- {
- this.Panel1.Visible = false;
- this.Panel2.Visible = true;
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
- this.GridView1.PageIndex = e.NewPageIndex;
- SqlData da = new SqlData();
- string search = this.dropClass.SelectedValue;
- switch (search)
- {
- case "项目ID":
- da.BindData(this.GridView1, "Select * From tb_ChanceItem Where ID Like '%" + this.txtKeyWord.Text + "%'", "tb_ChanceItem");
- break;
- case "项目名称":
- da.BindData(this.GridView1, "Select * From tb_ChanceItem Where ItemName Like '%" + this.txtKeyWord.Text + "%'", "tb_ChanceItem");
- break;
- case "项目编号":
- da.BindData(this.GridView1, "Select * From tb_ChanceItem Where OrderCode Like '%" + this.txtKeyWord.Text + "%'", "tb_ChanceItem");
- break;
- default:
- Response.Write("<script lanuage=javascript>alert('出错拉!');location='javascript:history.go(-1)'</script>");
- break;
- }
- }
- protected void btnOK_Click(object sender, EventArgs e)
- {
- SqlData da = new SqlData();
- string cmdtxt1 = "SELECT * FROM tb_ChanceItem WHERE OrderCode='"+this.txtOrderCode.Text+"'";
- SqlCommand Com = new SqlCommand(cmdtxt1, da.ExceCon());
- SqlDataReader dr = Com.ExecuteReader();
- dr.Read();
- if (dr.HasRows)
- {
- Response.Write("<script language=javascript>alert('该产品编号已经使用,请选择其他编号!')</script>");
- return;
- }
- string cmdtxt = "INSERT INTO tb_ChanceItem(ItemName,ClientName,ItemPrincipal,OrderCode,ItemMoney";
- cmdtxt += ",StartTime,EndTime,PhoneAbout,ClientAddress,PostCode,ClientEmail,CommunionContent,DepName)";
- cmdtxt += " VALUES('"+this.txtItemName.Text+"','"+this.txtClientName.Text+"','"+this.dropDepEmployee.SelectedValue+"'";
- cmdtxt += ",'"+this.txtOrderCode.Text+"','"+this.txtItemMoney.Text+"','"+this.txtStartTime.Text+"','"+this.txtEndTime.Text+"'";
- cmdtxt += ",'"+this.txtPhoneAbout.Text+"','"+this.txtClientAddress.Text+"','"+this.txtPostCode.Text+"'";
- cmdtxt += ",'"+this.txtClientEmail.Text+"','"+this.txtComContent.Text+"','"+this.dropDepAbout.SelectedValue+"')";
- if (da.ExceSQL(cmdtxt))
- {
- Response.Write("<script language=javascript>alert('操作成功!');location='ChanceItem.aspx'</script>");
- CommonClass.WriteNote(this.txtItemName.Text, 0, Session["UserName"].ToString());
- }
- else
- {
- Response.Write("<script language=javascript>alert('操作失败!');location='javascript:history.go(-1)'</script>");
- }
- }
- protected void btnBack_Click(object sender, EventArgs e)
- {
- Response.Write("<script>this.parent.rightFrame.location='ChanceItem.aspx'</script>");
- }
- }