RollRoomEdit.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小: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;
- public partial class FileBooks_RollRoomEdit : System.Web.UI.Page
- {
- //模板
- Model.RollRooms MR = new Model.RollRooms();
- //业务
- BLL.RollRooms BR = new BLL.RollRooms();
- public int MRID
- {
- get
- {
- if (ViewState["RollRoomsMRID"] == null)
- {
- return 0;
- }
- else
- {
- return int.Parse( ViewState["RollRoomsMRID"].ToString());
- }
- }
- set { ViewState["RollRoomsMRID"] = value; }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "FileBooks_RollRoomEdit");
- if (!IsPostBack)
- {
- object objid = Request.QueryString["id"];
- if (objid != null)
- {
- DropLoadSet();
- int ri = int.Parse(objid.ToString());
- MR = BR.GetModel(ri);
- this.KeyValue_DeptId.SelectedValue = MR.SSBM;
- KeyValue_JKH.Text = MR.JKH;
- KeyValue_JKMC.Text = MR.JKMC;
- KeyValue_BZ.Text = MR.BZ;
- MRID = MR.ID;
-
- }
- }
- }
- public void DropLoadSet()
- {
- KeyValue_DeptId.DataTextField = "DeptName";
- KeyValue_DeptId.DataValueField = "ID";
- KeyValue_DeptId.DataSource = EnumGet.DepartmentGetEnum();
- KeyValue_DeptId.DataBind();
- ListItem linone = new ListItem();
- linone.Text = "无";
- linone.Value = "0";
- KeyValue_DeptId.Items.Add(linone);
- KeyValue_DeptId.SelectedIndex = KeyValue_DeptId.Items.Count - 1;
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (KeyValue_JKH.Text == "")
- {
- throw new Exception("卷库号不能为空!");
- }
- if (KeyValue_JKMC.Text == "")
- {
- throw new Exception("卷库名称不能为空!");
- }
-
- MR.SSBM = this.KeyValue_DeptId.SelectedValue;
- MR.JKH = KeyValue_JKH.Text;
- MR.JKMC = KeyValue_JKMC.Text;
- MR.BZ = KeyValue_BZ.Text;
- MR.ID = MRID;
- BR.Update(MR);
- MessageBox.Show("更新成功");
- KeyValue_JKH.Text = "";
- KeyValue_BZ.Text = "";
- KeyValue_JKMC.Text = "";
- }
- catch(Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- }