UpdateMaterialName.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:2k
源码类别:

.net编程

开发平台:

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 com.etong.DAL;
  12. using com.etong.DBUtility;
  13. public partial class Workflow_UpdateMaterialName : System.Web.UI.Page
  14. {
  15.     private int MatID;
  16.     protected void Page_Load(object sender, EventArgs e)
  17.     {
  18.         if (!this.Page.IsPostBack)
  19.         {
  20.             if (Request.QueryString["id"] != null)
  21.             {
  22.                 this.MatID = Convert.ToInt32(Request.QueryString["id"].ToString());
  23.             }
  24.             if (Request.QueryString["name"] != null)
  25.             {
  26.                 this.lblMatName.Text = Request.QueryString["name"].ToString();
  27.             }
  28.             this.ImageButton2.Attributes.Add("onclick", "window.close();");
  29.         }
  30.         string sql = "select [MatName] from [tb_PrjOldMat] where [MatID]=" + this.MatID;
  31.         DataView dv = SqlServer.GetDataView(sql);
  32.         if (dv.Count > 0)
  33.         {
  34.             this.lblMatName.Text = dv[0]["MatName"].ToString();
  35.         }
  36.     }
  37.     protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
  38.     {
  39.         PrjOldMatManager prjold = new PrjOldMatManager();
  40.         string MatName = this.TextBox1.Text;
  41.         if (Request.QueryString["id"] != null)
  42.         {
  43.             this.MatID = Convert.ToInt32(Request.QueryString["id"].ToString());
  44.         }
  45.         int value = prjold.UpdateOldMatName(this.MatID, MatName);
  46.         if (value == -1)
  47.         {
  48.             Common.RunScript(this.Page, "名称已存在,请使用其它名称!");
  49.             return;
  50.         }
  51.         if (value == 1)
  52.         {
  53.             string script = "<script language='javascript'>alert('名称修改成功!');window.opener=null;window.close();</script>";
  54.             Common.RunScriptString(this.Page, script);
  55.         }
  56.     }
  57. }