MeetingRoomEditor.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;
- public partial class General_MeetingRoomEditor : 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_MeetingRoomEditor");
- if (!IsPostBack)
- {
- object objid = Request.QueryString["id"];
- if (objid != null)
- {
- int ri = int.Parse(objid.ToString());
- MM = BM.GetModel(ri);
- KeyValue_MC.Text = MM.MC;
- KeyValue_KRNS.Text = MM.KRNS.ToString();
- KeyValue_SBQK.Text = MM.SBQK;
- KeyValue_HYSMS.Text = MM.HYSMS;
- KeyValue_DD.Text = MM.DD;
- }
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (String.IsNullOrEmpty(KeyValue_MC.Text.Trim()))
- {
- 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.Update(MM);
- MessageBox.Show("更新成功!");
- }
- catch (Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- }