CheckInEditor.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:3k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- 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 Articles_CheckInEditor : 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_CheckInEditor");
- if (!IsPostBack)
- {
- object objid = Request.QueryString["id"];
- if (objid != null)
- {
- DropLoadSet();
- int ri = int.Parse(objid.ToString());
- MU = BU.GetModel(ri);
- KeyValue_DJBS.SelectedValue = MU.DJBS;
- KeyValue_DJ.Text = MU.DJ.ToString("0.00");
- KeyValue_WP.Text = MU.WP;
- KeyValue_SL.Text = MU.SL.ToString();
- KeyValue_BZ.Text = MU.BZ;
- KeyValue_DJR.Text = MU.DJR;
- }
- }
- }
- 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.ID = int.Parse(Request.QueryString["id"].ToString());
- 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.Update(MU);
- MessageBox.Show("更新成功");
- }
- 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;
- }
- }