/// <summary> /// 获取酒店房型实体 /// </summary> /// <param name="RoomXml">房型XML</param> /// <returns></returns> private IList <EyouSoft.Model.PlanStructure.MPlanHotelRoom> GetHotelRoomList(string RoomXml) { IList <EyouSoft.Model.PlanStructure.MPlanHotelRoom> list = new List <EyouSoft.Model.PlanStructure.MPlanHotelRoom>(); if (!string.IsNullOrEmpty(RoomXml)) { XElement em = XElement.Parse(RoomXml); var row = em.Elements("row"); foreach (var item in row) { EyouSoft.Model.PlanStructure.MPlanHotelRoom model = new EyouSoft.Model.PlanStructure.MPlanHotelRoom(); model.Quantity = Utils.GetInt(item.Element("Quantity").Value); model.PriceType = (EyouSoft.Model.EnumType.PlanStructure.PlanHotelPriceType)Utils.GetInt(item.Element("Type").Value); model.RoomType = item.Element("RoomType").Value; model.RoomId = item.Element("RoomId").Value; model.UnitPrice = Utils.GetDecimal(item.Element("UnitPrice").Value); list.Add(model); model = null; } } return(list); }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected string PageSave() { #region 表单赋值 string setsrrorMsg = string.Empty; string msg = string.Empty; //酒店名称 string hotelName = Utils.GetFormValue(this.supplierControl1.ClientText); //酒店id string hotelId = Utils.GetFormValue(this.supplierControl1.ClientValue); //星级 string hotelStart = Utils.GetFormValue(this.ddlHotelStart.UniqueID); //联系人 联系电话 联系传真 string contectName = Utils.GetFormValue(this.txtContectName.UniqueID); string contectPhone = Utils.GetFormValue(this.txtContectPhone.UniqueID); string contectFax = Utils.GetFormValue(this.txtContectFax.UniqueID); //入住时间 离店时间 天数 DateTime?startTime = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtStartTime.UniqueID)); DateTime?endTime = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtEndTime.UniqueID)); string days = Utils.GetFormValue(this.txtroomDays.UniqueID); //房型 单价 计算方式 数量 小计 string[] roomType = Utils.GetFormValues("ddlRoomType"); string[] unitPirces = Utils.GetFormValues("txtunitPrice"); string[] selectType = Utils.GetFormValues("select"); string[] numbers = Utils.GetFormValues("txtRoomNumber"); string[] roomItemDays = Utils.GetFormValues("txtRoomItemDays"); string[] TotalMoney = Utils.GetFormValues("txtTotalMoney"); string[] txtCheckInDate = Utils.GetFormValues("txtCheckInDate"); string[] txtCheckOutDate = Utils.GetFormValues("txtCheckOutDate"); //付房数量 免房数量 string payRoomNum = Utils.GetFormValue(this.txtPayRoomNumbers.UniqueID); string FreRoomNum = Utils.GetFormValue(this.txtFreRoomNumber.UniqueID); //是否含早 string ContainsEarly = Utils.GetFormValue(this.ddlContainsEarly.UniqueID); //早餐费用 单价 人数 次数 decimal unitPricesEarly = Utils.GetDecimal(Utils.GetFormValue(this.txtunitPricesEarly.UniqueID)); string earlyPeopleNum = Utils.GetFormValue(this.txtPeopleNumEarly.UniqueID); string sequenceNumEarly = Utils.GetFormValue(this.txtsequenceNumEarly.UniqueID); //结算费用 费用明细 decimal totalMoney = Utils.GetDecimal(Utils.GetFormValue(this.txtTotalPrices.UniqueID)); string CostParticu = Utils.GetFormValue(this.txtCostParticu.UniqueID); //导游须知 其它备注 string guidNotes = Utils.GetFormValue(this.txtGuidNotes.UniqueID); string otherMarks = Utils.GetFormValue(this.txtOtherRemark.UniqueID); //返利 状态 bool profit = Utils.GetFormValue(this.Selprofit1.UniqueID) == "0" ? true : false; #endregion #region 后台验证 if (string.IsNullOrEmpty(hotelName) && string.IsNullOrEmpty(hotelId)) { msg += "请选择酒店名称!<br/>"; } if (string.IsNullOrEmpty(startTime.ToString())) { msg += "请填写入住时间!<br/>"; } if (string.IsNullOrEmpty(endTime.ToString())) { msg += "请填写离店时间!<br/>"; } if (string.IsNullOrEmpty(days)) { msg += "请填写入住天数!<br/>"; } if (roomType.Length > 0) { for (int i = 0; i < roomType.Length; i++) { if (string.IsNullOrEmpty(roomType[i])) { msg += "第" + (i + 1) + "行请选择房型!<br/>"; } } } if (unitPirces.Length > 0) { for (int i = 0; i < unitPirces.Length; i++) { if (string.IsNullOrEmpty(unitPirces[i])) { msg += "第" + (i + 1) + "行请输入单价!<br/>"; } } } if (numbers.Length > 0) { for (int i = 0; i < numbers.Length; i++) { if (string.IsNullOrEmpty(numbers[i])) { msg += "第" + (i + 1) + "行请输入数量!<br/>"; } } } string[] totalPrices = Utils.GetFormValues("txtTotalMoney"); if (totalPrices.Length > 0) { for (int i = 0; i < totalPrices.Length; i++) { if (string.IsNullOrEmpty(totalPrices[i]) && Utils.GetDecimal(totalPrices[i]) <= 0) { msg += "第" + totalPrices[i] + "行请输入小计费用!<br/>"; } } } if (string.IsNullOrEmpty(ContainsEarly)) { msg += "请选择是否含早餐!<br/>"; } if (totalMoney <= 0) { msg += "请填写结算费用!<br/>"; } if (profit.ToString() == "-1") { msg += "请选择是否返利!<br/>"; } string status = Utils.GetFormValue("SelStatus"); if (string.IsNullOrEmpty(status)) { msg += "请选择状态!<br/>"; } if (string.IsNullOrEmpty(Utils.GetFormValue("SelPanyMent"))) { msg += "请选择支付方式!<br/>"; } if (msg != "") { setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); return(setsrrorMsg); } #endregion #region 实体赋值 EyouSoft.Model.PlanStructure.MPlanBaseInfo baseinfo = new EyouSoft.Model.PlanStructure.MPlanBaseInfo(); baseinfo.AddStatus = EyouSoft.Model.EnumType.PlanStructure.PlanAddStatus.计调安排时添加; baseinfo.CompanyId = this.SiteUserInfo.CompanyId; baseinfo.Confirmation = totalMoney; baseinfo.PlanCost = totalMoney; baseinfo.ContactFax = contectFax; baseinfo.ContactName = contectName; baseinfo.ContactPhone = contectPhone; baseinfo.EndDate = endTime; baseinfo.GuideNotes = guidNotes; baseinfo.IsRebate = profit; baseinfo.IssueTime = System.DateTime.Now; baseinfo.Num = Utils.GetInt(payRoomNum); baseinfo.PaymentType = (EyouSoft.Model.EnumType.PlanStructure.Payment)Utils.GetInt(Utils.GetFormValue("SelPanyMent")); baseinfo.PlanHotel = new EyouSoft.Model.PlanStructure.MPlanHotel(); baseinfo.PlanHotel.Days = Utils.GetInt(days); baseinfo.PlanHotel.FreeNumber = Utils.GetInt(FreRoomNum); baseinfo.PlanHotel.IsMeal = (EyouSoft.Model.EnumType.PlanStructure.PlanHotelIsMeal)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanHotelIsMeal), ContainsEarly); baseinfo.PlanHotel.MealFrequency = Utils.GetInt(sequenceNumEarly); baseinfo.PlanHotel.MealNumber = Utils.GetInt(earlyPeopleNum); baseinfo.PlanHotel.MealPrice = unitPricesEarly; baseinfo.PlanHotel.Star = (EyouSoft.Model.EnumType.SourceStructure.HotelStar)Enum.Parse(typeof(EyouSoft.Model.EnumType.SourceStructure.HotelStar), hotelStart); baseinfo.PlanHotel.QianTaiTelephone = Utils.GetFormValue(txtQianTaiTelephone.UniqueID); baseinfo.PlanHotel.PlanHotelRoomList = new List <EyouSoft.Model.PlanStructure.MPlanHotelRoom>(); for (int i = 0; i < roomType.Length; i++) { var roomHotel = new EyouSoft.Model.PlanStructure.MPlanHotelRoom(); roomHotel.RoomType = roomType[i].Split(',')[1]; roomHotel.RoomId = roomType[i].Split(',')[0]; roomHotel.UnitPrice = Utils.GetDecimal(unitPirces[i]); roomHotel.Days = Utils.GetInt(roomItemDays[i]); roomHotel.PriceType = (EyouSoft.Model.EnumType.PlanStructure.PlanHotelPriceType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanHotelPriceType), selectType[i]); roomHotel.Quantity = Utils.GetInt(numbers[i]); roomHotel.Total = Utils.GetDecimal(TotalMoney[i]); roomHotel.CheckInDate = Utils.GetDateTimeNullable(txtCheckInDate[i]); roomHotel.CheckOutDate = Utils.GetDateTimeNullable(txtCheckOutDate[i]); baseinfo.PlanHotel.PlanHotelRoomList.Add(roomHotel); } baseinfo.Remarks = otherMarks; baseinfo.SourceId = hotelId; baseinfo.SourceName = hotelName; baseinfo.StartDate = startTime; baseinfo.Status = (EyouSoft.Model.EnumType.PlanStructure.PlanState)Utils.GetInt(Utils.GetFormValue("SelStatus")); if (Utils.GetFormValue(this.supplierControl1.ClientIsyukong) == "1") { baseinfo.SueId = Utils.GetFormValue(this.supplierControl1.ClientzyykValue); } baseinfo.TourId = Utils.GetQueryStringValue("tourId"); baseinfo.Type = EyouSoft.Model.EnumType.PlanStructure.PlanProject.酒店; baseinfo.OperatorId = this.SiteUserInfo.UserId; baseinfo.OperatorName = this.SiteUserInfo.Name; baseinfo.CostDetail = CostParticu; #endregion #region 提交操作 //酒店id string planID = Utils.GetQueryStringValue("planId"); int result = 0; EyouSoft.BLL.PlanStructure.BPlan bll = new EyouSoft.BLL.PlanStructure.BPlan(); if (planID != null && planID != "") { baseinfo.PlanId = planID; baseinfo.PlanHotel.PlanId = planID; result = bll.UpdPlan(baseinfo); if (result == 1) { msg += "修改成功!"; setsrrorMsg = UtilsCommons.AjaxReturnJson("1", "" + msg + ""); } else if (result == 0) { msg += "修改失败!"; setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } else if (result == -2) { msg += "预控数量不足,修改失败!"; setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } } else { result = bll.AddPlan(baseinfo); if (result == 1) { msg += "添加成功!"; setsrrorMsg = UtilsCommons.AjaxReturnJson("1", "" + msg + ""); } else if (result == 0) { msg += "添加失败!"; setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } else if (result == -2) { msg += "预控数量不足,添加失败!"; setsrrorMsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } } #endregion return(setsrrorMsg); }