示例#1
0
 /// <summary>
 /// 创建一个客户_社保政策
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个客户_社保政策</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, CRM_Company_PoliceInsurance entity)
 {
     try
     {
         repository.Create(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
        /// <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);
        }