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

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 Hotels_HotelsEditor : System.Web.UI.Page
  12. {
  13.     //模板
  14.     Model.Hotels MH = new Model.Hotels();
  15.     //业务
  16.     BLL.Hotels BH = new BLL.Hotels();
  17.     protected void Page_Load(object sender, EventArgs e)
  18.     {
  19.         LoginLogic.MatchLoad("../", "Hotels_HotelsEditor");
  20.         if (!IsPostBack)
  21.         {
  22.             object objid = Request.QueryString["id"];
  23.             if (objid != null)
  24.             {
  25.                 int ri = int.Parse(objid.ToString());
  26.                 MH = BH.GetModel(ri);
  27.                 KeyValue_ZSLBM.Text = MH.ZSLBM;
  28.                 KeyValue_BGLDM.Text = MH.BGLDM;
  29.                 KeyValue_ZSTS.Text = MH.ZSTS.ToString();
  30.                 KeyValue_ZSDWDH.Text = MH.ZSDWDH;
  31.                 KeyValue_ZJG.Text = MH.ZJG.ToString();
  32.                 KeyValue_BZ.Text = MH.BZ;
  33.             }
  34.         }
  35.     }
  36.     protected void Button1_Click(object sender, EventArgs e)
  37.     {
  38.         try
  39.         {
  40.             if (String.IsNullOrEmpty(KeyValue_ZSLBM.Text))
  41.             {
  42.                 throw new Exception("住宿别名不能为空!");//5%1%a%s%p%x
  43.             }
  44.             if (String.IsNullOrEmpty(KeyValue_BGLDM.Text))
  45.             {
  46.                 throw new Exception("宾馆旅店名不能为空!");
  47.             }
  48.             int IKeyValue_ZSTS = 0;
  49.             if (!int.TryParse(KeyValue_ZSTS.Text, out IKeyValue_ZSTS))
  50.             {
  51.                 throw new Exception("住宿天数不正确!");
  52.             }
  53.             decimal DKeyValue_ZJG = 0;
  54.             if (!decimal.TryParse(KeyValue_ZJG.Text, out DKeyValue_ZJG))
  55.             {
  56.                 throw new Exception("总价格不正确!");
  57.             }
  58.             MH.ZSLBM = KeyValue_ZSLBM.Text;
  59.             MH.BGLDM = KeyValue_BGLDM.Text;
  60.             MH.ZSTS = IKeyValue_ZSTS;
  61.             MH.ZSDWDH = KeyValue_ZSDWDH.Text;
  62.             MH.ZJG = DKeyValue_ZJG;
  63.             MH.BZ = KeyValue_BZ.Text;
  64.             BH.Update(MH);
  65.             MessageBox.Show("更新成功!");
  66.         }
  67.         catch (Exception exp)
  68.         {
  69.             MessageBox.Show(exp.Message);
  70.         }
  71.     }
  72. }