Exemple #1
0
        public List <ContactInfoModel> SearchContacts(string args, int cid)
        {
            List <ContactInfoModel> contactInfoModels = new List <ContactInfoModel>();
            CustomerModel           customerModel     = _getCustomerBll.GetCustomerByCid(cid);

            if (!string.IsNullOrEmpty(customerModel.CorpID) && customerModel.Corporation != null)
            {
                if (customerModel.Corporation.IsAmplitudeCorp == "T")
                {
                    if (customerModel.IsMaster == "T")
                    {
                        //查询当前公司下所有的联系人信息
                        //List<CustomerModel> customerModels = _getCustomerBll.GetCustomerByCorpId(customerModel.CorpID);
                        //List<int> cidList = customerModels.Select(n => n.Cid).ToList();
                        //contactInfoModels = _getContactBll.GetContactByCid(cidList, args);

                        //查询当前客户名下的联系人信息
                        contactInfoModels = _getContactBll.GetContactByCid(customerModel.Cid, args);
                    }
                    else
                    {
                        //查询当前客户名下的联系人信息
                        contactInfoModels = _getContactBll.GetContactByCid(customerModel.Cid, args);
                    }
                }
                else
                {
                    //查询当前公司下所有的联系人信息
                    List <CustomerModel> customerModels = _getCustomerBll.GetCustomerByCorpId(customerModel.CorpID);
                    List <int>           cidList        = customerModels.Select(n => n.Cid).ToList();
                    contactInfoModels = _getContactBll.GetContactByCid(cidList, args);
                }
            }
            else
            {
                //查询当前客户名下的联系人信息
                contactInfoModels = _getContactBll.GetContactByCid(customerModel.Cid, args);
            }


            return(contactInfoModels);
        }
Exemple #2
0
        public MatchCorpPolicyAndAduitResultModel Match(MatchCorpPolicyAndAduitModel model)
        {
            BaseMatchBll matchBll = null;

            if (model.PassengerCidList == null || model.PassengerCidList.Count == 0) //都是临时客人的情况
            {
                CustomerModel bookingCustomerModel = _getCustomerBll.GetCustomerByCid(model.BookingCid);
                matchBll = new AllTemporaryBll(null, null, bookingCustomerModel, model.IsAllowUserInsurance);
            }
            else
            {
                //根据乘客人id获取部门Id
                List <CustomerModel> customerModels = _getCustomerBll.GetCustomerByCidList(model.PassengerCidList);
                List <int>           departIdList   = new List <int>();
                customerModels.ForEach(n =>
                {
                    if (n.CorpDepartID.HasValue)
                    {
                        departIdList.Add(n.CorpDepartID.Value);
                    }
                });

                departIdList = departIdList.Distinct().ToList();
                if (departIdList.Count == 1) //只有一个部门id,则认为是相同部门
                {
                    matchBll = new SameDepartmentBll(model.PassengerCidList, customerModels, model.IsAllowUserInsurance);
                }
                else
                {
                    matchBll = new DiffDepartmentBll(model.PassengerCidList, customerModels, model.IsAllowUserInsurance);
                }
            }

            IMatchVisitor matchVisitor = new MatchVisitor(_changeInfoFactory, _projectNameDal);

            return(matchBll.DoMatch(matchVisitor));
        }
Exemple #3
0
 public CustomerModel GetCustomerByCid(int cid)
 {
     return(_customerBll.GetCustomerByCid(cid));
 }
        public bool PostIdentification(IdentificationModel model, int cid)
        {
            var contact = _contactDal.Query <ContactInfoEntity>(a => a.PCid == cid).FirstOrDefault();

            if (contact == null)
            {
                throw new Exception("当前客户信息异常,不能修改");
            }

            if (model.IsDefault == 1)
            {
                contact.DefaultIdentificationId = model.Iid;
                _contactDal.Update <ContactInfoEntity>(contact, new string[] { "DefaultIdentificationId" });
            }
            else
            {
                if (contact.DefaultIdentificationId.HasValue && contact.DefaultIdentificationId.Value == model.Iid)
                {
                    contact.DefaultIdentificationId = 0;
                    _contactDal.Update <ContactInfoEntity>(contact, new string[] { "DefaultIdentificationId" });
                }
            }

            model.ContactId = contact.Contactid;
            //判断当前公司下,是否存在相同证件,如果存在,则不许修改
            CustomerModel customerModel = _getCustomerBll.GetCustomerByCid(cid);

            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                List <CustomerModel> customerModels = _getCustomerBll.GetCustomerByCorpId(customerModel.CorpID);
                List <int>           cidList        = new List <int>();
                customerModels.ForEach(n =>
                {
                    if (n.Cid != cid)
                    {
                        cidList.Add(n.Cid);
                    }
                });

                List <ContactInfoEntity> contactInfoEntities =
                    _contactDal.Query <ContactInfoEntity>(a => cidList.Contains(a.PCid ?? 0)).ToList();

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

                contactInfoEntities.ForEach(n => contactIdList.Add(n.Contactid));

                List <ContactIdentificationInfoEntity> infoList =
                    _contactIdentificationDal.Query <ContactIdentificationInfoEntity>(
                        n =>
                        contactIdList.Contains(n.Contactid) && !string.IsNullOrEmpty(n.CardNo) &&
                        n.CardNo.ToUpper() == model.CardNo.ToUpper() && n.Iid == model.Iid)
                    .ToList();

                if (infoList != null && infoList.Count > 0)
                {
                    throw new Exception("当前公司存在相同证件号,不能修改");
                }
            }


            var identifications = _contactIdentificationDal.Query <ContactIdentificationInfoEntity>(a => a.Contactid == model.ContactId && a.Iid == model.Iid);
            var entity          = Mapper.Map <IdentificationModel, ContactIdentificationInfoEntity>(model);

            entity.LastUpdateTime = DateTime.Now;
            entity.CardNo         = entity.CardNo ?? "";
            if (identifications != null && identifications.Any())
            {
                _contactIdentificationDal.Update <ContactIdentificationInfoEntity>(entity);
            }
            else
            {
                _contactIdentificationDal.Insert <ContactIdentificationInfoEntity>(entity);
            }
            return(true);
        }