MeetingRoomEditor.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:3k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class General_MeetingRoomEditor : System.Web.UI.Page
  12. {
  13.     //模板
  14.     Model.MeetingRooms MM = new Model.MeetingRooms();
  15.     //业务
  16.     BLL.MeetingRooms BM = new BLL.MeetingRooms();
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.         LoginLogic.MatchLoad("../", "General_MeetingRoomEditor");
  20.         if (!IsPostBack)
  21.         {
  22.             object objid = Request.QueryString["id"];
  23.             if (objid != null)
  24.             {
  25.                 int ri = int.Parse(objid.ToString());
  26.                 MM = BM.GetModel(ri);
  27.                 KeyValue_MC.Text = MM.MC;
  28.                 KeyValue_KRNS.Text = MM.KRNS.ToString();
  29.                 KeyValue_SBQK.Text = MM.SBQK;
  30.                 KeyValue_HYSMS.Text = MM.HYSMS;
  31.                 KeyValue_DD.Text = MM.DD;
  32.             }
  33.         }
  34.     }
  35.     protected void Button1_Click(object sender, EventArgs e)
  36.     {
  37.         try
  38.         {
  39.             if (String.IsNullOrEmpty(KeyValue_MC.Text.Trim()))
  40.             {
  41.                 throw new Exception("名称不能为空!");
  42.             }
  43.             int IKeyValue_KRNS = 0;
  44.             if (!int.TryParse(KeyValue_KRNS.Text, out IKeyValue_KRNS))
  45.             {
  46.                 throw new Exception("可容纳人数不正确!");
  47.             }
  48.             if (IKeyValue_KRNS <= 0)
  49.             {
  50.                 throw new Exception("可容纳人数必须大于0!");
  51.             }
  52.             if (String.IsNullOrEmpty(KeyValue_SBQK.Text))
  53.             {
  54.                 throw new Exception("设备情况不能为空!");
  55.             }
  56.             if (String.IsNullOrEmpty(KeyValue_HYSMS.Text))
  57.             {
  58.                 throw new Exception("会议室描述不能为空!");
  59.             }
  60.             if (String.IsNullOrEmpty(KeyValue_DD.Text))
  61.             {
  62.                 throw new Exception("地点不能为空!");
  63.             }
  64.             MM.MC = KeyValue_MC.Text;
  65.             MM.KRNS = IKeyValue_KRNS;
  66.             MM.SBQK = KeyValue_SBQK.Text;
  67.             MM.HYSMS = KeyValue_HYSMS.Text;
  68.             MM.DD = KeyValue_DD.Text;
  69.             BM.Update(MM);
  70.             MessageBox.Show("更新成功!");
  71.         }
  72.         catch (Exception exp)
  73.         {
  74.             MessageBox.Show(exp.Message);
  75.         }
  76.     }
  77. }