MatCodeUpdate.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:3k
- 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.BusinessRule.MatCode;
- public partial class MatCode_MatCodeUpdate : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- MatCode matcode = new MatCode();
- string id = Request.QueryString["id"].Trim();
- if (!IsPostBack)
- {
- if (id == "")
- return;
- DataView dv =matcode.MatCodeSearch(id, "3");
- this.TB_ID.Text = dv[0]["ID"].ToString().Trim();
- this.TB_MatCode.Text = dv[0]["MatCode"].ToString().Trim();
- Session["matcode"] = dv[0]["MatCode"].ToString().Trim();
- this.TB_MatName.Text = dv[0]["MatName"].ToString().Trim();
- this.TB_MatDecs.Text = dv[0]["MatDecs"].ToString();
- }
- }
- protected void BT_Confirm_Click(object sender, EventArgs e)
- {
- string matcode = this.TB_MatCode.Text.Trim();
- string matname = this.TB_MatName.Text.Trim();
- string matdecs = this.TB_MatDecs.Text.Trim();
- int matid = Convert.ToInt32(this.TB_ID.Text.Trim());
- MatCode mymatcode = new MatCode();
- bool flag = mymatcode.MatCodeCheck(matcode);
- if (flag == false)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:此物资代码格式错误!');</script>");
- return;
- }
- if (matcode != Session["matcode"].ToString())
- {
- DataView dv = mymatcode.MatCodeSearch(matcode, "1");
- if (dv.Count > 0)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:此物资已经存在!');</script>");
- return;
- }
- }
- bool returnvalue = false;
- //更新用户基本信息
- returnvalue = mymatcode.MatCodeUpdate(matid, matcode, matname, matdecs);
- if (returnvalue)
- ClientScript.RegisterStartupScript(this.GetType(),"","<script>alert('系统提示:修改记录成功!');window.close();</script>");
- else
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:修改记录不成功!');window.close();</script>");
- }
- }