/// <summary> /// 获取游轮预控信息 /// </summary> /// <param name="id">预控编号</param> /// <param name="companyId">公司编号</param> /// <returns>游轮预控信息</returns> public MSourceSueShip GetModelByShipId(string id, string companyId) { MSourceSueShip item = null; if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(companyId)) { item = dal.GetModelByShipId(id, companyId); } return(item); }
/// <summary> /// 保存 /// </summary> private void Save() { MSourceSueShip model = new MSourceSueShip(); string msg = string.Empty; if (GetPageVal(model, ref msg)) { AjaxResponse(UtilsCommons.AjaxReturnJson(new BSourceControl().AddSueShip(model) ? "1" : "-1", "添加失败!")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("-1", msg)); } }
/// <summary> /// 添加游轮预控 /// </summary> /// <param name="item">游轮预控实体</param> /// <returns>true:成功 false:失败</returns> public bool AddSueShip(MSourceSueShip item) { bool result = false; if (item != null) { item.Id = Guid.NewGuid().ToString(); result = dal.AddSueShip(item); if (result) { EyouSoft.BLL.SysStructure.BSysLogHandle.Insert(string.Format("添加游轮预控,编号为:{0}", item.Id)); } } return(result); }
/// <summary> /// 列表数据初始化 /// </summary> /// <param name="searchModel"></param> private void ListDataInit(string provice, string city, string name, string tourid) { EyouSoft.Model.SourceStructure.MSourceSueShip Model = new MSourceSueShip(); EyouSoft.BLL.SourceStructure.BSourceControl bsource = new BSourceControl(); pageIndex = Utils.GetInt(Request.QueryString["Page"], 1); MSourceSueShipSearch mSourceShip = new MSourceSueShipSearch(); mSourceShip.SourceName = name; mSourceShip.CompanyId = this.SiteUserInfo.CompanyId; mSourceShip.ProvinceId = Utils.GetInt(provice); mSourceShip.CityId = Utils.GetInt(city); IList <MSourceSueShip> list = bsource.GetListSueShip(pageIndex, pageSize, ref pageCount, tourid, this.SiteUserInfo.UserId, mSourceShip); if (list != null) { if (list.Count > 0) { this.RepList.DataSource = list; this.RepList.DataBind(); BindPage(); } else { //提示没有查询到数据 this.RepList.Controls.Add(new Label() { Text = "<tr><td colspan='6' align='center'>未找到相关游轮,建议您修改相关查询条件后再查询!</td></tr>" }); ExporPageInfoSelect1.Visible = false; } } else { //提示没有查询到数据 this.RepList.Controls.Add(new Label() { Text = "<tr><td colspan='6' align='center'>未找到相关游轮,建议您修改相关查询条件后再查询!</td></tr>" }); ExporPageInfoSelect1.Visible = false; } }
/// <summary> /// 获取页面数据 /// </summary> private bool GetPageVal(MSourceSueShip model, ref string msg) { #region 实体赋值 model.DeptId = SiteUserInfo.DeptId; //公司编号 model.CompanyId = CurrentUserCompanyID; //操作时间 model.IssueTime = DateTime.Now; //操作员 model.OperatorId = SiteUserInfo.UserId; //预控数量 model.ControlNum = Utils.GetInt(Utils.GetFormValue(txt_ControlNum.ClientID)); //游船公司名称 model.ShipCompany = Utils.GetFormValue(SupplierControl1.ClientText); //游船公司编号 model.SourceId = Utils.GetFormValue(SupplierControl1.ClientValue); //游船名称 model.ShipName = Utils.GetFormValue("ddl_ShipCompanyName"); model.SubId = Utils.GetFormValue("ddl_ShipCompany"); //登船日期 model.GoShipTime = Utils.GetDateTime(Utils.GetFormValue(txt_GoShipTime.ClientID)); //最后保留日期 model.LastTime = Utils.GetDateTime(Utils.GetFormValue(txt_lastTime.ClientID)); //单价 model.UnitPrice = Utils.GetDecimal(Utils.GetFormValue(txt_UnitPrice.ClientID)); //总价 model.TotalPrice = Utils.GetDecimal(Utils.GetFormValue(txt_TotalPrice.ClientID)); //预付金额 model.Advance = Utils.GetDecimal(Utils.GetFormValue(txt_Advance.ClientID)); //航线 model.ShipRoute = Utils.GetFormValue(txt_ShipRoute.ClientID); //景点 model.ShipSpot = Utils.GetFormValue(txt_ShipSpot.ClientID); //备注 model.Remark = Utils.GetFormValue(txt_Remark.ClientID); #endregion #region 验证 msg += model.ShipCompany.Length > 0 ? string.Empty : "游船公司不能为空!<br/>"; msg += model.SourceId.Length > 0 ? string.Empty : "游船公司编号不能为空!<br/>"; msg += model.ShipName.Length > 0 ? string.Empty : "游船名称不能为空!<br/>"; msg += model.GoShipTime != DateTime.MinValue ? string.Empty : "登船日期不能为空!<br/>"; msg += model.LastTime != DateTime.MinValue ? string.Empty : "最后保留日期格式错误!<br/>"; msg += model.UnitPrice > 0 ? string.Empty : "单价不能为空!<br/>"; msg += model.ControlNum > 0 ? string.Empty : "控船数量不能为0!<br/>"; #endregion //预控类型 if (Utils.GetFormValue("ControlType").Length > 0) { model.SourceControlType = (SourceControlType)Utils.GetInt(Utils.GetFormValue("ControlType")); switch (model.SourceControlType) { case SourceControlType.单控: //单控团号 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.总控: //共享类型 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; } } }