/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected 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; //餐馆简介 string Hotleinfo = Utils.GetFormValue(this.txthotleinfo.UniqueID); //国家 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 cuisineid = Utils.GetFormValue(this.CuisineSelect1.CuisineSelectIDClient); //餐馆名称 string HotleName = Utils.GetFormValue(this.txtHotleName.UniqueID).Trim(); //备注 string remarks = Utils.GetFormValue(this.txtRemarks.UniqueID); //餐标最大价格 string Pmax = Utils.GetFormValue(this.txtPmax.UniqueID); //餐标最小价格 string Pmin = Utils.GetFormValue(this.txtPmin.UniqueID); //合同开始时间 string StartTime = Utils.GetFormValue(this.txtContractDate_Start.UniqueID); //合同终止时间 string EndTime = Utils.GetFormValue(this.txtContractDate.UniqueID); if (String.IsNullOrEmpty(HotleName)) { return(EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", "请填写餐馆名称!")); } if (string.IsNullOrEmpty(cuisineid)) { return(EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", "请选择菜系!")); } EyouSoft.Model.SourceStructure.MSourceDining mDining = new EyouSoft.Model.SourceStructure.MSourceDining(); EyouSoft.Model.SourceStructure.MSource msource = new EyouSoft.Model.SourceStructure.MSource(); if (!string.IsNullOrEmpty(id)) { mDining = new EyouSoft.BLL.SourceStructure.BSource().GetDiningModel(id); } IList <EyouSoft.Model.SourceStructure.MSourceDiningCuisine> cuisine = new List <EyouSoft.Model.SourceStructure.MSourceDiningCuisine>(); for (int i = 0; i < cuisineid.Split(',').Length; i++) { cuisine.Add(new EyouSoft.Model.SourceStructure.MSourceDiningCuisine() { Cuisine = (EyouSoft.Model.EnumType.SourceStructure.SourceCuisine)(Utils.GetInt(cuisineid.Split(',')[i])) }); } mDining.DiningCuisineList = cuisine; if (!string.IsNullOrEmpty(Pmax + Pmin)) { mDining.DiningStandard = Pmin + "元-" + Pmax + "元"; } else { mDining.DiningStandard = ""; } mDining.LinkManList = Contact1.GetTravelList; if (!String.IsNullOrEmpty(id)) { mDining.SourceId = id; } msource.CompanyId = this.SiteUserInfo.CompanyId; msource.Address = address; msource.ProvinceId = Utils.GetInt(provice); msource.CityId = Utils.GetInt(city); msource.CountyId = Utils.GetInt(area); msource.CountryId = Utils.GetInt(country); msource.Desc = Hotleinfo; msource.Remark = remarks; msource.LastModifierId = this.SiteUserInfo.Name; msource.LastModifyTime = DateTime.Now; msource.ContractPeriodStart = Utils.GetDateTimeNullable(StartTime); msource.ContractPeriodEnd = Utils.GetDateTimeNullable(EndTime); msource.OperatorId = this.SiteUserInfo.UserId; msource.IssueTime = DateTime.Now; //合同附件(新) 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 msource.ContractAttach = visaModel; msource.IsCommission = true; //是否签单 msource.IsPermission = false; if (RadSign_yes.Checked) { msource.IsPermission = true; } //是否返佣 msource.IsCommission = false; if (radyes.Checked) { msource.IsCommission = true; } //是否推荐 msource.IsRecommend = false; if (RadRecommend_yes.Checked) { msource.IsRecommend = true; } //是否签订合同 msource.IsSignContract = false; if (Radio_hd_yes.Checked) { msource.IsSignContract = true; msource.ContractCode = Utils.GetFormValue(this.txtContractNum.UniqueID); } msource.Name = HotleName; mDining.SourceModel = msource; mDining.LinkManList = UtilsCommons.GetDataList(); EyouSoft.BLL.SourceStructure.BSource bllsource = new EyouSoft.BLL.SourceStructure.BSource(); int result = 0; if (t) {//新增 result = bllsource.AddDiningModel(mDining); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"餐馆名称已存在!\"}"; return(msg); } if (result == -2) { msg = "{\"result\":\"0\",\"msg\":\"餐馆已存在此菜系!\"}"; return(msg); } } else { //编辑 result = bllsource.UpdateDiningModel(mDining); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"餐馆名称已存在!\"}"; return(msg); } if (result == -2) { 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; //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 address = Utils.GetFormValue(this.txtaddress.UniqueID); //商店名称 string ShopName = Utils.GetFormValue(this.txtShopName.UniqueID).Trim(); //商品类别 string saleType = Utils.GetFormValue(this.txtSellType.UniqueID); //备注 string remarks = Utils.GetFormValue(this.txtRemarks.UniqueID); //返佣政策 string Policy = Utils.GetFormValue(this.txtPolicy.UniqueID); //合同开始时间 string ContractStartDate = Utils.GetFormValue(this.txtContractDate_Start.UniqueID); //合同有到期时间 string ContractDate = Utils.GetFormValue(this.txtContractDate.UniqueID); //合同号 string ContractNum = Utils.GetFormValue(this.txtContractNum.UniqueID); if (String.IsNullOrEmpty(ShopName)) { msg = EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", "商店名称不能为空"); return(msg); } //合作协议 string[] agrUpload = Utils.GetFormValues(this.UploadControl2.ClientHideID); string[] oldagrUpload = Utils.GetFormValues("hideagreement"); #region 合作协议上传 string agreement = string.Empty; if (oldagrUpload.Length > 0) { for (int i = 0; i < oldagrUpload.Length; i++) { agreement = oldagrUpload[i].Split('|')[1]; } } if (agrUpload.Length > 0) { for (int i = 0; i < agrUpload.Length; i++) { if (agrUpload[i].Trim() != "") { if (agrUpload[i].Split('|').Length > 1) { if (agrUpload[i].Length > 1) { agreement = agrUpload[i].Split('|')[1]; } } } } } #endregion //合同附件 //合同附件(新) 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 EyouSoft.BLL.SourceStructure.BSource bllsource = new EyouSoft.BLL.SourceStructure.BSource(); EyouSoft.Model.SourceStructure.MSourceShop Model = new EyouSoft.Model.SourceStructure.MSourceShop(); EyouSoft.Model.SourceStructure.MSource source = new EyouSoft.Model.SourceStructure.MSource(); source.CompanyId = this.SiteUserInfo.CompanyId; source.OperatorId = this.SiteUserInfo.UserId; source.DeptId = this.SiteUserInfo.DeptId; source.LastModifierId = this.SiteUserInfo.Name; source.Name = ShopName; source.UnitPolicy = Policy; Model.SellType = saleType; source.ContractPeriodEnd = string.IsNullOrEmpty(ContractDate) ? null : (DateTime?)DateTime.Parse(ContractDate); source.ContractPeriodStart = string.IsNullOrEmpty(ContractStartDate) ? null : (DateTime?)DateTime.Parse(ContractStartDate); source.LastModifyTime = DateTime.Now; source.IssueTime = DateTime.Now; source.Address = address; source.ContractAttach = visaModel; source.AgreementFile = agreement; if (!String.IsNullOrEmpty(id)) { source.SourceId = id; } //返佣 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.Remark = remarks; source.CountryId = Utils.GetInt(country); source.ProvinceId = Utils.GetInt(provice); source.CityId = Utils.GetInt(city); source.CountyId = Utils.GetInt(area); source.Name = ShopName; //商品类别未赋值 source.OperatorId = this.SiteUserInfo.UserId; Model.LinkManList = UtilsCommons.GetDataList(); Model.SourceModel = source; int result = 0; if (t) {//新增 result = bllsource.AddShopModel(Model); if (result == -1) { msg = EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", "商店名称已存在"); return(msg); } } else { //编辑 result = bllsource.UpdateShopModel(Model); if (result == -1) { msg = EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", "商店名称已存在"); return(msg); } } string type = t ? "新增" : "修改"; if (result > 0) { msg = EyouSoft.Common.UtilsCommons.AjaxReturnJson("1", type + "成功"); return(msg); } else { msg = EyouSoft.Common.UtilsCommons.AjaxReturnJson("0", type + "失败"); return(msg); } }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> void BaoCun() { string msg = string.Empty; EyouSoft.Model.SourceStructure.MSource source = new EyouSoft.Model.SourceStructure.MSource(); EyouSoft.BLL.SourceStructure.BSource bllsource = new EyouSoft.BLL.SourceStructure.BSource(); EyouSoft.BLL.TourStructure.BSingleService bll = new EyouSoft.BLL.TourStructure.BSingleService(); MSingleServiceExtend model = new MSingleServiceExtend(); if (!String.IsNullOrEmpty(DanXiangYeWuId)) { model = bll.GetSingleServiceExtendByTourId(DanXiangYeWuId); model.TourId = DanXiangYeWuId; } if (Utils.GetQueryStringValue("submitplan") == "submit") { model.TourStatus = EyouSoft.Model.EnumType.TourStructure.TourStatus.待终审; if (model.PlanBaseInfoList != null && model.PlanBaseInfoList.Count > 0) { for (int i = 0; i < model.PlanBaseInfoList.Count; i++) { model.PlanBaseInfoList[i].Status = EyouSoft.Model.EnumType.PlanStructure.PlanState.已落实; } } } else { //联系人 string ContactName = Utils.GetFormValue(this.txtContactName.UniqueID); //订单编号 //string ordercode = Utils.GetFormValue(this.txtOrdercode.UniqueID); //客户电话 string ContactTel = Utils.GetFormValue(this.txtContactTel.UniqueID); //客户单位 string CustomUnit = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHMC); //客户单位编号 string CustomUnitID = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHBH); //毛利 string Profit = Utils.GetFormValue(this.txtProfit.UniqueID); //总支出 string TotalEx = Utils.GetFormValue(this.txtTotalEx.UniqueID); //总收入 string TotalIn = Utils.GetFormValue(this.txtTotalIn.UniqueID); //人数 string AdultCount = Utils.GetFormValue(this.txtAdultCount.UniqueID); //操作状态 string opeateStatu = Utils.GetFormValue(this.ddlopeaterStatus.UniqueID); if (opeateStatu != "") { model.TourStatus = (EyouSoft.Model.EnumType.TourStructure.TourStatus)EyouSoft.Common.Utils.GetInt(opeateStatu); } else { RCWE(UtilsCommons.AjaxReturnJson("0", "无法修改已落实的数据!")); } #region 游客信息附件 string[] agrUpload = Utils.GetFormValues(this.UploadControl1.ClientHideID); string[] oldagrUpload = Utils.GetFormValues("hideagreement"); string agreement = string.Empty; if (oldagrUpload.Length > 0) { for (int i = 0; i < oldagrUpload.Length; i++) { agreement = oldagrUpload[i].Split('|')[1]; } } if (agrUpload.Length > 0) { for (int i = 0; i < agrUpload.Length; i++) { if (agrUpload[i].Trim() != "") { if (agrUpload[i].Split('|').Length > 1) { if (agrUpload[i].Length > 1) { agreement = agrUpload[i].Split('|')[1]; } } } } } #endregion model.TravellerFile = agreement; model.CompanyId = this.SiteUserInfo.CompanyId; model.ContactName = ContactName; model.ContactTel = ContactTel; model.ContactDepartId = Utils.GetFormValue(this.CustomerUnitSelect1.ClientNameKHBH); model.Operator = this.SiteUserInfo.Name; model.SellerName = Utils.GetFormValue(SellsSelect1.SellsNameClient); model.SellerId = Utils.GetFormValue(SellsSelect1.SellsIDClient); model.DeptId = Utils.GetInt(Utils.GetFormValue(this.hideDeptID.ClientID)); model.BuyCompanyId = CustomUnitID; model.BuyCompanyName = CustomUnit; model.OperatorId = this.SiteUserInfo.UserId; IList <MTourPlaner> planerlist = new List <MTourPlaner>(); MTourPlaner planer = null; string planernamestr = Utils.GetFormValue(SellsSelect2.SellsNameClient); string planerIdstr = Utils.GetFormValue(SellsSelect2.SellsIDClient); string planerptIdstr = Utils.GetFormValue(this.hidePlanerDeptID.ClientID); for (int i = 0; i < planerIdstr.Split(',').Length; i++) { planer = new MTourPlaner(); planer.PlanerId = planerIdstr.Split(',')[i]; planer.Planer = planernamestr.Split(',')[i]; planer.DeptId = Utils.GetInt(planerptIdstr.Split(',')[i]); planerlist.Add(planer); } model.TourPlanersList = planerlist; model.Adults = Utils.GetInt(AdultCount); model.ContactDepartId = this.hdContactdepartid.Value; //客户要求 model.TourTeamPriceList = GetCustomRequireList(); //供应商安排 model.PlanBaseInfoList = GetSourcePlanList(); //客户信息 model.TourOrderTravellerList = GetCustomList(); model.TourPay = Utils.GetDecimal(TotalEx); model.TourIncome = Utils.GetDecimal(TotalIn); model.TourProfit = Utils.GetDecimal(Profit); if (model.TourOrderTravellerList.Count == 0) { msg = UtilsCommons.AjaxReturnJson("0", "请至少填写一条客户信息"); RCWE(msg); } } model.OperatorDeptId = this.SiteUserInfo.DeptId; model.WeiTuoRiQi = Utils.GetDateTime(Utils.GetFormValue(txtWeiTuoRiQi.UniqueID), DateTime.Today); model.HeTongCode = Utils.GetFormValue(txtHeTongHao.HeTongCodeClientID); model.HeTongId = Utils.GetFormValue(txtHeTongHao.HeTongIdClientID); bool result = false; if (string.IsNullOrEmpty(DanXiangYeWuId)) { lock (PaiTuanXuHaoLockHelper) { result = bll.AddSingleService(model); } } else { result = bll.UpdateSingleService(model); } string type = string.IsNullOrEmpty(DanXiangYeWuId) ? "新增" : "修改"; if (Utils.GetQueryStringValue("submitplan") == "submit") { type = "提交"; } if (result) { msg = UtilsCommons.AjaxReturnJson("1", type + "成功!"); } else { msg = UtilsCommons.AjaxReturnJson("0", type + "失败!"); } RCWE(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 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); } }