Exemplo n.º 1
0
        public List <CustomerModel> GetCustomerByCidList(List <int> cidList)
        {
            List <CustomerInfoEntity>      customerInfoEntities      = _customerDal.Query <CustomerInfoEntity>(n => cidList.Contains(n.Cid)).ToList();
            List <CustomerUnionInfoEntity> customerUnionInfoEntities =
                _customerUnionDal.Query <CustomerUnionInfoEntity>(n => cidList.Contains(n.Cid)).ToList();
            List <CustomerModel> customerModels = Convert(customerInfoEntities, customerUnionInfoEntities);

            return(customerModels);
        }
Exemplo n.º 2
0
        public bool UpdateCustomerCorpDepartIdList(int cid, List <int> corpDepartIdList, bool isAll)
        {
            CustomerUnionInfoEntity customerUnionInfoEntity =
                _customerUnionDal.Query <CustomerUnionInfoEntity>(n => n.Cid == cid).FirstOrDefault();

            string d = string.Empty;

            corpDepartIdList.ForEach(n =>
            {
                d += "," + n;
            });

            if (string.IsNullOrEmpty(d) && !isAll)
            {
                return(true);
            }

            if (!string.IsNullOrEmpty(d))
            {
                d = d.Substring(1);
            }


            if (customerUnionInfoEntity != null)
            {
                customerUnionInfoEntity.CorpDepartIDList = d;
                if (isAll)
                {
                    customerUnionInfoEntity.CorpDepartIDList = "0";
                }

                _customerUnionDal.Update(customerUnionInfoEntity, new string[] { "CorpDepartIDList" });
            }
            else
            {
                customerUnionInfoEntity = new CustomerUnionInfoEntity()
                {
                    Cid = cid,
                    CorpDepartIDList = d
                };

                if (isAll)
                {
                    customerUnionInfoEntity.CorpDepartIDList = "0";
                }

                _customerUnionDal.Insert(customerUnionInfoEntity);
            }

            return(true);
        }
Exemplo n.º 3
0
        public List <PassengerInfoModel> GetPassenger(int cid, bool isTemporary, string searchArgs = "", int isOnline = 0)
        {
            CustomerInfoEntity customer    = _customerDal.Find <CustomerInfoEntity>(cid);
            BaseCustomerBll    customerBll = null;

            if (!string.IsNullOrEmpty(customer.CorpID))
            {
                CorporationEntity corporationEntity = _corporationDal.Find <CorporationEntity>(customer.CorpID);
                if (corporationEntity.IsAmplitudeCorp == "T" && !isTemporary) //是差旅公司,并且不是查询临客
                {
                    if (customer.IsMaster == "T")                             //预订员
                    {
                        CustomerUnionInfoEntity customerUnionInfoEntity =
                            _customerUnionDal.Query <CustomerUnionInfoEntity>(n => n.Cid == cid, true).FirstOrDefault();
                        string corpDepartIdList = customerUnionInfoEntity?.CorpDepartIDList;
                        if (!customer.CorpDepartID.HasValue)
                        {
                            throw new Exception("当前预定员部门信息异常");
                        }

                        if (string.IsNullOrEmpty(corpDepartIdList))
                        {
                            corpDepartIdList = customer.CorpDepartID.Value.ToString();
                        }

                        customerBll = new TripDepartBookingCustomerBll(customer, corporationEntity.CorpId,
                                                                       corpDepartIdList);
                    }
                    else
                    {
                        customerBll = new TripNotBookingCustomerBll(customer); //非预订员,普通差旅客户
                    }
                }
                else
                {
                    customerBll = new CommonCustomerBll(customer); //临客
                }
            }
            else
            {
                customerBll = new CommonCustomerBll(customer); //临客
            }

            ICustomerVisitor customerVisitor = new CustomerVisitor(_contactDal, _contactIdentificationDal, _customerDal,
                                                                   _corpDepartmentDal, searchArgs, base.Context, isOnline);
            List <PassengerInfoModel> passengerInfoModels = customerBll.GetPassenger(customerVisitor);

            return(passengerInfoModels);
        }
Exemplo n.º 4
0
        public List <CorpBookingDepartModel> GetCorpBookingDepartList(int cid, string corpId)
        {
            if (cid == 0)
            {
                throw new Exception("该客户信息异常");
            }

            CustomerInfoEntity customerInfoEntity =
                _customerDal.Find <CustomerInfoEntity>(cid);

            if (string.IsNullOrEmpty(customerInfoEntity?.CorpID))
            {
                throw new Exception("该客户信息异常");
            }
            if (!customerInfoEntity.CorpDepartID.HasValue)
            {
                throw new Exception("该客户部门信息异常");
            }

            List <CorpBookingDepartModel> list = new List <CorpBookingDepartModel>();
            List <CorpDepartmentModel>    corpDepartmentModels =
                _getCorpDepartmentBll.GetCorpDepartmentByCorpId(corpId);

            CustomerUnionInfoEntity customerUnionInfoEntity =
                _customerUnionDal.Query <CustomerUnionInfoEntity>(n => n.Cid == cid, true).FirstOrDefault();

            string corpDepartStr = string.Empty;

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

            if (customerUnionInfoEntity != null)
            {
                corpDepartStr = customerUnionInfoEntity.CorpDepartIDList;
            }

            if (string.IsNullOrEmpty(corpDepartStr))//如果当前值为NULL,则默认当前客户的部门Id
            {
                departIdList.Add(customerInfoEntity.CorpDepartID.Value);
            }
            else
            {
                if (corpDepartStr == "0")//如果为0值,则认为全部部门
                {
                    IsAll = true;
                }
                else
                {
                    List <string> c = corpDepartStr.Split(',').ToList();
                    if (c != null && c.Count > 0)
                    {
                        c.ForEach(n => departIdList.Add(Convert.ToInt32(n)));
                    }
                    else
                    {
                        throw new Exception("配置信息异常");
                    }
                }
            }



            if (IsAll)
            {
                foreach (var corpDepartmentModel in corpDepartmentModels)
                {
                    CorpBookingDepartModel departModel = new CorpBookingDepartModel()
                    {
                        DepartId    = corpDepartmentModel.Id,
                        DepartName  = corpDepartmentModel.DepartName,
                        IsBookinged = true
                    };
                    list.Add(departModel);
                }
            }
            else
            {
                foreach (var corpDepartmentModel in corpDepartmentModels)
                {
                    CorpBookingDepartModel departModel = new CorpBookingDepartModel()
                    {
                        DepartId    = corpDepartmentModel.Id,
                        DepartName  = corpDepartmentModel.DepartName,
                        IsBookinged = departIdList.Contains(corpDepartmentModel.Id)
                    };
                    list.Add(departModel);
                }
            }

            return(list);
        }