HotelsAdd.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 Hotels_HotelsAdd : System.Web.UI.Page
- {
- //模板
- Model.Hotels MH = new Model.Hotels();
- //业务
- BLL.Hotels BH = new BLL.Hotels();
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "Hotels_HotelsAdd");
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- try
- {
- if (String.IsNullOrEmpty(KeyValue_ZSLBM.Text))
- {
- throw new Exception("住宿别名不能为空!");
- }
- if (String.IsNullOrEmpty(KeyValue_BGLDM.Text))
- {
- throw new Exception("宾馆旅店名不能为空!");
- }
- int IKeyValue_ZSTS = 0;
- if (!int.TryParse(KeyValue_ZSTS.Text, out IKeyValue_ZSTS))
- {
- throw new Exception("住宿天数不正确!");
- }
- decimal DKeyValue_ZJG = 0;
- if (!decimal.TryParse(KeyValue_ZJG.Text, out DKeyValue_ZJG))
- {
- throw new Exception("总价格不正确!");
- }
- MH.ZSLBM = KeyValue_ZSLBM.Text;
- MH.BGLDM = KeyValue_BGLDM.Text;
- MH.ZSTS = IKeyValue_ZSTS;
- MH.ZSDWDH = KeyValue_ZSDWDH.Text;
- MH.ZJG = DKeyValue_ZJG;
- MH.BZ = KeyValue_BZ.Text;
- BH.Add(MH);
- MessageBox.Show("添加成功!");
- KeyValue_ZSLBM.Text = "";
- KeyValue_BGLDM.Text = "";
- KeyValue_ZSTS.Text = "";
- KeyValue_ZSDWDH.Text = "";
- KeyValue_ZJG.Text = "";
- KeyValue_BZ.Text = "";
- }
- catch (Exception exp)
- {
- MessageBox.Show(exp.Message);
- }
- }
- }