/// <summary>
        /// 社保信息
        /// </summary>
        /// <param name="shebaoInfo"></param>
        /// <returns></returns>
        public List <CRM_Company_Insurance> GetInsurance(SheBao shebao)
        {
            List <CRM_Company_Insurance> list = new List <CRM_Company_Insurance>();
            DateTime dtnow = DateTime.Now;

            string[] arrItem;
            for (int i = 0; i < shebao.data.Count; i++)
            {
                if (shebao.data[i].QiYeSheBaoAccount != null && shebao.data[i].QiYeSheBaoAccount != "")
                {
                    string[] SheBaoAccount = shebao.data[i].QiYeSheBaoAccount.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    string[] SheBaoName    = shebao.data[i].QiYeSheBaoName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int j = 0; j < SheBaoAccount.Length; j++)
                    {
                        CRM_Company_Insurance model = new CRM_Company_Insurance();
                        model.City          = shebao.data[i].JiaoNaDi;
                        model.InsuranceKind = (int)(Common.EmployeeAdd_InsuranceKindId)Enum.Parse(typeof(Common.EmployeeAdd_InsuranceKindId), SheBaoName[j]);
                        model.Account       = SheBaoAccount[j];
                        model.State         = shebao.data[i].State;
                        model.CreateTime    = dtnow;
                        model.CreatePerson  = LoginInfo.RealName;
                        list.Add(model);
                    }
                }

                if (shebao.data[i].GongJiJinAccount != null && shebao.data[i].GongJiJinAccount != "")
                {
                    //string[] GongJiJinAccount = shebao.data[i].GongJiJinAccount.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    //string[] SheBaoName = shebao.data[i].QiYeSheBaoName.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    //for (int j = 0; j < GongJiJinAccount.Length; j++)
                    //{
                    CRM_Company_Insurance model = new CRM_Company_Insurance();
                    model.City          = shebao.data[i].JiaoNaDi;
                    model.InsuranceKind = (int)Common.EmployeeAdd_InsuranceKindId.公积金;
                    model.Account       = shebao.data[i].GongJiJinAccount;
                    model.State         = shebao.data[i].State;
                    model.CreateTime    = dtnow;
                    model.CreatePerson  = LoginInfo.RealName;
                    list.Add(model);
                    //}
                }
            }

            return(list);
        }
        /// <summary>
        /// 社保政策
        /// </summary>
        /// <param name="shebaoInfo"></param>
        /// <returns></returns>
        public List <CRM_Company_PoliceInsurance> GetPoliceInsuance(SheBao shebao)
        {
            List <CRM_Company_Insurance>       list = new List <CRM_Company_Insurance>();
            List <CRM_Company_PoliceInsurance> listPoliceInsurance = new List <CRM_Company_PoliceInsurance>();
            DateTime dtnow = DateTime.Now;

            string[] arrItem;
            for (int i = 0; i < shebao.data.Count; i++)
            {
                if (shebao.data[i].GongShangZhengCe != null && shebao.data[i].GongShangZhengCe != "")
                {
                    //社保政策
                    string[] GSZhengCe = shebao.data[i].GongShangZhengCe.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int j = 0; j < GSZhengCe.Length; j++)
                    {
                        CRM_Company_PoliceInsurance model = new CRM_Company_PoliceInsurance();
                        model.City            = shebao.data[i].JiaoNaDi;
                        model.CreatePerson    = LoginInfo.RealName;
                        model.CreateTime      = dtnow;
                        model.InsuranceKind   = (int)Common.EmployeeAdd_InsuranceKindId.工伤;
                        model.PoliceInsurance = Convert.ToInt32(GSZhengCe[j]);
                        model.State           = shebao.data[i].State;
                        listPoliceInsurance.Add(model);
                    }
                }
                if (shebao.data[i].GongJiJinZhengCe != null && shebao.data[i].GongJiJinZhengCe != "")
                {
                    string[] GSZhengCe = shebao.data[i].GongJiJinZhengCe.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int j = 0; j < GSZhengCe.Length; j++)
                    {
                        CRM_Company_PoliceInsurance model = new CRM_Company_PoliceInsurance();
                        model.City            = shebao.data[i].JiaoNaDi;
                        model.CreatePerson    = LoginInfo.RealName;
                        model.CreateTime      = dtnow;
                        model.InsuranceKind   = (int)Common.EmployeeAdd_InsuranceKindId.公积金;
                        model.PoliceInsurance = Convert.ToInt32(GSZhengCe[j]);
                        model.State           = shebao.data[i].State;
                        listPoliceInsurance.Add(model);
                    }
                }
            }

            return(listPoliceInsurance);
        }
 //创建新公司
 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);
 }