public Common.ClientResult.Result PostPrice([FromBody] CRM_CompanyInfo entity) { Common.ClientResult.Result result = new Common.ClientResult.Result(); if (entity != null && ModelState.IsValid) { //entity.CRM_Company_ID = entity.CRM_Company_Audit_ID; //企业报价 List <CRM_CompanyPrice_Audit> listPrice = new List <CRM_CompanyPrice_Audit>(); string price = entity.Price; if (!string.IsNullOrEmpty(price)) { listPrice = GetPriceList(price); } //企业阶梯报价 List <CRM_CompanyLadderPrice_Audit> listLadderPrice = new List <CRM_CompanyLadderPrice_Audit>(); string ladderPrice = entity.LadderPrice; if (!string.IsNullOrEmpty(ladderPrice)) { listLadderPrice = GetLadderPriceList(ladderPrice); } string returnValue = string.Empty; if (m_BLL.CreatePrice_Audit(listPrice, listLadderPrice)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",客户_企业报价_待审批的信息的Id为" + listPrice[0].ID, "客户_企业报价_待审批" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.InsertSucceed; return(result); //提示创建成功 } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",客户_企业报价_待审批的信息," + returnValue, "客户_企业报价_待审批" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.InsertFail + returnValue; return(result); //提示插入失败 } } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 return(result); }
//创建新公司 public Common.ClientResult.Result PostNewCompany([FromBody] CRM_CompanyInfo entity) { Common.ClientResult.Result result = new Common.ClientResult.Result(); if (entity != null && ModelState.IsValid) { CRM_Company baseModel = entity.BasicInfo;//基本信息 baseModel.CreateTime = DateTime.Now; baseModel.CreateUserID = LoginInfo.UserID; baseModel.CreateUserName = LoginInfo.RealName; baseModel.OperateStatus = (int)Common.Status.启用; CRM_CompanyContract contractModel = entity.Contract; // 合同信息 contractModel.CreateTime = DateTime.Now; contractModel.CreateUserID = LoginInfo.UserID; contractModel.CreateUserName = LoginInfo.RealName; contractModel.Status = (int)Common.Status.启用; contractModel.BranchID = LoginInfo.BranchID; //公司分支机构 CRM_CompanyToBranch branchModel = new CRM_CompanyToBranch(); branchModel.BranchID = LoginInfo.BranchID; branchModel.UserID_XS = LoginInfo.UserID; branchModel.Status = (int)Common.Status.启用; //联系人信息 List <CRM_CompanyLinkMan> listLink = new List <CRM_CompanyLinkMan>(); string linkMan = entity.LinkMan; if (!string.IsNullOrEmpty(linkMan)) { listLink = GetLinkList(linkMan); } //银行信息 List <CRM_CompanyBankAccount> listBank = new List <CRM_CompanyBankAccount>(); string bank = entity.Bank; if (!string.IsNullOrEmpty(bank)) { listBank = GetBankList(bank); } //财务信息开票 List <CRM_CompanyFinance_Bill> listBill = new List <CRM_CompanyFinance_Bill>(); CRM_CompanyFinance_Bill billModel = entity.Bill; billModel.CreateTime = DateTime.Now; billModel.CreateUserID = LoginInfo.UserID; billModel.CreateUserName = LoginInfo.RealName; billModel.Status = (int)Common.Status.启用; billModel.BranchID = LoginInfo.BranchID; listBill.Add(billModel); //财务信息收款 List <CRM_CompanyFinance_Payment> listPay = new List <CRM_CompanyFinance_Payment>(); string payment = entity.Payment; if (!string.IsNullOrEmpty(payment)) { listPay = GetPayList(payment); } //企业报价 List <CRM_CompanyPrice> listPrice = new List <CRM_CompanyPrice>(); string price = entity.Price; if (!string.IsNullOrEmpty(price)) { listPrice = GetPriceList(price); } //企业阶梯报价 List <CRM_CompanyLadderPrice> listLadderPrice = new List <CRM_CompanyLadderPrice>(); string ladderPrice = entity.LadderPrice; if (!string.IsNullOrEmpty(ladderPrice)) { listLadderPrice = GetLadderPriceList(ladderPrice); } //企业社保政策和社保信息 SheBao shebao = Newtonsoft.Json.JsonConvert.DeserializeObject <SheBao>(entity.SheBaoInfo); List <CRM_Company_PoliceInsurance> CompanyPoliceInsurance = GetPoliceInsuance(shebao); List <CRM_Company_Insurance> CompanyInsurance = GetInsurance(shebao); string returnValue = string.Empty; if (m_BLL.CreateNewCompany(ref validationErrors, baseModel, contractModel, branchModel, listLink, listBank, listBill, listPay, listPrice, listLadderPrice, CompanyPoliceInsurance, CompanyInsurance)) //if (m_BLL.CreateNewCompany(ref validationErrors, baseModel, contractModel, branchModel, listLink, listBank, listBill, listPay, listPrice, listLadderPrice)) { //LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",客户_企业信息_待审核的信息的Id为" + entity.ID, "客户_企业信息_待审核" //);//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.InsertSucceed; return(result); //提示创建成功 } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } //LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",客户_企业信息_待审核的信息," + returnValue, "客户_企业信息_待审核" // );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.InsertFail + returnValue; return(result); //提示插入失败 } } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 return(result); }