/// <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 address = Utils.GetFormValue(this.txtaddress.UniqueID); //合同开始时间 string ContractStartDate = Utils.GetFormValue(this.txtContractDate_Start.UniqueID); //合同有到期时间 string ContractDate = Utils.GetFormValue(this.txtContractDate.UniqueID); string ContactNum = Utils.GetFormValue(this.txtContractNum.UniqueID); string PriceSystem = Utils.GetFormValue(this.txtPriceSystem.UniqueID); string UnitPolicy = Utils.GetFormValue(this.txtUnitPolicy.UniqueID); //轮船公司 string CruiseCompany = Utils.GetFormValue(this.txtCruiseCompany.UniqueID); //船载电话 string CruiseTel = Utils.GetFormValue(this.txtCruiseTel.UniqueID); //游轮景点 string Scenic = Utils.GetFormValue(this.txtRoutes.UniqueID); //自费景点 string OwerRoutes = Utils.GetFormValue(this.txtOwerRoutes.UniqueID); //开始时间 string StarTime = Utils.GetFormValue(this.txtstarttime.UniqueID); //结束时间 string EndTime = Utils.GetFormValue(this.txtendtime.UniqueID); if (String.IsNullOrEmpty(CruiseCompany)) { msg = "{\"result\":\"0\",\"msg\":\"游轮公司不能为空!\"}"; return(msg); } EyouSoft.BLL.SourceStructure.BSource Bll = new EyouSoft.BLL.SourceStructure.BSource(); EyouSoft.Model.SourceStructure.MSourceShip model = new MSourceShip(); EyouSoft.Model.SourceStructure.MSource mModel = new EyouSoft.Model.SourceStructure.MSource(); IList <EyouSoft.Model.CrmStructure.MCrmLinkman> linkman = new List <EyouSoft.Model.CrmStructure.MCrmLinkman>(); string userid = string.Empty; if (!string.IsNullOrEmpty(id)) { model = new EyouSoft.BLL.SourceStructure.BSource().GetShipModel(id); userid = model.SourceModel.UserId; } 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.ddlProvince.UniqueID)); //合同附件(新) 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.Address = address; mModel.ContractPeriodStart = String.IsNullOrEmpty(ContractStartDate) ? null : (DateTime?)DateTime.Parse(ContractStartDate); mModel.ContractPeriodEnd = String.IsNullOrEmpty(ContractDate) ? null : (DateTime?)DateTime.Parse(ContractDate); mModel.ContractAttach = visaModel; model.PriceSystem = PriceSystem; mModel.UnitPolicy = UnitPolicy; mModel.LastModifierId = this.SiteUserInfo.Name; mModel.LastModifyTime = DateTime.Now; mModel.CompanyId = this.SiteUserInfo.CompanyId; mModel.OperatorId = this.SiteUserInfo.UserId; mModel.DeptId = this.SiteUserInfo.DeptId; mModel.IssueTime = DateTime.Now; mModel.IsCommission = true; //是否签单 mModel.IsPermission = false; if (RadSign_yes.Checked) { mModel.IsPermission = true; } //是否返佣 mModel.IsCommission = false; if (radyes.Checked) { mModel.IsCommission = true; } //是否推荐 mModel.IsRecommend = false; if (RadRecommend_yes.Checked) { mModel.IsRecommend = true; } //是否签订合同 mModel.IsSignContract = false; if (Radio_hd_yes.Checked) { mModel.IsSignContract = true; mModel.ContractCode = Utils.GetFormValue(this.txtContractNum.UniqueID); } if (!String.IsNullOrEmpty(id)) { model.SourceModel.SourceId = id; } model.OwerRoutes = OwerRoutes; model.Routes = Scenic; model.StartTime = string.IsNullOrEmpty(StarTime) ? null : (DateTime?)Convert.ToDateTime(StarTime); model.EndTime = string.IsNullOrEmpty(StarTime) ? null : (DateTime?)Convert.ToDateTime(StarTime); model.Telephone = CruiseTel; model.LinkManList = UtilsCommons.GetDataList(); model.SubShipList = this.GetDataList(); mModel.UserId = userid; mModel.Name = CruiseCompany.Trim(); model.SourceModel = mModel; int result = 0; if (t) {//新增 result = Bll.AddShipModel(model); if (result == -1) { msg = "{\"result\":\"0\",\"msg\":\"游轮名称已存在!\"}"; return(msg); } } else { //编辑 result = Bll.UpdateShipModel(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); } }