public ConfirmTraOrderResponseViewModel GetTraComfireOrderView(ConfirmTraOrderRequestViewModel request)
        {
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            ConfirmTraOrderResponseViewModel v = new ConfirmTraOrderResponseViewModel();

            v.CName    = customerModel.RealName;
            v.EMail    = customerModel.Email;
            v.IsMaster = customerModel.IsMaster;
            v.Mobile   = customerModel.Mobile;
            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                CorporationModel corporationModel = _getCorpServiceBll.GetCorp(customerModel.CorpID);
                v.IsPrint = corporationModel.IsPrint ?? 0;

                //服务费
                ServiceFeeInfoModel serviceFeeInfoModel = _getServiceFeeServiceBll.GetServiceFeeByCorpId(customerModel.CorpID, corporationModel.SfcId ?? 0);
                v.ServiceFee = serviceFeeInfoModel.TrainServiceFee;
                v.TrainGrabTicketServiceFee = serviceFeeInfoModel.TrainGrabTicketServiceFee;

                //获取成本中心
                List <CostCenterModel> costCenterModels =
                    _getCostCenterServiceBll.GetCostCenterByNoDelete(customerModel.CorpID);
                v.CostCenterList = Mapper.Map <List <CostCenterModel>, List <CostCenterViewModel> >(costCenterModels);
            }
            else
            {
                ServiceFeeInfoModel serviceFeeInfoModel = _getServiceFeeServiceBll.GetServiceFeeBySfcid(customerModel.SfcId ?? 0);
                v.ServiceFee = serviceFeeInfoModel.TrainServiceFee;
                v.TrainGrabTicketServiceFee = serviceFeeInfoModel.TrainGrabTicketServiceFee;
            }

            #region 项目名称
            List <ProjectNameModel> projectNameModels = _getProjectNameServiceBll.GetProjectNameByNotDelete(request.Cid);
            v.ProjectNameList = Mapper.Map <List <ProjectNameModel>, List <ProjectNameViewModel> >(projectNameModels);
            #endregion

            #region 证件类型
            v.CardTypeList = (from n in EnumConvert.QueryEnum <CardTypeEnum>()
                              select new SortedListViewModel()
            {
                Key = n.Key,
                Value = n.Value
            }).ToList();
            #endregion

            #region 配送方式
            v.SendTicketTypeList = (from sendTicket in EnumConvert.QueryEnum <SendTicketTypeEnum>()
                                    where sendTicket.Key != (int)SendTicketTypeEnum.Air
                                    select new SortedListViewModel()
            {
                Key = sendTicket.Key,
                Value = sendTicket.Value
            }).ToList();
            #endregion

            #region 12306帐号
            List <Tra12306AccountModel> accountModels = _get12306AccountServiceBll.GetTra12306Account();
            v.AccountList = (from n in accountModels
                             select new SortedListViewModel()
            {
                Key = n.PassId,
                Value = n.UserName
            }).ToList();
            #endregion

            #region 支付方式

            v.PayTypeList = new List <SortedListViewModel>
            {
                new SortedListViewModel()
                {
                    Key   = PayTypeEnum.Cas.ToString(),
                    Value = PayTypeEnum.Cas.ToDescription()
                },
                new SortedListViewModel()
                {
                    Key   = PayTypeEnum.Chk.ToString(),
                    Value = PayTypeEnum.Chk.ToDescription()
                }
            };
            if (!string.IsNullOrEmpty(customerModel.CorpID))
            {
                v.PayTypeList.Add(new SortedListViewModel()
                {
                    Key   = PayTypeEnum.Cro.ToString(),
                    Value = PayTypeEnum.Cro.ToDescription()
                });
            }

            #endregion

            List <ContactAddressModel> contactAddressModels =
                _getContactAddressServiceBll.GetContactAddressByCid(request.Cid);
            if (contactAddressModels != null && contactAddressModels.Count > 0)
            {
                v.AddressList = contactAddressModels.Select(n => n.Address).ToList();
            }

            return(v);
        }
Example #2
0
        public ServiceFeeInfoModel GetServiceFeeBySfcid(int sfcId)
        {
            ServiceFeeInfoModel serviceFeeInfoModel = new ServiceFeeInfoModel();

            if (sfcId == 0)
            {
                return(serviceFeeInfoModel);
            }

            List <ServiceFeeConfigDetailsEntity> serviceFeeConfigDetailsModels =
                _serviceFeeConfigDetailsDal.Query <ServiceFeeConfigDetailsEntity>(n => n.SfcId == sfcId, true).ToList();

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


            //判断当前时间中是否存在服务费
            DateTime nowTime = DateTime.Now;
            string   nowDate = nowTime.ToString("yyyy-MM-dd");

            foreach (var detail in serviceFeeConfigDetailsModels)
            {
                try
                {
                    if (nowTime > Convert.ToDateTime(nowDate + " " + detail.BeginTime) &&
                        nowTime < Convert.ToDateTime(nowDate + " " + detail.EndTime))
                    {
                        if (detail.TrainServiceFee.HasValue)
                        {
                            serviceFeeInfoModel.TrainServiceFee = detail.TrainServiceFee.Value;
                        }
                        if (detail.TrainGrabTicketServiceFee.HasValue)
                        {
                            serviceFeeInfoModel.TrainGrabTicketServiceFee = detail.TrainGrabTicketServiceFee.Value;
                        }
                        if (detail.HotelServiceFee.HasValue)
                        {
                            serviceFeeInfoModel.HotelServiceFee = detail.HotelServiceFee.Value;
                        }
                        if (detail.NightServicefee.HasValue)
                        {
                            serviceFeeInfoModel.NightServicefee = detail.NightServicefee.Value;
                        }
                        if (detail.ServiceFee.HasValue)
                        {
                            serviceFeeInfoModel.ServiceFee = detail.ServiceFee.Value;
                        }
                        if (detail.NightServicefeeRate.HasValue)
                        {
                            serviceFeeInfoModel.NightServicefeeRate = detail.NightServicefeeRate.Value;
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }

            return(serviceFeeInfoModel);
        }