コード例 #1
0
        /// <summary>
        /// 初始化表单
        /// </summary>
        private void InitForm()
        {
            EyouSoft.Model.HotelStructure.MNewHotelInfo model = null;

            if (!string.IsNullOrEmpty(EditId))
            {
                model = EyouSoft.BLL.HotelStructure.BNewHotel.CreateInstance().GetModel(int.Parse(EditId));
            }

            if (model != null)
            {
                ddlAreaList.SelectedValue = model.CityName.ToString();
                txt_HotelName.Value       = model.HotelName;
                int hotelRank = Convert.ToInt32(model.HotelStar);
                ddlHotelRank.SelectedValue = hotelRank.ToString();
                txt_SalesRoomPrice.Value   = Utils.FilterEndOfTheZeroDecimal(model.MenShiPrice).ToString();
                txt_TourTeamPrice.Value    = Utils.FilterEndOfTheZeroDecimal(model.TeamPrice).ToString();
                txt_OperateDate.Text       = model.OperateTime.ToString("yyyy-MM-dd");
                txtQQ.Value = model.QQ;

                if (model.CityAreaType == EyouSoft.Model.HotelStructure.CityAreaType.港澳)
                {
                    hCityAreaId.Value = ((int)EyouSoft.Model.HotelStructure.CityAreaType.港澳).ToString();
                }
                else if (model.CityAreaType == EyouSoft.Model.HotelStructure.CityAreaType.华东五市)
                {
                    hCityAreaId.Value = ((int)EyouSoft.Model.HotelStructure.CityAreaType.华东五市).ToString();
                }
                model = null;
            }
            else
            {
                txt_OperateDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }
        }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //执行是否成功
            bool Result = false;
            //城市名称
            string cityName = this.ddlAreaList.SelectedValue;
            //地区类型
            int areaId = Utils.GetInt(hCityAreaId.Value, 0);
            //酒店名称
            string hotelName = Utils.GetText(txt_HotelName.Value.Trim(), 100);
            //星级
            string hotelRank = ddlHotelRank.SelectedValue;
            //门市价
            decimal salseRoomPrice = Utils.GetDecimal(txt_SalesRoomPrice.Value.ToString(), 0);
            //团队价
            decimal tourPrice = Utils.GetDecimal(this.txt_TourTeamPrice.Value.ToString(), 0);
            //qq
            string qq = Utils.InputText(txtQQ.Value.ToString(), 50);
            //发布时间
            DateTime CreateTime = DateTime.Parse(txt_OperateDate.Text);

            #region 实体赋值
            EyouSoft.Model.HotelStructure.MNewHotelInfo model = new EyouSoft.Model.HotelStructure.MNewHotelInfo();
            model.CityAreaType = (EyouSoft.Model.HotelStructure.CityAreaType)areaId;
            model.CityName     = cityName;
            model.HotelName    = Utils.InputText(hotelName);
            model.HotelStar    = (EyouSoft.Model.HotelStructure.HotelStarType) int.Parse(hotelRank);
            model.HotelName    = Utils.InputText(hotelName);
            model.MenShiPrice  = salseRoomPrice;
            model.OperateId    = MasterUserInfo.ID;
            model.OperateTime  = DateTime.Parse(this.txt_OperateDate.Text);
            model.TeamPrice    = tourPrice;
            model.QQ           = qq;

            #endregion

            #region 验证执行添加或者修改
            if (!string.IsNullOrEmpty(EditId))
            {
                model.Id = int.Parse(EditId);
                Result   = EyouSoft.BLL.HotelStructure.BNewHotel.CreateInstance().Update(model);
            }
            else
            {
                Result = EyouSoft.BLL.HotelStructure.BNewHotel.CreateInstance().Add(model);
            }
            #endregion

            #region 输出提醒信息
            if (Result)
            {
                MessageBox.ShowAndRedirect(this, model.Id > 0 ? "修改成功!" : "添加成功!",
                                           "/HotelHomePageManage/HotelManageList.aspx");
            }
            else
            {
                MessageBox.ShowAndRedirect(this, model.Id > 0 ? "修改失败!" : "添加失败!",
                                           "/HotelHomePageManage/HotelManageList.aspx");
            }
            #endregion
        }