RollRoomAdd.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小: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;
- public partial class FileBooks_RollRoomAdd : System.Web.UI.Page
- {
- //模板
- Model.RollRooms MR = new Model.RollRooms();
- //业务
- BLL.RollRooms BR = new BLL.RollRooms();
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "FileBooks_RollRoomAdd");
- if (!IsPostBack)
- {
- DropLoadSet();
- }
- }
- 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;
- BR.Add(MR);
- MessageBox.Show("新建成功");
- KeyValue_JKH.Text = "";
- KeyValue_BZ.Text = "";
- KeyValue_JKMC.Text = "";
- }
- catch(Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- }