Пример #1
0
        /// <summary>
        /// 根据项目成本中心对应的差旅政策信息
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="isAllowUserInsurance"></param>
        /// <returns></returns>
        public List <CorpPolicyChangeModel> GetCorpPolicyChangeInfoByProjectId(int projectId,
                                                                               int isAllowUserInsurance)
        {
            List <int> policyIdList =
                _corpPolicyConfigProjectDal.Query <CorpPolicyConfigProjectEntity>(
                    n => projectId == n.ProjectId, true).Select(n => n.PolicyId).ToList();//根据项目Id获取对应的差标信息


            if (policyIdList == null || policyIdList.Count == 0)
            {
                return(null);
            }


            List <CorpPolicyChangeModel> resultList = new List <CorpPolicyChangeModel>();

            List <CorpPolicyConfigEntity> policyList = _corpPolicyConfigDal.Query <CorpPolicyConfigEntity>(
                n => policyIdList.Contains(n.PolicyId) && !string.IsNullOrEmpty(n.IsDel) && n.IsDel.ToUpper() == "F",
                true).ToList();

            foreach (var entity in policyList)
            {
                List <CorpPolicyDetailConfigEntity> policyDetailList =
                    _corpPolicyDetailConfigDal.Query <CorpPolicyDetailConfigEntity>(
                        n => n.PolicyId == entity.PolicyId, true).ToList();
                CorpPolicyDetailConfigModel policyModel = CorpPolicyConvertFactory.Convert(policyDetailList);
                if (isAllowUserInsurance == 0)//如果当前公司个性化不许购买保险,则统一设置F;如果允许购买保险,则看差标允许不允许
                {
                    policyModel.NPolicyValI = "F";
                }
                resultList.Add(new CorpPolicyChangeModel()
                {
                    PolicyId           = entity.PolicyId,
                    PolicyName         = entity.PolicyName,
                    ViolateNPolicyValL = policyModel.NPolicyValL,
                    ViolateNPolicyValT = policyModel.NPolicyValT,
                    ViolateNPolicyValR = policyModel.NPolicyValR,
                    ViolateNPolicyValY = policyModel.NPolicyValY,
                    ViolateNPolicyValI = policyModel.NPolicyValI,
                    ViolateTPolicyValQ = policyModel.TPolicyValQ,
                    ViolateTPolicyValM = policyModel.TPolicyValM,
                    ViolateTPolicyValS = policyModel.TPolicyValS
                });
            }



            return(resultList);
        }
Пример #2
0
        /// <summary>
        /// 产生差旅政策信息
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="departId"></param>
        /// <param name="isAllowUserInsurance"></param>
        /// <returns></returns>
        public List <CorpPolicyChangeModel> GetCorpPolicyChangeInfo(int cid, int departId, int isAllowUserInsurance)
        {
            List <CorpPolicyChangeModel> resultList = null;

            #region 先根据cid查找员工的差旅政策
            List <CorpPolicyConfigCustomerEntity> corpPolicyConfigCustomerList =
                _corpPolicyConfigCustomerDal.Query <CorpPolicyConfigCustomerEntity>(n => n.Cid == cid, true).ToList();
            if (corpPolicyConfigCustomerList != null && corpPolicyConfigCustomerList.Count > 0)
            {
                List <int> policyIdList = new List <int>();
                corpPolicyConfigCustomerList.ForEach(n => { policyIdList.Add(n.PolicyId); });
                //获取政策信息
                List <CorpPolicyConfigEntity> policyList = _corpPolicyConfigDal.Query <CorpPolicyConfigEntity>(
                    n => policyIdList.Contains(n.PolicyId) && !string.IsNullOrEmpty(n.IsDel) && n.IsDel.ToUpper() == "F",
                    true).ToList();

                resultList = new List <CorpPolicyChangeModel>();
                foreach (var entity in corpPolicyConfigCustomerList)
                {
                    var policy = policyList.Find(n => n.PolicyId == entity.PolicyId);
                    if (policy != null)
                    {
                        List <CorpPolicyDetailConfigEntity> policyDetailList =
                            _corpPolicyDetailConfigDal.Query <CorpPolicyDetailConfigEntity>(
                                n => n.PolicyId == entity.PolicyId, true).ToList();
                        CorpPolicyDetailConfigModel policyModel = CorpPolicyConvertFactory.Convert(policyDetailList);

                        if (isAllowUserInsurance == 0)//如果当前公司个性化不许购买保险,则统一设置F;如果允许购买保险,则看差标允许不允许
                        {
                            policyModel.NPolicyValI = "F";
                        }

                        resultList.Add(new CorpPolicyChangeModel()
                        {
                            PolicyId           = entity.PolicyId,
                            PolicyName         = policy.PolicyName,
                            ViolateNPolicyValL = policyModel.NPolicyValL,
                            ViolateNPolicyValT = policyModel.NPolicyValT,
                            ViolateNPolicyValR = policyModel.NPolicyValR,
                            ViolateNPolicyValY = policyModel.NPolicyValY,
                            ViolateNPolicyValI = policyModel.NPolicyValI,
                            ViolateTPolicyValQ = policyModel.TPolicyValQ,
                            ViolateTPolicyValM = policyModel.TPolicyValM,
                            ViolateTPolicyValS = policyModel.TPolicyValS
                        });
                    }
                }
                return(resultList);
            }

            #endregion

            #region 如果没有政策,则查找部门的差旅政策
            List <CorpPolicyConfigDepartmentEntity> corpPolicyConfigDepartmentEntities =
                _corpPolicyConfigDepartmentDal.Query <CorpPolicyConfigDepartmentEntity>(n => n.DepartmentId == departId,
                                                                                        true)
                .ToList();
            if (corpPolicyConfigDepartmentEntities != null && corpPolicyConfigDepartmentEntities.Count > 0)
            {
                List <int> policyIdList = new List <int>();
                corpPolicyConfigDepartmentEntities.ForEach(n => { policyIdList.Add(n.PolicyId); });

                //获取政策信息
                List <CorpPolicyConfigEntity> policyList = _corpPolicyConfigDal.Query <CorpPolicyConfigEntity>(
                    n => policyIdList.Contains(n.PolicyId) && !string.IsNullOrEmpty(n.IsDel) && n.IsDel.ToUpper() == "F",
                    true).ToList();
                resultList = new List <CorpPolicyChangeModel>();

                foreach (var entity in corpPolicyConfigDepartmentEntities)
                {
                    var policy = policyList.Find(n => n.PolicyId == entity.PolicyId);
                    if (policy != null)
                    {
                        List <CorpPolicyDetailConfigEntity> policyDetailList =
                            _corpPolicyDetailConfigDal.Query <CorpPolicyDetailConfigEntity>(
                                n => n.PolicyId == entity.PolicyId, true).ToList();
                        CorpPolicyDetailConfigModel policyModel = CorpPolicyConvertFactory.Convert(policyDetailList);
                        if (isAllowUserInsurance == 0)//如果当前公司个性化不许购买保险,则统一设置F;如果允许购买保险,则看差标允许不允许
                        {
                            policyModel.NPolicyValI = "F";
                        }
                        resultList.Add(new CorpPolicyChangeModel()
                        {
                            PolicyId           = entity.PolicyId,
                            PolicyName         = policy.PolicyName,
                            ViolateNPolicyValL = policyModel.NPolicyValL,
                            ViolateNPolicyValT = policyModel.NPolicyValT,
                            ViolateNPolicyValR = policyModel.NPolicyValR,
                            ViolateNPolicyValY = policyModel.NPolicyValY,
                            ViolateNPolicyValI = policyModel.NPolicyValI,
                            ViolateTPolicyValQ = policyModel.TPolicyValQ,
                            ViolateTPolicyValM = policyModel.TPolicyValM,
                            ViolateTPolicyValS = policyModel.TPolicyValS
                        });
                    }
                }
                return(resultList);
            }
            #endregion

            //都没找到则返回null
            return(null);
        }