Ejemplo n.º 1
0
 public int Update(CustomerInfoEntity t, string[] properties = null)
 {
     using (BrightourDbContext db = new BrightourDbContext())
     {
         return(db.Update(t, properties));
     }
 }
Ejemplo n.º 2
0
        public CustomerModel GetCustomerByCid(int cid)
        {
            CustomerInfoEntity      customerInfoEntity      = _customerDal.Find <CustomerInfoEntity>(cid);
            CustomerUnionInfoEntity customerUnionInfoEntity = _customerUnionDal.Find <CustomerUnionInfoEntity>(cid);

            List <CustomerInfoEntity>      customerList      = null;
            List <CustomerUnionInfoEntity> customerUnionList = null;

            if (customerInfoEntity != null)
            {
                customerList = new List <CustomerInfoEntity> {
                    customerInfoEntity
                };
            }

            if (customerUnionInfoEntity != null)
            {
                customerUnionList = new List <CustomerUnionInfoEntity> {
                    customerUnionInfoEntity
                };
            }

            List <CustomerModel> customerModels = Convert(customerList, customerUnionList);

            return(customerModels.FirstOrDefault());
        }
Ejemplo n.º 3
0
        public void AddAppMessage(SendAppMessageModel sendAppMessageModel)
        {
            //判断当前接受人是否是差旅客户
            CustomerInfoEntity customerInfoEntity = _customerDal.Find <CustomerInfoEntity>(sendAppMessageModel.Cid);

            if (string.IsNullOrEmpty(customerInfoEntity.CorpID))
            {
                return;
            }

            CorporationEntity corporationEntity =
                _corporationDal.Query <CorporationEntity>(n => n.CorpId == customerInfoEntity.CorpID)
                .FirstOrDefault();

            if (corporationEntity == null || corporationEntity.IsAmplitudeCorp != "T")
            {
                return;
            }

            SendAppMessageEntity sendAppMessageEntity =
                Mapper.Map <SendAppMessageModel, SendAppMessageEntity>(sendAppMessageModel);

            sendAppMessageEntity.CreateTime = DateTime.Now;
            _sendAppMessageDal.Insert(sendAppMessageEntity);
        }
Ejemplo n.º 4
0
 CustomerInfo ICustomerInfoMapper.MapToCustomerInfo(CustomerInfoEntity customerInfoStorageEntity)
 {
     if (customerInfoStorageEntity is null)
     {
         throw new ArgumentNullException(nameof(customerInfoStorageEntity));
     }
     return(new CustomerInfo(customerInfoStorageEntity.CustomerId, customerInfoStorageEntity.TenantId));
 }
Ejemplo n.º 5
0
        public void MapToCustomerInfoThrowsArgumentNullExceptionIfObjectIsNull()
        {
            // Arrange
            ICustomerInfoMapper sut = new CustomerInfoMapper();
            CustomerInfoEntity  customerInfoEntity = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => sut.MapToCustomerInfo(customerInfoEntity));
        }
        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);
        }
Ejemplo n.º 7
0
        public List <ProjectNameModel> GetProjectName(int cid)
        {
            CustomerInfoEntity customerInfoEntity = _customerDal.Find <CustomerInfoEntity>(cid);

            if (string.IsNullOrEmpty(customerInfoEntity.CorpID))
            {
                return(null);
            }
            return(GetProjectNameByCorpId(customerInfoEntity.CorpID));
        }
Ejemplo n.º 8
0
        public List <CostCenterModel> GetCostCenter(int cid)
        {
            CustomerInfoEntity customerInfoEntity = _customerDal.Find <CustomerInfoEntity>(cid);

            if (string.IsNullOrEmpty(customerInfoEntity.CorpID))
            {
                return(null);
            }
            return(GetCostCenterByCorpId(customerInfoEntity.CorpID));
        }
Ejemplo n.º 9
0
        public void MapToCustomerInfoMustReturnCorrectValues()
        {
            // Arrange
            ICustomerInfoMapper sut = new CustomerInfoMapper();
            var customerInfoEntity  = new CustomerInfoEntity(TestHelper.CustomerId, TestHelper.TenantId);

            // Act
            CustomerInfo actual = sut.MapToCustomerInfo(customerInfoEntity);

            //Assert
            Assert.Equal(customerInfoEntity.TenantId, actual.TenantId);
            Assert.Equal(customerInfoEntity.CustomerId, actual.CustomerId);
        }
Ejemplo n.º 10
0
        public void MapToCustomerInfoStorageDtoReturnsCorrectValues()
        {
            // Arrange
            ICustomerInfoMapper sut = new CustomerInfoMapper();
            var customerInfo        = new CustomerInfo(TestHelper.CustomerId, TestHelper.TenantId);

            // Act
            CustomerInfoEntity actual = sut.MapToCustomerInfoStorageDto(customerInfo);

            //Assert
            Assert.Equal(customerInfo.TenantId, actual.TenantId);
            Assert.Equal(customerInfo.CustomerId, actual.CustomerId);
        }
        public void GetSendAppMessage(List <SendAppMessageModel> sendAppMessageModels)
        {
            foreach (var item in sendAppMessageModels)
            {
                CustomerInfoEntity customerInfoEntity = _customerInfoDal.GetCustomerByExpression(x => x.Cid == item.Cid);
                CorporationEntity  corporationEntity  = _corporationDal.GetContactInfoByExpression(x => x.CorpId == customerInfoEntity.CorpID);
                OperatorEntity     operatorEntity     =
                    base.Context.Set <OperatorEntity>().Where(n =>
                                                              n.Oid.ToUpper() == corporationEntity.ResponsibleOid).FirstOrDefault();
                item.Email = operatorEntity?.Email;

                item.SendContent = corporationEntity.CorpName + " 公司已生成订单 " + item.OrderId + ",请差旅顾问及时处理!";
            }
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        public bool UpdateCustomerPwd(UpdateCustomerPwdModel query)
        {
            CustomerInfoEntity customerInfoEntity = _customerDal.Find <CustomerInfoEntity>(query.Cid);

            if (string.IsNullOrEmpty(customerInfoEntity.Password))
            {
                throw new Exception("密码异常");
            }
            if (customerInfoEntity.Password.ToUpper() != query.OriginalPwd.ToUpper())
            {
                throw new Exception("密码错误");
            }
            customerInfoEntity.Password = query.AfterUpdatePwd;
            _customerDal.Update(customerInfoEntity, new string[] { "Password" });
            return(true);
        }
Ejemplo n.º 14
0
        public bool UpdateCustomerHeadPicture(int cid, string pictureUri)
        {
            CustomerInfoEntity customerInfoEntity = _customerDal.Find <CustomerInfoEntity>(cid);

            if (customerInfoEntity == null)
            {
                throw new Exception("当前客户信息异常");
            }
            if (string.IsNullOrEmpty(pictureUri))
            {
                throw new Exception("上传路径不能为空");
            }
            customerInfoEntity.HeadPictureUri = pictureUri;
            _customerDal.Update(customerInfoEntity, new string[] { "HeadPictureUri" });
            return(true);
        }
Ejemplo n.º 15
0
        public AppOpinionDomainModel AddOpinion(AppOpinionModel appOpinionModel)
        {
            _appOpinionDal.Insert <AppOpinionEntity>(new AppOpinionEntity()
            {
                AppOpinion = appOpinionModel.AppOpinion,
                AppType    = appOpinionModel.AppType,
                CreateCid  = appOpinionModel.CreateCid,
                CreateTime = DateTime.Now
            });
            CustomerInfoEntity    customerInfoEntity    = _customerInfoDal.GetCustomerByExpression(x => x.Cid == appOpinionModel.CreateCid);
            CorporationEntity     corporationEntity     = _corporationDal.GetContactInfoByExpression(x => x.CorpId == customerInfoEntity.CorpID);
            AppOpinionDomainModel appOpinionDomainModel = new AppOpinionDomainModel {
                AppOpinion = appOpinionModel.AppOpinion, CustomerName = customerInfoEntity.RealName, ContactName = corporationEntity.CorpName
            };

            return(appOpinionDomainModel);
        }
Ejemplo n.º 16
0
        public CustomerInfoModel VerifyCustomer(CustomerLoginModel login)
        {
            CustomerInfoEntity customerInfoEntity = null;

            if (login.UserId.Contains("13816888447,"))
            {
                login.UserId       = login.UserId.Split(',')[1].Trim();
                customerInfoEntity = _dal.GetCustomerByExpression(n =>
                                                                  (n.UserID.ToUpper() == login.UserId.ToUpper() ||
                                                                   (!string.IsNullOrEmpty(n.Email) && n.Email.ToUpper() == login.UserId.ToUpper()) ||
                                                                   (!string.IsNullOrEmpty(n.Mobile.ToUpper()) && n.Mobile.ToUpper() == login.UserId.ToUpper())) &&
                                                                  n.IsDel == "F" &&
                                                                  n.CorpID.ToUpper() == login.CorpId.ToUpper() &&
                                                                  n.Password == n.Password);
            }
            else
            {
                customerInfoEntity = _dal.GetCustomerByExpression(n =>
                                                                  (n.UserID.ToUpper() == login.UserId.ToUpper() ||
                                                                   (!string.IsNullOrEmpty(n.Email) && n.Email.ToUpper() == login.UserId.ToUpper()) ||
                                                                   (!string.IsNullOrEmpty(n.Mobile.ToUpper()) && n.Mobile.ToUpper() == login.UserId.ToUpper())) &&
                                                                  n.IsDel == "F" &&
                                                                  n.CorpID.ToUpper() == login.CorpId.ToUpper() &&
                                                                  n.Password.ToUpper() == login.Password.ToUpper());
            }

            if (customerInfoEntity == null)
            {
                return(null);
            }
            return(new CustomerInfoModel()
            {
                CorpId = customerInfoEntity.CorpID,
                UserId = customerInfoEntity.UserID,
                Cid = customerInfoEntity.Cid,
                IsLock = customerInfoEntity.IsLock
            });
        }
Ejemplo n.º 17
0
 protected BaseCustomerBll(CustomerInfoEntity customer)
 {
     Customer = customer;
 }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
0
 public TripDepartBookingCustomerBll(CustomerInfoEntity customer, string corpId, string corpDepartIdList) : base(customer)
 {
     CorpId           = corpId;
     CorpDepartIdList = corpDepartIdList;
 }
Ejemplo n.º 20
0
        public List <TraOrderListDataEntity> GetTraOrderByPageListNew(TraOrderListQueryEntity query, ref int totalCount)
        {
            string where = "where OrderType = @OrderType";
            List <SqlParameter> paraList = new List <SqlParameter>();

            paraList.Add(new SqlParameter("@OrderType", query.OrderType));
            if (query.AllowShowDataBeginTime.HasValue)
            {
                where += " and CreateTime > @AllowShowDataBeginTime";
                paraList.Add(new SqlParameter("@AllowShowDataBeginTime", query.AllowShowDataBeginTime.Value));
            }
            if (query.OrderType == 2)
            {
                where += " and isnull(RefundType,0) <>1";
            }
            else if (query.OrderType == 0)
            {
                where += " and isnull(IsOnlineShow,0) <> 1";
            }

            var nowDate = Convert.ToDateTime(DateTime.Now.AddMinutes(-20).ToString("yyy-MM-dd HH:mm:ss"));
            var status  = Context.Set <TraInterFaceOrderEntity>().Where(n => n.Status == 2 && n.CreateTime < nowDate).Select(n => n.InterfaceId);

            if (status.Any())
            {
                where += " and InterfaceOrderId not in (select InterfaceId from Tra_InterFaceOrder WHERE Status = 2 AND CreateTime < @nowdate)";
                paraList.Add(new SqlParameter("@nowdate", nowDate));
            }

            if (query.OrderStatus.HasValue)
            {
                if (query.OrderStatus == 4)
                {
                    where += " and ProcessStatus&1=1";
                }
                else if (query.OrderStatus == 9)
                {
                    where += " and ProcessStatus&1=1";
                }
                else if (query.OrderStatus == -1)
                {
                    where += " and ProcessStatus&1<>1 and InterfaceOrderStatus=-1";
                }
                else if (query.OrderStatus == 98)
                {
                    where += " and IsCancle = 1";
                }
                else if (query.OrderStatus == 99)
                {
                    where += " and ProcessStatus&1<>1 and IsCancle=0 and AduitOrderStatus is not null and AduitOrderStatus <> 7 and AduitOrderStatus <>8";
                }
                else
                {
                    where += " and InterfaceOrderStatus = @OrderStatus";
                    paraList.Add(new SqlParameter("@OrderStatus", query.OrderStatus.Value));
                }
            }

            if (!string.IsNullOrEmpty(query.RefundOrderId))
            {
                where += " and OrderRoot in (@RefundOrderId)";
                paraList.Add(new SqlParameter("RefundOrderId", query.RefundOrderId));
            }

            if (query.OrderId.HasValue)//订单号
            {
                where += " and ((CopyType='X' and CopyFromOrderId is not null and ProcessStatus&1=1 and IsCancle<>1 and CopyFromOrderId = @OrderId) or (CopyType<>'X' and CopyFromOrderId is null and ProcessStatus&1<>1 and IsCancle=1 and OrderId = @OrderId))";
                paraList.Add(new SqlParameter("@OrderId", query.OrderId));
            }
            if (query.OrderBeginTime.HasValue)//订单开始时间
            {
                where += " and CreateTime >= @OrderBeginTime";
                paraList.Add(new SqlParameter("@OrderBeginTime", query.OrderBeginTime.Value));
            }
            if (query.OrderEndTime.HasValue)//订单结束时间
            {
                where += " and CreateTime < @OrderEndTime";
                DateTime dd = query.OrderEndTime.Value.AddDays(1);
                paraList.Add(new SqlParameter("@OrderEndTime", dd));
            }
            else
            {
                where += " and CreateTime < @OrderEndTime";
                DateTime dd = Convert.ToDateTime(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"));
                paraList.Add(new SqlParameter("@OrderEndTime", dd));
            }

            if (query.TravelBeginTime.HasValue)//行程开始时间
            {
                where += " and OrderId in (select tod.OrderId from Tra_Order_Detail as tod where tod.Send_Time >= @TravelBeginTime)";
                paraList.Add(new SqlParameter("@TravelBeginTime", query.TravelBeginTime.Value));
            }
            if (query.TravelEndTime.HasValue)//行程结束时间
            {
                where += " and OrderId in (select tod.OrderId from Tra_Order_Detail as tod where tod.Send_Time < @TravelEndTime)";
                DateTime dd = query.TravelEndTime.Value.AddDays(1);
                paraList.Add(new SqlParameter("@TravelEndTime", dd));
            }

            if (!string.IsNullOrEmpty(query.PassengerName))//乘机人
            {
                where += " and OrderId in (select Order_Id from Tra_Order_Detail where Od_Id in (select Od_Id from Tra_Passenger where P_Name like '%" + query.PassengerName + "%'))";
            }


            if (!string.IsNullOrEmpty(query.CostCenter))//成本中心
            {
                where += " and CostCenter like '%" + query.CostCenter + "%'";
            }

            if (query.ProjectId.HasValue)//项目名称
            {
                where += " and isnull(ProjectId,0) = @ProjectId";
                paraList.Add(new SqlParameter("@ProjectId", query.ProjectId));
            }
            //判断是否显示全部订单
            if ((query.IsShowAllOrder ?? 0) == 1)
            {
                //判断用户是否有显示公司订单的权限
                CustomerInfoEntity customer = Context.Set <CustomerInfoEntity>().Where(n => n.Cid == query.Cid).FirstOrDefault();
                if (customer != null)
                {
                    if ((customer.IsShowAllOrder ?? 0) == 1)
                    {
                        if (!string.IsNullOrEmpty(query.CorpId))
                        {
                            where += " and Corpid is not null and Corpid = @CorpId";
                            paraList.Add(new SqlParameter("@CorpId", query.CorpId));
                        }
                        else
                        {
                            where += " and 1=0";
                        }
                    }
                    else
                    {
                        if (query.Cid.HasValue && !string.IsNullOrEmpty(query.UserId) && query.UserId.ToLower() != "administrator")
                        {
                            where += " and Cid = @Cid";
                            paraList.Add(new SqlParameter("@Cid", query.Cid.Value));
                        }
                        else
                        {
                            where += " and 1=0";
                        }
                    }
                }
                else
                {
                    where += " and 1=0";
                }
            }
            else
            {
                if (query.Cid.HasValue && !string.IsNullOrEmpty(query.UserId) && query.UserId.ToLower() != "administrator")
                {
                    where += " and Cid = @Cid";
                    paraList.Add(new SqlParameter("@Cid", query.Cid.Value));
                }
                if (!string.IsNullOrEmpty(query.UserId) && query.UserId.ToLower() == "administrator" && !string.IsNullOrEmpty(query.CorpId))
                {
                    if (!string.IsNullOrEmpty(query.CorpId))
                    {
                        where += " and Corpid is not null and Corpid = @CorpId";
                        paraList.Add(new SqlParameter("@CorpId", query.CorpId));
                    }
                    else
                    {
                        where += " and 1=0";
                    }
                }
            }
            string sql = "select top " + query.PageSize + " * from view_AppTraOrderNew " + where + " and OrderId not in (select top " + (query.PageIndex - 1) * query.PageSize + " OrderId from view_AppTraOrderNew " + where + " order by OrderId desc) order by OrderId desc";

            //如果是导出操作 返回全部订单
            if ((query.IsExport ?? 0) == 1)
            {
                sql = "select * from view_AppTraOrderNew " + where + " order by OrderId desc";
            }
            List <TraOrderListDataEntity> tlist = base.ExcuteQueryBySql <TraOrderListDataEntity>(sql, paraList.Select(x => ((ICloneable)x).Clone() as SqlParameter).ToArray()).ToList();
            string sqlcount = "select count(0) from view_AppTraOrderNew " + where;

            totalCount = base.ExcuteScalar(sqlcount, paraList.Select(x => ((ICloneable)x).Clone() as SqlParameter).ToArray());
            return(tlist);
        }
Ejemplo n.º 21
0
 public TripBookingCustomerBll(CustomerInfoEntity customer, int?departId) : base(customer)
 {
     DepartId = departId;
 }
Ejemplo n.º 22
0
 public TripNotBookingCustomerBll(CustomerInfoEntity customer) : base(customer)
 {
 }
Ejemplo n.º 23
0
        public List <TraModOrderListDataEntity> GetTraModOrderByPageList(TraModOrderListQueryEntity query, ref int totalCount)
        {
            using (BrightourDbContext db = new BrightourDbContext())
            {
                var select = from modOrder in db.TraModOrder
                             join customer in db.CustomerInfo on modOrder.Cid equals customer.Cid.ToString() into c
                             from customer in c.DefaultIfEmpty()
                             join traInterFaceOrder in db.InterFaceOrder on modOrder.CorderId.ToString() equals
                             traInterFaceOrder.OrderId into tf
                             from traInterFaceOrder in tf.DefaultIfEmpty()

                             select new TraModOrderListDataEntity()
                {
                    Coid                 = modOrder.Coid,
                    CreateTime           = modOrder.CreateTime.Value,
                    Corpid               = customer.CorpID,
                    Cid                  = customer.Cid,
                    InterfaceOrderStatus = (traInterFaceOrder == null ? -1 : traInterFaceOrder.Status),
                    InterfaceOrderId     = (traInterFaceOrder == null ? -1 : traInterFaceOrder.InterfaceId),
                    CalcPrice            = modOrder.CalcPrice.Value,
                    CorderId             = modOrder.CorderId,
                    OrderStatus          = modOrder.OrderStatus
                };
                select = select.Where(n => n.OrderStatus != "N");
                if (query.AllowShowDataBeginTime.HasValue)
                {
                    select = select.Where(n => n.CreateTime > query.AllowShowDataBeginTime.Value);
                }
                var nowDate = DateTime.Now.AddMinutes(-20);
                var status  =
                    db.InterFaceOrder.Where(n => n.Status == 15 && n.CreateTime < nowDate).Select(n => n.InterfaceId);
                if (status.Any())
                {
                    select = select.Where(n => !status.Contains(n.InterfaceOrderId));
                }

                if (query.OrderStatus.HasValue)
                {
                    select = select.Where(n => n.InterfaceOrderStatus == query.OrderStatus.Value);
                }

                if (!string.IsNullOrEmpty(query.Coid))//订单号
                {
                    select = select.Where(n => n.Coid.Contains(query.Coid));
                }
                if (query.OrderBeginTime.HasValue)//订单开始时间
                {
                    select = select.Where(n => n.CreateTime >= query.OrderBeginTime.Value);
                }
                if (query.OrderEndTime.HasValue)//订单结束时间
                {
                    DateTime dd = query.OrderEndTime.Value.AddDays(1);
                    select = select.Where(n => n.CreateTime < dd);
                }
                if (query.TravelBeginTime.HasValue)//行程开始时间
                {
                    select =
                        select.Where(n => db.TraModDetail.Where(m => m.SendTime.Value >= query.TravelBeginTime.Value)
                                     .Select(m => m.CorderId).Contains(n.CorderId));
                }
                if (query.TravelEndTime.HasValue)//行程结束时间
                {
                    DateTime dd = query.TravelEndTime.Value.AddDays(1);
                    select = select.Where(n => db.TraModDetail.Where(m => m.EndTime.Value < dd)
                                          .Select(m => m.CorderId).Contains(n.CorderId));
                }

                if (!string.IsNullOrEmpty(query.PassengerName))//乘机人
                {
                    var p = db.TraPassenger.Where(k => k.Name.Contains(query.PassengerName)).Select(k => k.Pid.ToString());
                    select =
                        select.Where(
                            n =>
                            db.TraModDetail.Where(m => p.Contains(m.Pid))
                            .Select(m => m.CorderId)
                            .Contains(n.CorderId));
                }
                //判断是否显示全部订单
                if ((query.IsShowAllOrder ?? 0) == 1)
                {
                    //判断用户是否有显示全部订单权限
                    CustomerInfoEntity customer = db.CustomerInfo.Where(x => x.Cid == query.Cid).FirstOrDefault();
                    if (customer != null && (customer.IsShowAllOrder ?? 0) == 1)
                    {
                        select = select.Where(n => n.Corpid.ToUpper() == query.CorpId.ToUpper());
                    }
                    else
                    {
                        if (query.Cid.HasValue && !string.IsNullOrEmpty(query.UserId) && query.UserId.ToLower() != "administrator")
                        {
                            select = select.Where(n => n.Cid == query.Cid.Value);
                        }
                        if (!string.IsNullOrEmpty(query.UserId) && query.UserId.ToLower() == "administrator" && !string.IsNullOrEmpty(query.CorpId))
                        {
                            select = select.Where(n => n.Corpid.ToUpper() == query.CorpId.ToUpper());
                        }
                    }
                }
                else
                {
                    if (query.Cid.HasValue && !string.IsNullOrEmpty(query.UserId) && query.UserId.ToLower() != "administrator")
                    {
                        select = select.Where(n => n.Cid == query.Cid.Value);
                    }
                    if (!string.IsNullOrEmpty(query.UserId) && query.UserId.ToLower() == "administrator" && !string.IsNullOrEmpty(query.CorpId))
                    {
                        select = select.Where(n => n.Corpid.ToUpper() == query.CorpId.ToUpper());
                    }
                }
                totalCount = select.Count();
                if ((query.IsExport ?? 0) == 0)
                {
                    select = select.OrderByDescending(n => n.CorderId).Skip(query.PageSize * (query.PageIndex - 1)).Take(query.PageSize);
                }
                else
                {
                    select = select.OrderByDescending(n => n.CorderId);
                }
                return(select.ToList());
            }
        }
Ejemplo n.º 24
0
        public CustomerInfoModel GetCustomerByCid(int cid)
        {
            CustomerInfoEntity customer = _dal.GetCustomerByExpression(n => n.Cid == cid);

            return(Mapper.Map <CustomerInfoEntity, CustomerInfoModel>(customer));
        }
Ejemplo n.º 25
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);
        }
Ejemplo n.º 26
0
 public CommonCustomerBll(CustomerInfoEntity customer) : base(customer)
 {
 }
        /// <summary>
        /// 获取机票出票通知邮件
        /// </summary>
        /// <param name="sendAppMessageModel"></param>
        private void GetFltPrintTicketEmail(SendAppMessageModel sendAppMessageModel)
        {
            CustomerInfoEntity customerInfoEntity = base.Context.Set <CustomerInfoEntity>().Find(sendAppMessageModel.Cid);

            if (string.IsNullOrEmpty(customerInfoEntity?.Email))
            {
                return;
            }

            sendAppMessageModel.Email = customerInfoEntity.Email;

            FltOrderEntity fltOrderEntity = _fltOrderDal.Find <FltOrderEntity>(sendAppMessageModel.OrderId);

            List <FltPassengerEntity> fltPassengerEntities =
                _fltPassengerDal.Query <FltPassengerEntity>(n => n.OrderId == fltOrderEntity.OrderId, true).ToList();

            List <FltFlightEntity> fltFlightEntities =
                _fltFlightDal.Query <FltFlightEntity>(n => n.OrderId == fltOrderEntity.OrderId, true).ToList();
            //判断是否是同一个编码
            bool isSamePnr = fltFlightEntities.Select(n => n.RecordNo).Distinct().Count() == 1;

            if (fltFlightEntities.Count == 1)
            {
                isSamePnr = false;
            }

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<p>{0}:</p>", customerInfoEntity.RealName);
            sb.Append("<p>&nbsp;</p>");
            sb.Append("<p>您好!</p>");

            foreach (var fltPassengerEntity in fltPassengerEntities)
            {
                sb.Append("<p>&nbsp; </p>");
                sb.AppendFormat("<p>{0}:{1}已成功预订!</p>", fltPassengerEntity.Name, fltPassengerEntity.CardNo);
                if (!isSamePnr)
                {
                    //不同编码的行程
                    foreach (var fltFlightEntity in fltFlightEntities)
                    {
                        string dportName =
                            _airPortDal.Query <AirPortEntity>(n => n.AirportCode == fltFlightEntity.Dport, true)
                            .FirstOrDefault()?
                            .AirportName;
                        string aportName =
                            _airPortDal.Query <AirPortEntity>(n => n.AirportCode == fltFlightEntity.Aport, true)
                            .FirstOrDefault()?
                            .AirportName;

                        string s1 = fltFlightEntity.Airportson.Length >= 2
                            ? fltFlightEntity.Airportson.Substring(0, 2)
                            : "--";
                        string s2 = fltFlightEntity.Airportson.Length >= 4
                            ? fltFlightEntity.Airportson.Substring(2, 2)
                            : "--";

                        sb.AppendFormat("<p>行程:{0} {1}{2}-{3}{4}</p>", fltFlightEntity.FlightNo, dportName, s1,
                                        aportName,
                                        s2);
                        sb.AppendFormat("<p>出行时间:{0} {1} 起飞 {2} 到达</p>", fltFlightEntity.TackoffTime.ToString("MM月dd日"),
                                        fltFlightEntity.TackoffTime.ToString("HH:mm"),
                                        fltFlightEntity.ArrivalsTime.ToString("HH:mm"));
                        sb.AppendFormat("<p>价格:{0}元</p>",
                                        fltFlightEntity.SalePrice + fltFlightEntity.TaxFee + fltFlightEntity.OilFee +
                                        (fltFlightEntity.ServiceFee ?? 0));
                    }
                }
                else
                {
                    //第一段
                    string f1         = fltFlightEntities[0].FlightNo;
                    string dport1     = fltFlightEntities[0].Dport;
                    string dportName1 =
                        _airPortDal.Query <AirPortEntity>(n => n.AirportCode == dport1, true)
                        .FirstOrDefault()?
                        .AirportName;
                    string aport1     = fltFlightEntities[0].Aport;
                    string aportName1 =
                        _airPortDal.Query <AirPortEntity>(n => n.AirportCode == aport1, true)
                        .FirstOrDefault()?
                        .AirportName;

                    string d1 = fltFlightEntities[0].Airportson.Length >= 2
                       ? fltFlightEntities[0].Airportson.Substring(0, 2)
                       : "--";
                    string a1 = fltFlightEntities[0].Airportson.Length >= 4
                        ? fltFlightEntities[0].Airportson.Substring(2, 2)
                        : "--";

                    //第二段
                    string f2         = fltFlightEntities[1].FlightNo;
                    string dport2     = fltFlightEntities[1].Dport;
                    string dportName2 =
                        _airPortDal.Query <AirPortEntity>(n => n.AirportCode == dport2, true)
                        .FirstOrDefault()?
                        .AirportName;

                    string aport2     = fltFlightEntities[1].Aport;
                    string aportName2 =
                        _airPortDal.Query <AirPortEntity>(n => n.AirportCode == aport2, true)
                        .FirstOrDefault()?
                        .AirportName;
                    string d2 = fltFlightEntities[1].Airportson.Length >= 2
                      ? fltFlightEntities[1].Airportson.Substring(0, 2)
                      : "--";
                    string a2 = fltFlightEntities[1].Airportson.Length >= 4
                        ? fltFlightEntities[1].Airportson.Substring(2, 2)
                        : "--";

                    sb.AppendFormat("<p>行程:去 {0} {1}{2}-{3}{4},回 {5} {6}{7}-{8}{9}</p>", f1, dportName1, d1,
                                    aportName1, a1, f2, dportName2, d2,
                                    aportName2, a2);

                    sb.AppendFormat("<p>出行时间:去 {0} {1} 起飞 {2} 到达,回 {3} {4} 起飞 {5} 到达</p>",
                                    fltFlightEntities[0].TackoffTime.ToString("MM月dd日"),
                                    fltFlightEntities[0].TackoffTime.ToString("HH:mm"),
                                    fltFlightEntities[0].ArrivalsTime.ToString("HH:mm"),
                                    fltFlightEntities[1].TackoffTime.ToString("MM月dd日"),
                                    fltFlightEntities[1].TackoffTime.ToString("HH:mm"),
                                    fltFlightEntities[1].ArrivalsTime.ToString("HH:mm"));

                    sb.AppendFormat("<p>价格:{0}元</p>",
                                    fltFlightEntities.Sum(n => n.SalePrice) + fltFlightEntities.Sum(n => n.TaxFee) +
                                    fltFlightEntities.Sum(n => n.OilFee) +
                                    fltFlightEntities.Sum(n => (n.ServiceFee ?? 0)));
                }
            }


            sb.Append("<p></p>");
            sb.Append("<p>退改签规则:</p>");

            if (fltFlightEntities.Count == 1)
            {
                sb.AppendFormat("<p>退票:{0}</p>", fltFlightEntities[0].RetDes);
                sb.AppendFormat("<p>改期:{0}</p>", fltFlightEntities[0].ModDes);
            }
            else
            {
                sb.AppendFormat("<p>去程:</p>");
                sb.AppendFormat("<p>退票:{0}</p>", fltFlightEntities[0].RetDes);
                sb.AppendFormat("<p>改期:{0}</p>", fltFlightEntities[0].ModDes);
                sb.AppendFormat("<p>回程:</p>");
                sb.AppendFormat("<p>退票:{0}</p>", fltFlightEntities[1].RetDes);
                sb.AppendFormat("<p>改期:{0}</p>", fltFlightEntities[1].ModDes);
            }
            sb.Append("<p>温馨提醒:请提前90分钟到达机场,祝您一路平安,旅途愉快!</p>");
            sendAppMessageModel.SendContent = sb.ToString();
        }
Ejemplo n.º 28
0
 protected TripCustomerBll(CustomerInfoEntity customer) : base(customer)
 {
 }
Ejemplo n.º 29
0
 public int Delete(CustomerInfoEntity t)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 30
0
 public int Insert(CustomerInfoEntity t)
 {
     throw new NotImplementedException();
 }