/// <summary> /// 保存新的报价 /// </summary> /// <returns></returns> private string PageSave() { string msg = string.Empty; int type = Utils.GetInt(Utils.GetQueryStringValue("type")); #region 获取表单 //线路区域编号 int areaID = Utils.GetInt(Utils.GetFormValue("sltArea")); //线路编号 string routeID = Utils.GetFormValue(this.hideRouteID.UniqueID); //线路名称 string routeName = Utils.GetFormValue(this.txt_RouteName.UniqueID); //天数 int days = Utils.GetInt(Utils.GetFormValue(this.txt_Days.UniqueID)); //客源地 国家 int contryID = Utils.GetInt(Utils.GetFormValue("sltCountry")); //客源地 省份 int provinceID = Utils.GetInt(Utils.GetFormValue("sltProvince")); //询价单位 编号 string buyCompanyID = Utils.GetFormValue(this.UC_CustomerUnitSelect.ClientNameKHBH); //询价单位 名称 string buyCompanyName = Utils.GetFormValue(this.UC_CustomerUnitSelect.ClientNameKHMC); //联系人 string contactName = Utils.GetFormValue(this.txt_Contact.UniqueID); //联系电话 string contactTel = Utils.GetFormValue(this.txt_ConTel.UniqueID); //联系人部门编号 string contactDepartId = Utils.GetFormValue(this.hideContactDeptId.UniqueID); //销售员编号 string sellsID = Utils.GetFormValue(this.SellsSelect1.SellsIDClient); //销售员名称 string sellsName = Utils.GetFormValue(this.SellsSelect1.SellsNameClient); //报价员 取当前登录用户 EyouSoft.Model.TourStructure.MOperatorInfo operatorModel = new EyouSoft.Model.TourStructure.MOperatorInfo(); operatorModel.OperatorId = this.SiteUserInfo.UserId; operatorModel.Name = this.SiteUserInfo.Name; operatorModel.Phone = this.SiteUserInfo.Telephone; //成人数 int adultCount = Utils.GetInt(Utils.GetFormValue(this.txt_Adult.UniqueID)); //成人价格 decimal adultPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtAdultPrice.UniqueID)); //儿童数 int childCount = Utils.GetInt(Utils.GetFormValue(this.txt_Child.UniqueID)); //儿童价格 decimal childPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtChildPrice.UniqueID)); //其它价格 decimal otherPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtOtherPrice.UniqueID)); //行程特色 string planContent = Utils.EditInputText(Request.Form[this.txtPlanContent.UniqueID]); //价格备注 string quoteRemark = Utils.GetFormValue(this.txtQuoteRemark.UniqueID); //合计金额 decimal sumPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtSumPrice.UniqueID)); //签字资料(附件) #region 表单获取 //出团时间 DateTime successDateBegin = Utils.GetDateTime(Utils.GetFormValue(this.txtLDate.UniqueID), DateTime.Now); //出发交通 string successsStraffBegin = Utils.GetFormValue(this.txtSuccesssStraffBegin.UniqueID); //返回交通 string successsStraffEnd = Utils.GetFormValue(this.txtSuccesssStraffEnd.UniqueID); //集合方式 string successGather = Utils.GetFormValue(this.txtSuccessGather.UniqueID); //增加费用 decimal successAddPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtSuccessAddPrice.UniqueID), 0); //增加费用备注 string successAddPriceRemark = Utils.GetFormValue(this.txtSuccessAddPriceRemark.UniqueID); //减少费用 decimal successReducePrice = Utils.GetDecimal(Utils.GetFormValue(this.txtSuccessReducePrice.UniqueID)); //减少费用备注 string successReducePriceRemark = Utils.GetFormValue(this.txtSuccessReducePriceRemark.UniqueID); //导游现收 decimal successGuideIncome = Utils.GetDecimal(Utils.GetFormValue(this.txtSuccessGuideIncome.UniqueID)); //订单备注 string successOrderRemark = Utils.GetFormValue(this.txtSuccessOrderRemark.UniqueID); #region 超限申请表单获取 //垫付金额 decimal applyPrice = Utils.GetDecimal(Utils.GetFormValue(this.txtApplyPrice.UniqueID)); //超限备注 string applyRemarks = Utils.GetFormValue(this.txtApplyRemarks.UniqueID); //申请人编号 string applyManID = this.SiteUserInfo.UserId; //申请日期 DateTime applyDateTime = DateTime.Now; #endregion //变更标题 string changeTitle = Utils.GetFormValue("txt_ChangeTitle"); //变更备注 string changeRemark = Utils.GetFormValue("txt_ChangeRemark"); //签证附件(新) string[] visaUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldVisaUpload = Utils.GetFormValues("hideVisaFile"); #endregion #endregion //1=保存 string saveType = Utils.GetQueryStringValue("saveType"); #region 表单后台验证 if (areaID == 0) { msg = "请选择线路区域!"; } if (routeName == "") { msg += "<br />请输入线路名称!"; } if (days == 0) { msg += "<br />请输入天数!"; } if (buyCompanyID == "") { msg += "<br />请选择客户单位!"; } if (sellsID == "") { msg += "<br />请输入销售员!"; } if (adultCount == 0) { msg += "<br />请输入成人数!"; } if (adultPrice == 0) { msg += "<br />请输入成人价!"; } if (msg != "") { return("{\"result\":\"0\",\"msg\":\"" + msg + "\"}"); } #endregion EyouSoft.BLL.TourStructure.BTour bll = new EyouSoft.BLL.TourStructure.BTour(); EyouSoft.Model.TourStructure.MTourTeamInfo model = new EyouSoft.Model.TourStructure.MTourTeamInfo(); act = Utils.GetQueryStringValue("act"); if (act == "update") { model.TourId = Utils.GetQueryStringValue("id"); } model.AddCostRemark = successAddPriceRemark; model.AdultPrice = adultPrice; model.Adults = adultCount; model.AdvanceApp = null; model.AreaId = areaID; //model.AreaName = ""; model.ChildPrice = childPrice; model.Childs = childCount; model.CompanyId = this.SiteUserInfo.CompanyId; model.CompanyInfo = new MCompanyInfo(); model.CompanyInfo.CompanyId = buyCompanyID; model.CompanyInfo.CompanyName = buyCompanyName; model.CompanyInfo.Contact = contactName; model.CompanyInfo.Phone = contactTel; model.ContactDepartId = contactDepartId; string costCalculation = string.Empty; EyouSoft.Model.TourStructure.MTourService tourService = UtilsCommons.GetTourService(out costCalculation); model.CostCalculation = costCalculation; model.CountryId = contryID; model.Gather = successGather; model.GuideIncome = successGuideIncome; model.LDate = successDateBegin; #region 签证附件 IList <EyouSoft.Model.ComStructure.MComAttach> visaList = null; if (visaUpload.Length > 0) { visaList = new List <EyouSoft.Model.ComStructure.MComAttach>(); for (int i = 0; i < visaUpload.Length; i++) { if (visaUpload[i].Trim() != "") { if (visaUpload[i].Split('|').Length > 1) { EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); visaModel.Downloads = 0; visaModel.FilePath = visaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.报价签证资料; visaModel.Name = visaUpload[i].Split('|')[0]; visaModel.Size = 0; visaList.Add(visaModel); } } } } if (oldVisaUpload.Length > 0) { if (visaList == null) { visaList = new List <EyouSoft.Model.ComStructure.MComAttach>(); } for (int i = 0; i < oldVisaUpload.Length; i++) { EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); visaModel.Downloads = Utils.GetInt(oldVisaUpload[i].Split('|')[2]); visaModel.FilePath = oldVisaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.计划签证资料; visaModel.Name = oldVisaUpload[i].Split('|')[0]; visaModel.Size = 0; visaList.Add(visaModel); } } model.VisaFileList = visaList; #endregion model.LTraffic = successsStraffBegin; model.OperatorInfo = new EyouSoft.Model.TourStructure.MOperatorInfo(); model.OperatorInfo.OperatorId = this.SiteUserInfo.UserId; model.OperatorInfo.Name = this.SiteUserInfo.Name; model.OperatorInfo.Phone = this.SiteUserInfo.Telephone; model.OrderRemark = successOrderRemark; model.OtherCost = otherPrice; Dictionary <string, object> quoteType = UtilsCommons.GetServiceType(); bool IsTourOrSubentry = (bool)quoteType["IsTourOrSubentry"]; if (IsTourOrSubentry) { //整团 tourService.ServiceStandard = quoteType["Service"].ToString(); model.OutQuoteType = EyouSoft.Model.EnumType.TourStructure.TourQuoteType.整团; } else { //分项 model.TourTeamPrice = (IList <EyouSoft.Model.TourStructure.MTourTeamPrice>)quoteType["Service"]; model.OutQuoteType = EyouSoft.Model.EnumType.TourStructure.TourQuoteType.分项; } model.PlanFeature = planContent; model.ProvinceId = provinceID; model.QuoteRemark = quoteRemark; model.ReduceCostRemark = successReducePriceRemark; model.RouteId = routeID; model.RouteName = routeName; model.RTraffic = successsStraffEnd; model.SaleAddCost = successAddPrice; model.TourChangeTitle = changeTitle; model.TourChangeContent = changeRemark; //获得销售员信息实体 EyouSoft.Model.ComStructure.MComUser sellsModel = new EyouSoft.BLL.ComStructure.BComUser().GetModel(sellsID, SiteUserInfo.CompanyId); if (sellsModel != null) { model.SaleInfo = new EyouSoft.Model.TourStructure.MSaleInfo(); model.SaleInfo.SellerId = sellsID; model.SaleInfo.Name = sellsName; model.SaleInfo.Phone = sellsModel.ContactMobile; model.SaleInfo.DeptId = sellsModel.DeptId; } model.SaleReduceCost = successReducePrice; model.SalerIncome = sumPrice - successGuideIncome; model.AdvanceApp = null; model.SumPrice = sumPrice; model.TourDays = days; model.TourPlan = UtilsCommons.GetPlanList(); model.TourService = tourService; #region 无需赋值 //model.PlanPeopleNumber //model.QuoteRemark //model.RealPeopleNumber //model.Review //model.ReviewTime //model.TourPlaner //model.TourPlanItem //model.TourPlanStatus //model.PeopleNumberLast //model.GuideList = null; //model.IsChange = false; //model.IsReview //model.IsSubmit //model.IsSure 列表 //model.LeavePeopleNumber #endregion model.HeTongCode = Utils.GetFormValue(txtHeTongHao.HeTongCodeClientID); model.HeTongId = Utils.GetFormValue(txtHeTongHao.HeTongIdClientID); //超限赋值 if (saveType == "2") { model.AdvanceApp = new EyouSoft.Model.TourStructure.MAdvanceApp(); model.AdvanceApp.Applier = this.SiteUserInfo.Name; model.AdvanceApp.ApplierId = this.SiteUserInfo.UserId; model.AdvanceApp.DisburseAmount = applyPrice; model.AdvanceApp.ApplyTime = applyDateTime; model.AdvanceApp.DeptId = this.SiteUserInfo.DeptId; model.AdvanceApp.Remark = applyRemarks; } //变更明细 switch (type) { case 1: model.TourType = EyouSoft.Model.EnumType.TourStructure.TourType.组团团队; model.Traveller = UtilsCommons.GetTravelList(); break; case 2: model.TourType = EyouSoft.Model.EnumType.TourStructure.TourType.地接团队; model.Traveller = UtilsCommons.GetTravelList(); break; case 3: model.TourType = EyouSoft.Model.EnumType.TourStructure.TourType.出境团队; model.Traveller = UtilsCommons.GetTravelListS(); break; } if (act == "add" || act == "copy") { model.TourStatus = EyouSoft.Model.EnumType.TourStructure.TourStatus.销售未派计划; int r = bll.AddTourTeam(model); switch (r) { case 0: msg = UtilsCommons.AjaxReturnJson("0", "新增计划 失败,请稍后再试!"); break; case 1: msg = UtilsCommons.AjaxReturnJson("1", "新增计划 成功,正在跳转.."); break; case 2: msg = UtilsCommons.AjaxReturnJson("1", "新增计划 成功,已提交垫付申请!"); break; case 3: msg = UtilsCommons.AjaxReturnJson("2", "操作成功! 销售员已超限,请收款或超限申请!", model.TourId); break; case 4: msg = UtilsCommons.AjaxReturnJson("2", "操作成功! 客户单位已超限,请收款或超限申请!", model.TourId); break; case 5: msg = UtilsCommons.AjaxReturnJson("2", "操作成功! 销售员和客户单位已超限,请收款或超限申请!", model.TourId); break; } } if (act == "update" && model.TourId != "") { model.UpdateTime = DateTime.Now; if (bll.UpdateTourTeam(model)) { msg = UtilsCommons.AjaxReturnJson("1", "修改计划 成功,正在跳转..", model.TourId); } else { msg = UtilsCommons.AjaxReturnJson("0", "修改计划 失败,请稍后再试!", model.TourId); } } return(msg); }
/// <summary> /// 保存执行方法 /// </summary> private string PageSave(string id, string doType) { string msg = string.Empty; //t为false为编辑,true时为新增 bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true; string AdultPrice = Utils.GetFormValue(txtAdultPrice.UniqueID); //成人价格 string ChildPrice = Utils.GetFormValue(txtChildPrice.UniqueID); //儿童价格 string TotalPrice = Utils.GetFormValue(txtTotalPrice.UniqueID); //合计价格 string Collection = Utils.GetFormValue(txtCollection.UniqueID); //集合方式 string DayCount = Utils.GetFormValue(txtDayCount.UniqueID); //天数 string StartTraffic = Utils.GetFormValue(txtStartTraffic.UniqueID); //出发交通 string EndTraffic = Utils.GetFormValue(txtEndTraffic.UniqueID); //返程交通 //txtFile 附件 string OtherPrice = Utils.GetFormValue(txtOtherPrice.UniqueID); //其他费用 string PathDesc = Utils.GetFormValue(txtPathDesc.UniqueID); //线路描述 string PathName = Utils.GetFormValue(txtPathName.UniqueID).Trim(); //线路名称 string AreaID = Utils.GetFormValue(HidRouteAreaID.UniqueID); //线路区域编号 string StrRemark = Utils.GetFormValue(txtPathRemark.UniqueID); //获取价格备注 if (string.IsNullOrEmpty(PathName)) { msg = UtilsCommons.AjaxReturnJson("0", "请输入线路名称"); return(msg); } EyouSoft.Model.SourceStructure.MRoute ModelRoute = new EyouSoft.Model.SourceStructure.MRoute(); EyouSoft.BLL.SourceStructure.BSource bll = new EyouSoft.BLL.SourceStructure.BSource(); if (!string.IsNullOrEmpty(id) && doType == "update") { ModelRoute = bll.GetRouteModel(id); ModelRoute.RouteId = id; if (string.IsNullOrEmpty(AreaID)) { AreaID = ModelRoute.AreaId.ToString(); } } if (Utils.GetInt(AreaID) == 0) { msg = UtilsCommons.AjaxReturnJson("0", "请选择线路区域!"); return(msg); } //合同附件 //合同附件(新) string[] hdUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldhdUpload = Utils.GetFormValues("hideFileInfo"); #region 合同附件 EyouSoft.Model.ComStructure.MComAttach hdModel = new EyouSoft.Model.ComStructure.MComAttach(); if (oldhdUpload.Length > 0) { for (int i = 0; i < oldhdUpload.Length; i++) { hdModel.FilePath = oldhdUpload[i].Split('|')[1]; hdModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.线路附件; hdModel.Name = oldhdUpload[i].Split('|')[0]; hdModel.Size = 0; } } if (hdUpload.Length > 0) { for (int i = 0; i < hdUpload.Length; i++) { if (hdUpload[i].Trim() != "") { if (hdUpload[i].Split('|').Length > 1) { hdModel.Downloads = 0; hdModel.FilePath = hdUpload[i].Split('|')[1]; hdModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.线路附件; hdModel.Name = hdUpload[i].Split('|')[0]; hdModel.Size = 0; } } } } ModelRoute.Attach = hdModel; #endregion #region 签证附件 //签证附件(新) string[] visaUpload = Utils.GetFormValues(this.UploadControl2.ClientHideID); string[] oldVisaUpload = Utils.GetFormValues("hideVisaFile"); IList <EyouSoft.Model.ComStructure.MComAttach> visaList = null; if (oldVisaUpload.Length > 0) { if (visaList == null) { visaList = new List <EyouSoft.Model.ComStructure.MComAttach>(); } for (int i = 0; i < oldVisaUpload.Length; i++) { EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); visaModel.FilePath = oldVisaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.线路签证资料; visaModel.Name = oldVisaUpload[i].Split('|')[0]; visaList.Add(visaModel); } } if (visaUpload.Length > 0) { if (visaList == null) { visaList = new List <EyouSoft.Model.ComStructure.MComAttach>(); } for (int i = 0; i < visaUpload.Length; i++) { if (visaUpload[i].Trim() != "") { if (visaUpload[i].Split('|').Length > 1) { EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); visaModel.FilePath = visaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.线路签证资料; visaModel.Name = visaUpload[i].Split('|')[0]; visaList.Add(visaModel); } } } } ModelRoute.VisaInfoList = visaList; #endregion //对外报价 ModelRoute.PlanModelList = UtilsCommons.GetPlanList();//行程安排 #region 线路服务赋值 string costCalculation = string.Empty; EyouSoft.Model.TourStructure.MTourService tourService = UtilsCommons.GetTourService(out costCalculation); ModelRoute.ServicesModel = tourService; #endregion ModelRoute.AdultPrice = Utils.GetDecimal(AdultPrice); ModelRoute.AreaId = Utils.GetInt(AreaID); ModelRoute.ChildrenPrice = Utils.GetDecimal(ChildPrice); ModelRoute.OtherPrice = Utils.GetDecimal(OtherPrice); ModelRoute.CompanyId = this.SiteUserInfo.CompanyId; ModelRoute.Days = Utils.GetInt(DayCount); ModelRoute.DepartureTraffic = StartTraffic; ModelRoute.ReturnTraffic = EndTraffic; ModelRoute.SetMode = Collection; ModelRoute.LineIntro = PathDesc; ModelRoute.RouteName = PathName; ModelRoute.PathRemark = StrRemark; ModelRoute.OperatorId = this.SiteUserInfo.UserId; ModelRoute.DeptId = this.SiteUserInfo.DeptId; ModelRoute.IsShare = true; if (radno.Checked) { ModelRoute.IsShare = false; } ModelRoute.IssueTime = DateTime.Now; #region 对外报价赋值 ForeignQuote1.IsFromTourOrRoute = false; Dictionary <string, object> Standarlist = UtilsCommons.GetServiceType(); bool IsTourOrSubentry = (bool)Standarlist["IsTourOrSubentry"]; ModelRoute.IsTourOrSubentry = IsTourOrSubentry; ModelRoute.StandardModelList = new List <EyouSoft.Model.SourceStructure.MRouteStandard>(); if (IsTourOrSubentry) { ModelRoute.Service = Standarlist["Service"].ToString(); } else { ModelRoute.StandardModelList = (IList <EyouSoft.Model.SourceStructure.MRouteStandard>)Standarlist["Service"]; } #endregion ModelRoute.TotalPrice = Utils.GetDecimal(TotalPrice); int result = 0; if (t) { //返回值 -1:已经存在相同的线路名称 -2;同一个行程已经存在相同的景点 -3:已经存在相同的附件名称 -4:公司编号未赋值 -5:线路必填信息不完善 0:事务回滚 1:正确 result = bll.AddRouteModel(ModelRoute); } else { result = bll.UpdateRouteModel(ModelRoute); } msg = GetResult(result, t ? "新增" : "修改"); return(msg); }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected string PageSave(string doType, string id) { string msg = string.Empty; if (String.IsNullOrEmpty(Utils.GetFormValue(txtteamName.UniqueID))) { msg = "{\"result\":\"0\",\"msg\":\"车队名称不能为空!\"}"; return(msg); } //t为false为编辑,true时为新增 bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true; EyouSoft.BLL.SourceStructure.BSource Bll = new EyouSoft.BLL.SourceStructure.BSource(); MSourceMotorcade model = new MSourceMotorcade(); EyouSoft.Model.SourceStructure.MSource mModel = new EyouSoft.Model.SourceStructure.MSource(); IList <EyouSoft.Model.SourceStructure.MSourceCar> carlist = GetDataList(); if (!string.IsNullOrEmpty(Utils.GetQueryStringValue("id"))) { model = new EyouSoft.BLL.SourceStructure.BSource().GetMotorcadeModel(Utils.GetQueryStringValue("id")); } //合同附件(新) string[] visaUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldVisaUpload = Utils.GetFormValues("hideFileInfo"); #region 合同附件 EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); if (oldVisaUpload.Length > 0) { for (int i = 0; i < oldVisaUpload.Length; i++) { visaModel.FilePath = oldVisaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = oldVisaUpload[i].Split('|')[0]; visaModel.Size = 0; } } if (visaUpload.Length > 0) { for (int i = 0; i < visaUpload.Length; i++) { if (visaUpload[i].Trim() != "") { if (visaUpload[i].Split('|').Length > 1) { visaModel.Downloads = 0; visaModel.FilePath = visaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = visaUpload[i].Split('|')[0]; visaModel.Size = 0; } } } } #endregion mModel.ContractAttach = visaModel; mModel.Name = Utils.GetFormValue(txtteamName.UniqueID).Trim(); mModel.Remark = Utils.GetFormValue(txtRemark.UniqueID); mModel.Address = Utils.GetFormValue(this.address.UniqueID); model.SourceModel = mModel; model.SourceModel.CountryId = Utils.GetInt(Utils.GetFormValue(this.ddlCountry.UniqueID)); model.SourceModel.ProvinceId = Utils.GetInt(Utils.GetFormValue(this.ddlProvice.UniqueID)); model.SourceModel.CityId = Utils.GetInt(Utils.GetFormValue(this.ddlCity.UniqueID)); model.SourceModel.CountyId = Utils.GetInt(Utils.GetFormValue(this.ddlArea.UniqueID)); model.SourceModel.LastModifierId = this.SiteUserInfo.Name; model.SourceModel.LastModifyTime = DateTime.Now; model.SourceModel.ContractPeriodStart = EyouSoft.Common.Utils.GetDateTimeNullable(Utils.GetFormValue(txtContractDate_Start.UniqueID)); model.SourceModel.ContractPeriodEnd = EyouSoft.Common.Utils.GetDateTimeNullable(Utils.GetFormValue(txtContractDate.UniqueID)); //获取车辆信息 model.CarList = carlist; //获取联系人信息 model.LinkManList = UtilsCommons.GetDataList(); model.SourceModel.CompanyId = this.SiteUserInfo.CompanyId; model.SourceModel.IssueTime = DateTime.Now; if (!String.IsNullOrEmpty(id)) { model.SourceModel.SourceId = id; } //是否返佣 model.SourceModel.IsCommission = false; if (this.RadioButton1.Checked) { model.SourceModel.IsCommission = true; } //是否签单 model.SourceModel.IsPermission = false; if (this.radyes.Checked) { model.SourceModel.IsPermission = true; } //是否推荐 model.SourceModel.IsRecommend = false; if (radRecommendyes.Checked) { model.SourceModel.IsRecommend = true; } //是否签订合同 model.SourceModel.IsSignContract = false; if (Radio_hd_yes.Checked) { model.SourceModel.IsSignContract = true; model.SourceModel.ContractCode = Utils.GetFormValue(this.txtContractNum.UniqueID); } model.SourceModel.OperatorId = this.SiteUserInfo.UserId; int result = 0; if (t) {//新增 result = Bll.AddMotorcadeModel(model); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"车辆名已存在!\"}"; return(msg); } } else { //编辑 result = Bll.UpdateMotorcadeModel(model); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"车辆名已存在!\"}"; return(msg); } } string type = t ? "新增" : "修改"; if (result > 0) { msg = "{\"result\":\"1\",\"msg\":\"" + type + "成功!\"}"; return(msg); } else { msg = "{\"result\":\"0\",\"msg\":\"" + type + "失败!\"}"; return(msg); } }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected string PageSave(string doType, string id) { #region 获取表单值 string msg = string.Empty; //t为false为编辑,true时为新增 bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true; //国家 string country = Utils.GetFormValue(this.ddlCountry.UniqueID); //省份 string provice = Utils.GetFormValue(this.ddlProvice.UniqueID); //城市 string city = Utils.GetFormValue(this.ddlCity.UniqueID); //县区 string area = Utils.GetFormValue(this.ddlArea.UniqueID); //政策 string Policy = Utils.GetFormValue(this.txtPolicy.UniqueID); //合同开始时间 string ContractStartDate = Utils.GetFormValue(this.txtContractDate_Start.UniqueID); //合同有到期时间 string ContractDate = Utils.GetFormValue(this.txtContractDate.UniqueID); //景点名称 string scenicName = Utils.GetFormValue(this.txtUnitName.UniqueID); //合同号 string ContractNum = Utils.GetFormValue(this.txtContractNum.UniqueID); if (String.IsNullOrEmpty(scenicName)) { msg = UtilsCommons.AjaxReturnJson("0", "单位名称不能为空"); return(msg); } #endregion //景点图片 string[] imgUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldimgUpload = Utils.GetFormValues("hideimg"); #region 景点图片上传 IList <EyouSoft.Model.ComStructure.MComAttach> imglist = null; if (imgUpload.Length > 0) { imglist = new List <EyouSoft.Model.ComStructure.MComAttach>(); for (int i = 0; i < imgUpload.Length; i++) { if (imgUpload[i].Trim() != "") { if (imgUpload[i].Split('|').Length > 1) { EyouSoft.Model.ComStructure.MComAttach imgModel = new EyouSoft.Model.ComStructure.MComAttach(); imgModel.Downloads = 0; imgModel.FilePath = imgUpload[i].Split('|')[1]; imgModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商; imgModel.Name = imgUpload[i].Split('|')[0]; imgModel.Size = 0; imglist.Add(imgModel); } } } } if (oldimgUpload.Length > 0) { if (imglist == null) { imglist = new List <EyouSoft.Model.ComStructure.MComAttach>(); } for (int i = 0; i < oldimgUpload.Length; i++) { if (oldimgUpload[i].Trim() != "") { EyouSoft.Model.ComStructure.MComAttach imgModel = new EyouSoft.Model.ComStructure.MComAttach(); imgModel.FilePath = oldimgUpload[i].Split('|')[1]; imgModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商; imgModel.Name = oldimgUpload[i].Split('|')[0]; imgModel.Size = 0; imglist.Add(imgModel); } } } #endregion //合同附件 //合同附件(新) string[] visaUpload = Utils.GetFormValues(this.UploadControl2.ClientHideID); string[] oldVisaUpload = Utils.GetFormValues("hideFileInfo"); #region 合同附件 EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); if (visaUpload.Length > 0) { for (int i = 0; i < visaUpload.Length; i++) { if (visaUpload[i].Trim() != "") { if (visaUpload[i].Split('|').Length > 1) { visaModel.Downloads = 0; visaModel.FilePath = visaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = visaUpload[i].Split('|')[0]; visaModel.Size = 0; } } } } if (oldVisaUpload.Length > 0) { for (int i = 0; i < oldVisaUpload.Length; i++) { visaModel.FilePath = oldVisaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = oldVisaUpload[i].Split('|')[0]; visaModel.Size = 0; } } #endregion #region 景区实体赋值 EyouSoft.Model.SourceStructure.MSourceSpot Model = new EyouSoft.Model.SourceStructure.MSourceSpot(); EyouSoft.Model.SourceStructure.MSource source = new EyouSoft.Model.SourceStructure.MSource(); if (!string.IsNullOrEmpty(id)) { //Model = new EyouSoft.BLL.SourceStructure.BSource().GetSpotModel(id); source.SourceId = id; } Model.AttachList = imglist; source.ContractAttach = visaModel; source.CountryId = Utils.GetInt(country); source.CityId = Utils.GetInt(city); source.ProvinceId = Utils.GetInt(provice); source.CountyId = Utils.GetInt(area); source.UnitPolicy = Policy; source.OperatorId = this.SiteUserInfo.UserId; source.DeptId = this.SiteUserInfo.DeptId; source.IssueTime = DateTime.Now; source.CompanyId = this.SiteUserInfo.CompanyId; //返佣 source.IsCommission = false; if (radyes.Checked) { source.IsCommission = true; } //返单 source.IsBackSingle = false; if (radBackSingleyes.Checked) { source.IsBackSingle = true; } //签单 source.IsPermission = false; if (RadSign_yes.Checked) { source.IsPermission = true; } //推荐 source.IsRecommend = false; if (RadRecommend_yes.Checked) { source.IsRecommend = true; } //合同 source.IsSignContract = false; if (Radio_hd_yes.Checked) { source.IsSignContract = true; source.ContractCode = ContractNum; } source.Name = scenicName.Trim(); source.ContractPeriodEnd = string.IsNullOrEmpty(ContractDate) ? null : (DateTime?)DateTime.Parse(ContractDate); source.ContractPeriodStart = string.IsNullOrEmpty(ContractStartDate) ? null : (DateTime?)DateTime.Parse(ContractStartDate); source.LastModifierId = this.SiteUserInfo.Name; source.LastModifyTime = DateTime.Now; //Model.Star = (EyouSoft.Model.EnumType.SourceStructure.SpotStar)int.Parse(ddlstar.SelectedValue); Model.SourceModel = source; Model.LinkManList = UtilsCommons.GetDataList(); Model.PriceSystemList = GetSpotList(); #endregion #region 执行保存(新增,修改)操作,并返回结果 EyouSoft.BLL.SourceStructure.BSource bllsource = new EyouSoft.BLL.SourceStructure.BSource(); int result = 0; if (t) {//新增 result = bllsource.AddSpotModel(Model); if (result == -1) { msg = UtilsCommons.AjaxReturnJson("0", "景点名称已存在"); return(msg); } if (result == -2) { msg = UtilsCommons.AjaxReturnJson("0", "该附件已存在"); return(msg); } } else { //编辑 result = bllsource.UpdateSpotModel(Model); if (result == -1) { msg = UtilsCommons.AjaxReturnJson("0", "景点名称已存在"); return(msg); } if (result == -2) { msg = UtilsCommons.AjaxReturnJson("0", "该附件已存在"); return(msg); } } string type = t ? "新增" : "修改"; if (result > 0) { msg = UtilsCommons.AjaxReturnJson("1", type + "成功"); return(msg); } else { msg = UtilsCommons.AjaxReturnJson("0", type + "失败"); return(msg); } #endregion }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected string PageSave() { string msg = string.Empty; #region 获取表单 //线路区域编号 int areaID = Utils.GetInt(Utils.GetFormValue("sltArea")); //线路编号 string routeID = Utils.GetFormValue(this.hideRouteID.UniqueID); //线路名称 string routeName = Utils.GetFormValue(this.txt_RouteName.UniqueID); //天数 int days = Utils.GetInt(Utils.GetFormValue(this.txt_Days.UniqueID)); //销售员编号 string sellsID = Utils.GetFormValue(this.SellsSelect1.SellsIDClient); //销售员名称 string sellsName = Utils.GetFormValue(this.SellsSelect1.SellsNameClient); //报价员 取当前登录用户 EyouSoft.Model.TourStructure.MOperatorInfo operatorModel = new EyouSoft.Model.TourStructure.MOperatorInfo(); operatorModel.OperatorId = this.SiteUserInfo.UserId; operatorModel.Name = this.SiteUserInfo.Name; operatorModel.Phone = this.SiteUserInfo.Telephone; //出发交通 string successsStraffBegin = Utils.GetFormValue(this.txtSuccesssStraffBegin.UniqueID); //返回交通 string successsStraffEnd = Utils.GetFormValue(this.txtSuccesssStraffEnd.UniqueID); //集合方式 string successGather = Utils.GetFormValue(this.txtSuccessGather.UniqueID); //出团时间 string[] successDateBegin = Utils.GetFormValue(this.hideLeaveDate.UniqueID).Split(','); //预控人数 int planPeopleNumber = Utils.GetInt(Utils.GetFormValue(this.txtPeopleCount.UniqueID)); //行程特色 string planContent = Utils.EditInputText(Request.Form[this.txtPlanContent.UniqueID]); //停收时间 int stopDate = Utils.GetIntSign(Utils.GetFormValue(this.txtStopDate.UniqueID)); //是否同业分销 bool isShowDistribution = Utils.GetFormValue(this.cbxDistribution.UniqueID) == "on" ? true : false; //变更标题 string changeTitle = Utils.GetFormValue("txt_ChangeTitle"); //变更备注 string changeRemark = Utils.GetFormValue("txt_ChangeRemark"); //附件 string filsPath = Utils.GetFormValue(this.UploadControl2.ClientHideID); if (filsPath == "") { filsPath = Utils.GetFormValue("hideOtherFile"); } //签证附件(新) string[] visaUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldVisaUpload = Utils.GetFormValues("hideVisaFile"); //关键字 string searchKey = Utils.GetFormValue(this.txtSearchKey.UniqueID); #endregion #region 表单后台验证 if (areaID == 0) { msg = "请选择线路区域!"; } if (routeName == "") { msg += "<br />请输入线路名称!"; } if (days == 0) { msg += "<br />请输入天数!"; } if (planPeopleNumber == 0) { msg += "<br />请输入预控人数!"; } if (sellsID == "") { msg += "<br />请输入销售员!"; } if (successDateBegin.Length == 0) { msg += "<br />请选择出团日期!"; } if (msg != "") { return(UtilsCommons.AjaxReturnJson("0", msg)); } #endregion EyouSoft.BLL.TourStructure.BTour bll = new EyouSoft.BLL.TourStructure.BTour(); EyouSoft.Model.TourStructure.MTourSanPinInfo model = new EyouSoft.Model.TourStructure.MTourSanPinInfo(); string act = Utils.GetQueryStringValue("act"); if (act == "update") { model.TourId = Utils.GetQueryStringValue("id"); } model.CompanyId = this.SiteUserInfo.CompanyId; model.AreaId = areaID; string costCalculation = string.Empty; EyouSoft.Model.TourStructure.MTourService tourService = UtilsCommons.GetTourService(out costCalculation); model.CostCalculation = costCalculation; model.Gather = successGather; model.PlanPeopleNumber = planPeopleNumber; model.LTraffic = successsStraffBegin; model.OperatorInfo = new EyouSoft.Model.TourStructure.MOperatorInfo(); model.OperatorInfo.OperatorId = this.SiteUserInfo.UserId; model.OperatorInfo.Name = this.SiteUserInfo.Name; model.OperatorInfo.Phone = this.SiteUserInfo.Telephone; model.PlanFeature = planContent; model.RouteId = routeID; model.RouteName = routeName; model.RTraffic = successsStraffEnd; model.StopDays = stopDate; model.IsShowDistribution = isShowDistribution; model.TourChangeTitle = changeTitle; model.TourChangeContent = changeRemark; model.KeyName = searchKey; #region 附件 if (filsPath != "") { string[] filesArray = filsPath.Split('|'); if (filesArray.Length > 1) { model.FilePath = filesArray[1]; } } #endregion #region 签证附件 IList <EyouSoft.Model.ComStructure.MComAttach> visaList = null; if (visaUpload.Length > 0) { visaList = new List <EyouSoft.Model.ComStructure.MComAttach>(); for (int i = 0; i < visaUpload.Length; i++) { if (visaUpload[i].Trim() != "") { if (visaUpload[i].Split('|').Length > 1) { EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); visaModel.Downloads = 0; visaModel.FilePath = visaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.计划签证资料; visaModel.Name = visaUpload[i].Split('|')[0]; visaModel.Size = 0; visaList.Add(visaModel); } } } } if (oldVisaUpload.Length > 0) { if (visaList == null) { visaList = new List <EyouSoft.Model.ComStructure.MComAttach>(); } for (int i = 0; i < oldVisaUpload.Length; i++) { EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); visaModel.Downloads = Utils.GetInt(oldVisaUpload[i].Split('|')[2]); visaModel.FilePath = oldVisaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.计划签证资料; visaModel.Name = oldVisaUpload[i].Split('|')[0]; visaModel.Size = 0; visaList.Add(visaModel); } } model.VisaFileList = visaList; #endregion //获得销售员信息实体 EyouSoft.Model.ComStructure.MComUser sellsModel = new EyouSoft.BLL.ComStructure.BComUser().GetModel(sellsID, SiteUserInfo.CompanyId); if (sellsModel != null) { model.SaleInfo = new EyouSoft.Model.TourStructure.MSaleInfo(); model.SaleInfo.SellerId = sellsID; model.SaleInfo.Name = sellsName; model.SaleInfo.Phone = sellsModel.ContactMobile; model.SaleInfo.DeptId = sellsModel.DeptId; } model.TourDays = days; model.TourPlan = UtilsCommons.GetPlanList(); model.TourService = tourService; model.MTourPriceStandard = UtilsCommons.GetPriceStandard(); model.LDate = null; model.RDate = null; #region 无需赋值 //model.QuoteRemark //model.RealPeopleNumber //model.Review //model.ReviewTime //model.TourPlaner //model.TourPlanItem //model.TourPlanStatus //model.PeopleNumberLast //model.GuideList = null; //model.IsChange = false; //model.IsReview //model.IsSubmit //model.IsSure 列表 //model.LeavePeopleNumber #endregion //超限赋值 switch (type) { case 1: model.TourType = EyouSoft.Model.EnumType.TourStructure.TourType.组团散拼; break; case 2: model.TourType = EyouSoft.Model.EnumType.TourStructure.TourType.地接散拼; break; case 3: model.TourType = EyouSoft.Model.EnumType.TourStructure.TourType.出境散拼; break; } if (act == "add" || act == "copy") { bool result = false; model.TourStatus = EyouSoft.Model.EnumType.TourStructure.TourStatus.销售未派计划; model.TourChildrenInfo = new List <MTourChildrenInfo>(); for (int i = 0; i < successDateBegin.Length; i++) { MTourChildrenInfo childModel = new MTourChildrenInfo(); childModel.LDate = Utils.GetDateTime(successDateBegin[i]); model.TourChildrenInfo.Add(childModel); } result = bll.AddTourSanPin(model); if (result) { msg = UtilsCommons.AjaxReturnJson("1", "新增散拼计划 成功,正在跳转"); } else { msg = UtilsCommons.AjaxReturnJson("0", "新增散拼计划 失败,请稍后再试!"); } } if (act == "update" && model.TourId != "") { model.UpdateTime = DateTime.Now; model.LDate = Utils.GetDateTime(successDateBegin[0]); if (bll.UpdateTourSanPin(model)) { msg = UtilsCommons.AjaxReturnJson("1", "修改散拼计划 成功,正在跳转.."); } else { msg = UtilsCommons.AjaxReturnJson("0", "修改散拼计划 失败,请稍后再试!"); } } return(msg); }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> private string PageSave(string doType, string id) { string msg = string.Empty; //t为false为编辑,true时为新增 bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true; //国家 #region 表单取值 string country = Utils.GetFormValue(this.ddlCountry.UniqueID); //省份 string provice = Utils.GetFormValue(this.ddlProvice.UniqueID); //城市 string city = Utils.GetFormValue(this.ddlCity.UniqueID); //县区 string area = Utils.GetFormValue(this.ddlArea.UniqueID); //地址 string address = Utils.GetFormValue(this.txtaddress.UniqueID); //单位名称 string UnitName = Utils.GetFormValue(this.txtUnitName.UniqueID); //线路特色 string Character = Utils.GetFormValue(this.txtCharacter.UniqueID); //合同开始时间 string ContractStartDate = Utils.GetFormValue(this.txtContractDate_Start.UniqueID); //合同有到期时间 string ContractDate = Utils.GetFormValue(this.txtContractDate.UniqueID); //合同号 string ContractNum = Utils.GetFormValue(this.txtContractNum.UniqueID); //法人代表 string LegalName = Utils.GetFormValue(this.txtLegalName.UniqueID); //许可证号 string PermitNum = Utils.GetFormValue(this.txtPermitNum.UniqueID); //返佣政策 string Policy = Utils.GetFormValue(this.txtpolicy.UniqueID); //联系电话 string Tel = Utils.GetFormValue(this.txtTel.UniqueID); //合同附件(新) string[] visaUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldVisaUpload = Utils.GetFormValues("hideFileInfo"); #endregion EyouSoft.Model.CrmStructure.MCrmLinkman m = new EyouSoft.Model.CrmStructure.MCrmLinkman(); MComUser mUser = new MComUser(); IList <EyouSoft.Model.CrmStructure.MCrmLinkman> list = UtilsCommons.GetDataList(); if (list != null && list.Count > 0) { mUser.ContactMobile = list[0].MobilePhone; mUser.ContactName = list[0].Name; mUser.ContactTel = list[0].Telephone; mUser.QQ = list[0].QQ; m.Post = list[0].Post; } if (string.IsNullOrEmpty(UnitName)) { msg = "{\"result\":\"0\",\"msg\":\"单位名称不能为空!\"}"; return(msg); } EyouSoft.Model.SourceStructure.MSourceTravel mTravel = new EyouSoft.Model.SourceStructure.MSourceTravel(); if (!string.IsNullOrEmpty(id)) { mTravel = new EyouSoft.BLL.SourceStructure.BSource().GetTravelServiceModel(id); } EyouSoft.Model.SourceStructure.MSource mModel = new EyouSoft.Model.SourceStructure.MSource(); mModel.Address = this.txtaddress.Text; mModel.CityId = Utils.GetInt(Utils.GetFormValue(this.ddlCity.UniqueID)); mModel.CountryId = Utils.GetInt(Utils.GetFormValue(this.ddlCountry.UniqueID)); mModel.CountyId = Utils.GetInt(Utils.GetFormValue(this.ddlArea.UniqueID)); mModel.ProvinceId = Utils.GetInt(Utils.GetFormValue(this.ddlProvice.UniqueID)); mModel.Name = Utils.GetFormValue(this.txtUnitName.UniqueID).Trim(); mModel.CompanyId = this.SiteUserInfo.CompanyId; mModel.OperatorId = this.SiteUserInfo.UserId; mModel.ContractCode = ContractNum; mModel.DeptId = this.SiteUserInfo.DeptId; mModel.ContractPeriodStart = String.IsNullOrEmpty(ContractStartDate) ? null : (DateTime?)DateTime.Parse(ContractStartDate); mModel.ContractPeriodEnd = String.IsNullOrEmpty(ContractDate) ? null : (DateTime?)DateTime.Parse(ContractDate); //签单 if (RadSign_no.Checked) { mModel.IsPermission = false; } else { mModel.IsPermission = true; } //推荐 if (RadRecommend_no.Checked) { mModel.IsRecommend = false; } else { mModel.IsRecommend = true; } //返佣 mModel.IsCommission = true; if (radno.Checked) { mModel.IsCommission = false; } //合同 if (Radio_hd_no.Checked) { mModel.IsSignContract = false; } else { mModel.IsSignContract = true; mModel.ContractCode = Utils.GetFormValue(this.txtContractNum.UniqueID); } mModel.LastModifierId = this.SiteUserInfo.Name; mModel.LastModifyTime = DateTime.Now; mModel.LicenseKey = PermitNum; mModel.UnitPolicy = Policy; mModel.Desc = Character; mModel.IssueTime = DateTime.Now; if (!String.IsNullOrEmpty(id)) { mModel.SourceId = id; } #region 合同附件 EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); if (oldVisaUpload.Length > 0) { for (int i = 0; i < oldVisaUpload.Length; i++) { visaModel.FilePath = oldVisaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = oldVisaUpload[i].Split('|')[0]; visaModel.Size = 0; } } if (visaUpload.Length > 0) { for (int i = 0; i < visaUpload.Length; i++) { if (visaUpload[i].Trim() != "") { if (visaUpload[i].Split('|').Length > 1) { visaModel.Downloads = 0; visaModel.FilePath = visaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = visaUpload[i].Split('|')[0]; visaModel.Size = 0; } } } } mModel.ContractAttach = visaModel; #endregion mUser.CompanyId = this.SiteUserInfo.CompanyId; //mUser.IsEnable = true; mUser.IssueTime = DateTime.Now; mUser.UserType = EyouSoft.Model.EnumType.ComStructure.UserType.供应商; MSourceTravelInfo Traveinfo = new MSourceTravelInfo(); Traveinfo.LegalRepresentative = LegalName; Traveinfo.Routes = Character; Traveinfo.Telephone = Tel; mTravel.SourceTravelModel = Traveinfo; //mTravel.UserModel = mUser; mTravel.SourceModel = mModel; mTravel.LinkManList = list; //mTravel.SourceTravelModel EyouSoft.BLL.SourceStructure.BSource bllsource = new EyouSoft.BLL.SourceStructure.BSource(); EyouSoft.BLL.ComStructure.BComUser blluser = new EyouSoft.BLL.ComStructure.BComUser(); int result = 0; if (t) {//新增 result = bllsource.AddTravelServiceModel(mTravel); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"单位名称已存在!\"}"; return(msg); } } else { //编辑 result = bllsource.UpdateTravelServiceModel(mTravel); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"单位名称已存在!\"}"; return(msg); } } string type = t ? "新增" : "修改"; if (result > 0) { msg = "{\"result\":\"1\",\"msg\":\"" + type + "成功!\"}"; return(msg); } else { msg = "{\"result\":\"0\",\"msg\":\"" + type + "失败!\"}"; return(msg); } }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected string PageSave(string doType, string id) { string msg = string.Empty; EyouSoft.BLL.SourceStructure.BSource Bll = new EyouSoft.BLL.SourceStructure.BSource(); EyouSoft.Model.SourceStructure.MSourceHotel modelHotel = new EyouSoft.Model.SourceStructure.MSourceHotel(); EyouSoft.Model.SourceStructure.MSource Msource = new EyouSoft.Model.SourceStructure.MSource(); modelHotel.SourceModel = new EyouSoft.Model.SourceStructure.MSource(); //t为false为编辑,true时为新增 bool t = String.Equals(doType, "update", StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrEmpty(id) ? false : true; if (!string.IsNullOrEmpty(id)) { modelHotel = new EyouSoft.BLL.SourceStructure.BSource().GetOneHotelModel(id); } //酒店图片 string[] imgUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldimgUpload = Utils.GetFormValues("hideimg"); #region 酒店图片上传 IList <EyouSoft.Model.ComStructure.MComAttach> imglist = null; if (imgUpload.Length > 0) { imglist = new List <EyouSoft.Model.ComStructure.MComAttach>(); for (int i = 0; i < imgUpload.Length; i++) { if (imgUpload[i].Trim() != "") { if (imgUpload[i].Split('|').Length > 1) { EyouSoft.Model.ComStructure.MComAttach imgModel = new EyouSoft.Model.ComStructure.MComAttach(); imgModel.Downloads = 0; imgModel.FilePath = imgUpload[i].Split('|')[1]; imgModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商; imgModel.Name = imgUpload[i].Split('|')[0]; imgModel.Size = 0; imglist.Add(imgModel); } } } } if (oldimgUpload.Length > 0) { if (imglist == null) { imglist = new List <EyouSoft.Model.ComStructure.MComAttach>(); } for (int i = 0; i < oldimgUpload.Length; i++) { if (oldimgUpload[i].Trim() != "") { EyouSoft.Model.ComStructure.MComAttach imgModel = new EyouSoft.Model.ComStructure.MComAttach(); imgModel.FilePath = oldimgUpload[i].Split('|')[1]; imgModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商; imgModel.Name = oldimgUpload[i].Split('|')[0]; imgModel.Size = 0; imglist.Add(imgModel); } } } modelHotel.AttachList = imglist; #endregion //合同附件 //合同附件(新) string[] visaUpload = Utils.GetFormValues(this.UploadControl2.ClientHideID); string[] oldVisaUpload = Utils.GetFormValues("hideFileInfo"); #region 合同附件 EyouSoft.Model.ComStructure.MComAttach visaModel = new EyouSoft.Model.ComStructure.MComAttach(); if (oldVisaUpload.Length > 0) { for (int i = 0; i < oldVisaUpload.Length; i++) { visaModel.FilePath = oldVisaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = oldVisaUpload[i].Split('|')[0]; visaModel.Size = 0; } } if (visaUpload.Length > 0) { for (int i = 0; i < visaUpload.Length; i++) { if (visaUpload[i].Trim() != "") { if (visaUpload[i].Split('|').Length > 1) { visaModel.Downloads = 0; visaModel.FilePath = visaUpload[i].Split('|')[1]; visaModel.ItemType = EyouSoft.Model.EnumType.ComStructure.AttachItemType.供应商合同附件; visaModel.Name = visaUpload[i].Split('|')[0]; visaModel.Size = 0; } } } } Msource.ContractAttach = visaModel; #endregion //if (!String.IsNullOrEmpty(newFilePath)) //{ // modelHotel.SourceModel.ContractAttach = new MComAttach() { FilePath = newFilePath, Name = newFileName }; //} //else //{ // if (String.IsNullOrEmpty(this.Agreement.Value)) // { // modelHotel.SourceModel.ContractAttach = new MComAttach() { FilePath = "", Name = "" }; // } //} Msource.ContractPeriodStart = String.IsNullOrEmpty(Utils.GetFormValue(this.txtContractDate_Start.UniqueID)) ? null : (DateTime?)DateTime.Parse(Utils.GetFormValue(this.txtContractDate_Start.UniqueID)); Msource.ContractPeriodEnd = String.IsNullOrEmpty(Utils.GetFormValue(this.txtContractDate.UniqueID)) ? null : (DateTime?)DateTime.Parse(Utils.GetFormValue(this.txtContractDate.UniqueID)); modelHotel.ReceptionTel = Utils.GetFormValue(txtTel.UniqueID); modelHotel.AttachList = imglist; modelHotel.HotelRoomList = GetDataList(); modelHotel.LinkManList = UtilsCommons.GetDataList(); //是否签单 Msource.IsPermission = false; if (radyes.Checked) { Msource.IsPermission = true; } Msource.CompanyId = this.SiteUserInfo.CompanyId; Msource.IssueTime = DateTime.Now; //是否返佣 Msource.IsCommission = false; if (RadioButton1.Checked) { Msource.IsCommission = true; } //是否推荐 Msource.IsRecommend = false; if (radRecommendyes.Checked) { Msource.IsRecommend = true; } //是否签订合同 Msource.IsSignContract = false; if (Radio_hd_yes.Checked) { Msource.IsSignContract = true; Msource.ContractCode = Utils.GetFormValue(this.txtContractNum.UniqueID); } Msource.LastModifierId = this.SiteUserInfo.Name; Msource.LastModifyTime = DateTime.Now; Msource.Address = Utils.GetFormValue(this.txtaddress.UniqueID); Msource.Desc = txtHotelDesc.Text; Msource.CountryId = Utils.GetInt(Utils.GetFormValue(this.ddlCountry.UniqueID)); Msource.ProvinceId = Utils.GetInt(Utils.GetFormValue(this.ddlProvice.UniqueID)); Msource.CityId = Utils.GetInt(Utils.GetFormValue(this.ddlCity.UniqueID)); Msource.CountyId = Utils.GetInt(Utils.GetFormValue(this.ddlArea.UniqueID)); Msource.Name = Utils.GetFormValue(txtHotelName.UniqueID).Trim(); Msource.Remark = Utils.GetFormValue(txtRemarks.UniqueID); Msource.OperatorId = this.SiteUserInfo.UserId; modelHotel.Star = (EyouSoft.Model.EnumType.SourceStructure.HotelStar)Utils.GetInt(Utils.GetFormValue(this.StarValue.UniqueID)); if (!String.IsNullOrEmpty(id)) { modelHotel.SourceId = id; } modelHotel.SourceModel = Msource; int result = 0; if (t) {//新增 result = Bll.AddHotelModel(modelHotel); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"酒店名称已存在!\"}"; return(msg); } if (result == -2) { msg = "{\"result\":\"0\",\"msg\":\"该酒店已经存在相同的酒店房型!\"}"; return(msg); } if (result == -3) { msg = "{\"result\":\"0\",\"msg\":\"已经存在相同的附件!\"}"; return(msg); } } else { //编辑 result = Bll.UpdateHotelModel(modelHotel); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"酒店名称已存在!\"}"; return(msg); } if (result == -2) { msg = "{\"result\":\"0\",\"msg\":\"该酒店已经存在相同的酒店房型!\"}"; return(msg); } if (result == -3) { msg = "{\"result\":\"0\",\"msg\":\"已经存在相同的附件!\"}"; return(msg); } } string type = t ? "新增" : "修改"; if (result > 0) { msg = "{\"result\":\"1\",\"msg\":\"" + type + "成功!\"}"; return(msg); } else { msg = "{\"result\":\"0\",\"msg\":\"" + type + "失败!\"}"; return(msg); } }