示例#1
0
 public int Update(CorpDepartmentEntity t, string[] properties = null)
 {
     using (BrightourDbContext db = new BrightourDbContext())
     {
         return(db.Update(t, properties));
     }
 }
        public CorpPolicyDetailConfigModel GetCorpPolicy(int cid)
        {
            CorpPolicyDetailConfigModel policyModel = null;
            //1.获取客户信息
            CustomerInfoEntity customerInfoEntity = _customerDal.Find <CustomerInfoEntity>(cid);

            if (!customerInfoEntity.CorpDepartID.HasValue)
            {
                return(null);
            }
            List <CorporationEntity> corporationModels = _corporationDal.Query <CorporationEntity>(n => n.CorpId == customerInfoEntity.CorpID, true).ToList();

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


            //2.获取部门信息
            CorpDepartmentEntity corpDepartmentEntity =
                _corpDepartmentDal.Find <CorpDepartmentEntity>(customerInfoEntity.CorpDepartID.Value);

            if (!corpDepartmentEntity.PolicyId.HasValue)
            {
                return(null);
            }
            //3.获取部门上的差旅政策信息
            List <CorpPolicyDetailConfigEntity> corpPolicyDetailConfigEntities =
                _corpPolicyDetailConfigDal.Query <CorpPolicyDetailConfigEntity>(
                    n => n.PolicyId == corpDepartmentEntity.PolicyId.Value, true).ToList();

            policyModel = CorpPolicyConvertFactory.Convert(corpPolicyDetailConfigEntities);
            policyModel.CorpDepartmentModel = Mapper.Map <CorpDepartmentEntity, CorpDepartmentModel>(corpDepartmentEntity);
            policyModel.CorpModel           = Mapper.Map <CorporationEntity, CorporationModel>(corporationModels[0]);
            policyModel.CustomerInfoModel   = Mapper.Map <CustomerInfoEntity, CustomerInfoModel>(customerInfoEntity);

            List <ChoiceReasonEntity> choiceReasonEntities = null;

            if (!string.IsNullOrEmpty(corpDepartmentEntity.CorpId))
            {
                choiceReasonEntities =
                    _choiceReasonDal.Query <ChoiceReasonEntity>(
                        n => n.IsDel != "T" && n.CorpID == corpDepartmentEntity.CorpId, true).ToList();
            }
            if (choiceReasonEntities != null)
            {
                policyModel.PolicyReason     = choiceReasonEntities.Select(n => n.Reason).ToList();
                policyModel.PolicyReasonList = (from n in choiceReasonEntities
                                                select new ChoiceReasonModel()
                {
                    Id = n.ID,
                    Reason = n.Reason
                }).ToList();
            }
            return(policyModel);
        }
示例#3
0
        /// <summary>
        /// 将联系人信息转成乘客信息
        /// </summary>
        /// <returns></returns>
        private List <PassengerInfoModel> ConvertContactToPassenger(List <ContactInfoEntity> contactInfoList, List <CustomerInfoEntity> customerList)
        {
            if (contactInfoList == null || contactInfoList.Count == 0)
            {
                return(null);
            }
            if (contactInfoList.Count > 50)
            {
                contactInfoList = contactInfoList.Take(50).ToList();
            }

            List <PassengerInfoModel> passengerList = new List <PassengerInfoModel>();

            List <int> contactIdList = new List <int>();

            contactInfoList.ForEach(n => contactIdList.Add(n.Contactid));
            List <ContactIdentificationInfoEntity> identificationList =
                _contactIdentificationDal.Query <ContactIdentificationInfoEntity>(
                    n => contactIdList.Contains(n.Contactid)).ToList();

            if (identificationList == null || identificationList.Count == 0)
            {
                identificationList = new List <ContactIdentificationInfoEntity>();
            }

            foreach (ContactInfoEntity contactInfo in contactInfoList)
            {
                PassengerInfoModel passengerInfo = new PassengerInfoModel();
                passengerInfo.ContactId     = contactInfo.Contactid;
                passengerInfo.PassengerName = !string.IsNullOrEmpty(contactInfo.Cname)
                    ? contactInfo.Cname
                    : contactInfo.Ename;
                passengerInfo.Mobile = contactInfo.Mobile;
                passengerInfo.Phone  = contactInfo.Phone;
                passengerInfo.Fax    = contactInfo.Fax;
                passengerInfo.Email  = contactInfo.Email;

                CustomerInfoEntity customerInfoEntity = null;
                if (customerList != null && contactInfo.PCid.HasValue)
                {
                    customerInfoEntity = customerList.Find(n => n.Cid == contactInfo.PCid.Value);
                }
                else
                {
                    customerInfoEntity = customerList?.Find(n => n.Cid == contactInfo.Cid);
                }

                if (customerInfoEntity != null)
                {
                    CorpDepartmentEntity corpDepartmentEntity = _corpDepartmentDal.Find <CorpDepartmentEntity>(customerInfoEntity.CorpDepartID ?? 0);
                    passengerInfo.DepartmentName = corpDepartmentEntity?.DepartName;
                    passengerInfo.Cid            = customerInfoEntity.Cid;
                }


                var tempCardList =
                    identificationList.FindAll(n => n.Contactid == contactInfo.Contactid);
                #region 将默认证件放在首位
                int defaultCardType = contactInfo.DefaultIdentificationId ?? 0;
                var tempCard        = tempCardList.Find(n => n.Iid == defaultCardType);
                if (tempCard != null)
                {
                    tempCardList.RemoveAll(n => n.Iid == defaultCardType);
                    tempCardList = tempCardList.OrderBy(n => n.Iid).ToList();
                    tempCardList.Add(tempCard);
                    tempCardList.Reverse();
                }
                #endregion
                passengerInfo.IdentificationList = Mapper
                                                   .Map <List <ContactIdentificationInfoEntity>, List <IdentificationModel> >(tempCardList);

                passengerList.Add(passengerInfo);
            }

            return(passengerList);
        }
示例#4
0
 public int Insert(CorpDepartmentEntity t)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public int Delete(CorpDepartmentEntity t)
 {
     throw new NotImplementedException();
 }