UpdateMaterialName.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:2k
- 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 com.etong.DAL;
- using com.etong.DBUtility;
- public partial class Workflow_UpdateMaterialName : System.Web.UI.Page
- {
- private int MatID;
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.Page.IsPostBack)
- {
- if (Request.QueryString["id"] != null)
- {
- this.MatID = Convert.ToInt32(Request.QueryString["id"].ToString());
- }
- if (Request.QueryString["name"] != null)
- {
- this.lblMatName.Text = Request.QueryString["name"].ToString();
- }
- this.ImageButton2.Attributes.Add("onclick", "window.close();");
- }
- string sql = "select [MatName] from [tb_PrjOldMat] where [MatID]=" + this.MatID;
- DataView dv = SqlServer.GetDataView(sql);
- if (dv.Count > 0)
- {
- this.lblMatName.Text = dv[0]["MatName"].ToString();
- }
- }
- protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
- {
- PrjOldMatManager prjold = new PrjOldMatManager();
- string MatName = this.TextBox1.Text;
- if (Request.QueryString["id"] != null)
- {
- this.MatID = Convert.ToInt32(Request.QueryString["id"].ToString());
- }
- int value = prjold.UpdateOldMatName(this.MatID, MatName);
- if (value == -1)
- {
- Common.RunScript(this.Page, "名称已存在,请使用其它名称!");
- return;
- }
- if (value == 1)
- {
- string script = "<script language='javascript'>alert('名称修改成功!');window.opener=null;window.close();</script>";
- Common.RunScriptString(this.Page, script);
- }
- }
- }