CheckInAdd.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;
- using System.Collections.Generic;
- public partial class Articles_CheckInAdd : System.Web.UI.Page
- {
- //模板
- Model.UseThingsUse MU = new Model.UseThingsUse();
- //业务
- BLL.UseThingsUse BU = new BLL.UseThingsUse();
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "Articles_CheckInAdd");
- if (!IsPostBack)
- {
- DropLoadSet();
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (KeyValue_DJBS.SelectedValue == "0")
- {
- throw new Exception("请选择登记表示!");
- }
- decimal DKeyValue_DJ = 0;
- if (!decimal.TryParse(KeyValue_DJ.Text, out DKeyValue_DJ))
- {
- throw new Exception("单价不正确!");
- }
- if (String.IsNullOrEmpty(KeyValue_WP.Text.Trim()))
- {
- throw new Exception("物品不能为空!");
- }
- int IKeyValue_SL = 0;
- if (!int.TryParse(KeyValue_SL.Text, out IKeyValue_SL))
- {
- throw new Exception("数量不正确!");
- }
- if (String.IsNullOrEmpty(KeyValue_DJR.Text.Trim()))
- {
- throw new Exception("登记人不能为空!");
- }
- MU.DJBS = KeyValue_DJBS.SelectedValue;
- MU.DJ = DKeyValue_DJ;
- MU.WP = KeyValue_WP.Text;
- MU.SL = IKeyValue_SL;
- MU.BZ= KeyValue_BZ.Text;
- MU.DJR = KeyValue_DJR.Text;
- BU.Add(MU);
- MessageBox.Show("添加成功");
- KeyValue_DJBS.SelectedIndex = KeyValue_DJBS.Items.Count - 1;
- KeyValue_DJ.Text = "";
- KeyValue_WP.Text = "";
- KeyValue_SL.Text = "";
- KeyValue_DJ.Text = "";
- KeyValue_BZ.Text = "";
- KeyValue_DJR.Text = "";
- }
- catch (Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- public void DropLoadSet()
- {
- List<EnumList> list = EnumGet.DengJiGetEnum();
- for (int i = 0; i < list.Count; i++)
- {
- KeyValue_DJBS.Items.Add(list[i].Text);
- }
- ListItem linone = new ListItem();
- linone.Text = "---请选择---";
- linone.Value = "0";
- KeyValue_DJBS.Items.Add(linone);
- KeyValue_DJBS.SelectedIndex = KeyValue_DJBS.Items.Count - 1;
- }
- }