/// <summary> /// 获取酒店预控信息 /// </summary> /// <param name="id">预控编号</param> /// <param name="companyId">公司编号</param> /// <returns>酒店预控信息</returns> public MSourceSueHotel GetModelByHotelId(string id, string companyId) { MSourceSueHotel item = null; if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(companyId)) { item = dal.GetModelByHotelId(id, companyId); } return(item); }
/// <summary> /// 保存 /// </summary> private void Save() { MSourceSueHotel model = new MSourceSueHotel(); string msg = string.Empty; if (GetPageVal(model, ref msg)) { PageResponse(UtilsCommons.AjaxReturnJson(new BSourceControl().AddSueHotel(model) ? "1" : "-1", "添加失败!")); } else { PageResponse(UtilsCommons.AjaxReturnJson("-1", msg)); } }
/// <summary> /// 添加酒店预控 /// </summary> /// <param name="item">酒店预控实体</param> /// <returns>true:成功 false:失败</returns> public bool AddSueHotel(MSourceSueHotel item) { bool result = false; if (item != null) { item.Id = Guid.NewGuid().ToString(); result = dal.AddSueHotel(item); if (result) { EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(string.Format("添加酒店预控,编号为:{0}", item.Id)); } } return(result); }
/// <summary> /// 获取页面数据 /// </summary> private bool GetPageVal(MSourceSueHotel model, ref string msg) { model.DeptId = SiteUserInfo.DeptId; //酒店名称 model.SourceName = Utils.GetFormValue(SupplierControl1.ClientText); //酒店编号 model.SourceId = Utils.GetFormValue(SupplierControl1.ClientValue); //房型 model.RoomId = Utils.GetFormValue("ddl_houseType"); model.RoomType = Utils.GetFormValue("RoomType"); //公司编号 model.CompanyId = CurrentUserCompanyID; //操作时间 model.IssueTime = DateTime.Now; //操作员 model.OperatorId = SiteUserInfo.UserId; //预控数量 model.ControlNum = Utils.GetInt(Utils.GetFormValue(txt_quantity.ClientID)); //最后保留日期 model.LastTime = Utils.GetDateTime(Utils.GetFormValue(txt_lastTime.ClientID)); //预付房款 model.Advance = Utils.GetDecimal(Utils.GetFormValue(txt_advance.ClientID)); //总房价格 model.TotalPrice = Utils.GetDecimal(Utils.GetFormValue(txt_totalPrice.ClientID)); //单价 model.UnitPrice = Utils.GetDecimal(Utils.GetFormValue(txt_unitPrice.ClientID)); //备注 model.Remark = Utils.GetFormValue(txt_remark.ClientID); msg += model.SourceName.Length > 0 && model.SourceId.Length > 0 ? string.Empty : "酒店名称异常,请使用选用功能选取!<br/>"; msg += model.RoomId.Length > 0 ? string.Empty : "酒店房型不能为空!<br/>"; msg += model.ControlNum > 0 ? string.Empty : "预控数量不能为0!<br/>"; msg += model.LastTime != DateTime.MinValue ? string.Empty : "最后保留日期格式错误!<br/>"; //预控类型 if (Utils.GetFormValue("ControlType").Length > 0) { model.SourceControlType = (SourceControlType)Utils.GetInt(Utils.GetFormValue("ControlType")); switch (model.SourceControlType) { case SourceControlType.单控: //有效期--始 model.PeriodStartTime = Utils.GetDateTime(Utils.GetFormValue(ControlType1.ControlDateSClientID)); msg += model.PeriodStartTime != DateTime.MinValue ? string.Empty : "预控时间格式错误!<br/>"; //有效期--终 model.PeriodEndTime = Utils.GetDateTime(Utils.GetFormValue(ControlType1.ControlDateEClientID)); msg += model.PeriodEndTime != DateTime.MinValue ? string.Empty : "预控时间格式错误!<br/>"; //单控团号 string[] tourList = Utils.GetFormValue("TourList").Split('|'); IList <MSourceSueTour> tourNoList = new List <MSourceSueTour>(); foreach (string item in tourList) { if (item.Length > 0 && item.Split(',').Length == 2) { tourNoList.Add(new MSourceSueTour { SourceType = SourceControlCategory.酒店, TourId = item.Split(',')[1] }); } } model.TourNoList = tourNoList; msg += model.TourNoList.Count > 0 ? string.Empty : "单控状态下请选择团号!<br/>"; break; case SourceControlType.总控: model.PeriodStartTime = model.PeriodEndTime = Utils.GetDateTime(Utils.GetFormValue("Date")); msg += model.PeriodStartTime != DateTime.MinValue ? string.Empty : "预控时间格式错误!<br/>"; //共享类型 if (Utils.GetIntSign(Utils.GetFormValue("ShareType"), -1) > 0) { model.ShareType = (ShareType)Utils.GetInt(Utils.GetFormValue("ShareType")); if (model.ShareType == ShareType.共享) { IList <MSourceSueOperator> sourceSueOperatorList = new List <MSourceSueOperator>(); string[] ids = Utils.GetFormValue("Ids").Split(','); foreach (string item in ids) { sourceSueOperatorList.Add(new MSourceSueOperator { SourceType = SourceControlCategory.酒店, OperatorId = item }); } //预控人员 model.OperatorList = sourceSueOperatorList; msg += model.OperatorList.Count > 0 ? string.Empty : "总控--不共享状态下请选择用车人员!<br/>"; } } else { msg += "总控状态下请选择共享类型!<br/>"; } break; } } else { msg += "预控类型不能为空!<br/>"; } return(msg.Length <= 0); }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(SourceControlCategory sourceControlCategory) { string sourceId = Utils.GetQueryStringValue("sourceId"); if (sourceId.Length > 0) { BSourceControl bll = new BSourceControl(); switch (sourceControlCategory) { case SourceControlCategory.酒店: //预控Model MSourceSueHotel hotelModel = bll.GetModelByHotelId(sourceId, CurrentUserCompanyID); if (hotelModel != null) { SetVal( hotelModel.SourceName, //酒店名称 hotelModel.RoomType, //房型 hotelModel.ControlNum.ToString(), //预控数量 hotelModel.AlreadyNum.ToString(), //已使用数量 (hotelModel.ControlNum - hotelModel.AlreadyNum).ToString() //剩余数量 ); } break; case SourceControlCategory.车辆: //预控Model MSourceSueCar carModel = bll.GetModelByCarId(sourceId, CurrentUserCompanyID); if (carModel != null) { SetVal( carModel.SourceName, //车队名称 carModel.TypeName, //车型 carModel.ControlNum.ToString(), //预控数量 carModel.AlreadyNum.ToString(), //已使用数量 (carModel.ControlNum - carModel.AlreadyNum).ToString() //剩余数量 ); } break; case SourceControlCategory.游轮: //预控Model MSourceSueShip shipModel = bll.GetModelByShipId(sourceId, CurrentUserCompanyID); if (shipModel != null) { SetVal( shipModel.ShipCompany, //游船公司名称 shipModel.ShipName, //游船名称 shipModel.ControlNum.ToString(), //预控数量 shipModel.AlreadyNum.ToString(), //已使用数量 (shipModel.ControlNum - shipModel.AlreadyNum).ToString() //剩余数量 ); } break; case SourceControlCategory.景点: //预控Model var sightModel = bll.GetModelBySightId(sourceId, CurrentUserCompanyID); if (sightModel != null) { SetVal( sightModel.SourceName, //景点公司名称 sightModel.SpotName, //景点名称 sightModel.ControlNum.ToString(), //预控数量 sightModel.AlreadyNum.ToString(), //已使用数量 (sightModel.ControlNum - sightModel.AlreadyNum).ToString() //剩余数量 ); } break; case SourceControlCategory.其他: //预控Model var otherModel = bll.GetModelByOtherId(sourceId, CurrentUserCompanyID); if (otherModel != null) { SetVal( otherModel.SourceName, //其他公司名称 otherModel.TypeName, //支出项目名称 otherModel.ControlNum.ToString(), //预控数量 otherModel.AlreadyNum.ToString(), //已使用数量 (otherModel.ControlNum - otherModel.AlreadyNum).ToString() //剩余数量 ); } break; } //预控变更记录 IList <MSourceSueHotelChange> ls = bll.GetSourceSueChangeList(sourceId, sourceControlCategory); if (ls != null && ls.Count > 0) { rpt_list.DataSource = ls; rpt_list.DataBind(); } else { this.phdFr.Visible = false; } } }