- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections.Generic;
- 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_RollFilesAdd : System.Web.UI.Page
- {
- //模板
- Model.Rolls MR = new Model.Rolls();
- //业务
- BLL.Rolls BR = new BLL.Rolls();
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "FileBooks_RollFilesAdd");
- if (!IsPostBack)
- {
- DropLoadSet();
- }
- }
- public void DropLoadSet()
- {
- //部门
- KeyValue_SSBM.DataTextField = "DeptName";
- KeyValue_SSBM.DataValueField = "ID";
- KeyValue_SSBM.DataSource = EnumGet.DepartmentGetEnum();
- KeyValue_SSBM.DataBind();
- ListItem linone = new ListItem();
- linone.Text = "无";
- linone.Value = "0";
- KeyValue_SSBM.Items.Add(linone);
- KeyValue_SSBM.SelectedIndex = KeyValue_SSBM.Items.Count - 1;
- //卷库
- KeyValue_SSJK.DataTextField = "JKMC";
- KeyValue_SSJK.DataValueField = "ID";
- KeyValue_SSJK.DataSource = EnumGet.RollRoomsGetEnum();
- KeyValue_SSJK.DataBind();
- KeyValue_SSJK.SelectedIndex = KeyValue_SSJK.Items.Count - 1;
- //密级
- KeyValue_JAMJ.DataTextField = "Text";
- KeyValue_JAMJ.DataValueField = "Value";
- KeyValue_JAMJ.DataSource = EnumGet.MiJiGetEnum();
- KeyValue_JAMJ.DataBind();
- KeyValue_JAMJ.SelectedIndex = KeyValue_JAMJ.Items.Count - 1;
- //凭证
- KeyValue_PZLB.DataTextField = "Text";
- KeyValue_PZLB.DataValueField = "Value";
- KeyValue_PZLB.DataSource = EnumGet.PingZhengGetEnum();
- KeyValue_PZLB.DataBind();
- KeyValue_PZLB.SelectedIndex = KeyValue_PZLB.Items.Count - 1;
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (KeyValue_JAH.Text == "")
- {
- throw new Exception("卷案号不能为空!");
- }
- if (KeyValue_JAMJ.Text == "")
- {
- throw new Exception("卷案名称不能为空!");
- }
- DateTime DtQSRQ = new DateTime();
- if (!DateTime.TryParse(KeyValue_QSRQ.Text, out DtQSRQ))
- {
- throw new Exception("起始日期格式不正确!");
- }
- DateTime DtZZRQ = new DateTime();
- if (!DateTime.TryParse(KeyValue_ZZRQ.Text, out DtZZRQ))
- {
- throw new Exception("终止日期格式不正确!");
- }
- int itYS = 0;
- if (!int.TryParse(KeyValue_YS.Text, out itYS))
- {
- throw new Exception("页数不正确!");
- }
- MR.JAH = KeyValue_JAH.Text;
- MR.SSJK = KeyValue_SSJK.SelectedValue;
- MR.QSRQ = DtQSRQ;
- MR.SSBM = KeyValue_SSBM.SelectedValue;
- MR.BGQX = KeyValue_BGQX.Text;
- MR.QZH = KeyValue_QZH.Text;
- MR.DAGH = KeyValue_DAGH.Text;
- MR.SWH = KeyValue_SWH.Text;
- MR.PZBH1 = KeyValue_PZBH1.Text;
- MR.YS = itYS;
- MR.ANMC = KeyValue_ANMC.Text;
- MR.JZND = KeyValue_JZND.Text;
- MR.ZZRQ = DtZZRQ;
- MR.BZJG = KeyValue_BZJG.Text;
- MR.JAMJ = KeyValue_JAMJ.SelectedValue;
- MR.MLH = KeyValue_MLH.Text;
- MR.BXXH = KeyValue_BXXH.Text;
- MR.PZLB = KeyValue_PZLB.SelectedValue;
- MR.PZBH2 = KeyValue_PZBH2.Text;
- MR.BZ = KeyValue_BZ.Text;
- BR.Add(MR);
- MessageBox.Show("新建成功");
- KeyValue_JAH.Text = "";
- KeyValue_QSRQ.Text = "";
- KeyValue_BGQX.Text = "";
- KeyValue_QZH.Text = "";
- KeyValue_DAGH.Text = "";
- KeyValue_SWH.Text = "";
- KeyValue_PZBH1.Text = "";
- KeyValue_ANMC.Text = "";
- KeyValue_JZND.Text = "";
- KeyValue_ZZRQ.Text = "";
- KeyValue_BZJG.Text = "";
- KeyValue_MLH.Text = "";
- KeyValue_BXXH.Text = "";
- KeyValue_PZBH2.Text = "";
- KeyValue_BZ.Text = "";
- }
- catch (Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- }