MeetingRoomAdd.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 General_MeetingRoomAdd : System.Web.UI.Page
- {
- //模板
- Model.MeetingRooms MM = new Model.MeetingRooms();
- //业务
- BLL.MeetingRooms BM = new BLL.MeetingRooms();
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "General_MeetingRoomAdd");
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (String.IsNullOrEmpty(KeyValue_MC.Text.Trim()))
- {
- throw new Exception("名称不能为空!");
- }
- if (BM.GetCount("MC = '" + KeyValue_MC.Text + "'") > 0)
- {
- throw new Exception("该名称已经存在!");
- }
- int IKeyValue_KRNS = 0;
- if (!int.TryParse(KeyValue_KRNS.Text, out IKeyValue_KRNS))
- {
- throw new Exception("可容纳人数不正确!");
- }
- if (IKeyValue_KRNS <= 0)
- {
- throw new Exception("可容纳人数必须大于0!");
- }
- if (String.IsNullOrEmpty(KeyValue_SBQK.Text))
- {
- throw new Exception("设备情况不能为空!");
- }
- if (String.IsNullOrEmpty(KeyValue_HYSMS.Text))
- {
- throw new Exception("会议室描述不能为空!");
- }
- if (String.IsNullOrEmpty(KeyValue_DD.Text))
- {
- throw new Exception("地点不能为空!");
- }
- MM.MC = KeyValue_MC.Text;
- MM.KRNS = IKeyValue_KRNS;
- MM.SBQK = KeyValue_SBQK.Text;
- MM.HYSMS = KeyValue_HYSMS.Text;
- MM.DD = KeyValue_DD.Text;
- BM.Add(MM);
- MessageBox.Show("添加成功!");
- KeyValue_MC.Text = "";
- KeyValue_KRNS.Text = "";
- KeyValue_SBQK.Text = "";
- KeyValue_HYSMS.Text = "";
- KeyValue_DD.Text = "";
- }
- catch (Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- }