Example #1
0
        /// <summary>
        /// 获取火车下单页面预设信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ResponseBaseViewModel <ConfirmTraOrderResponseViewModel> ConfirmOrderView([FromBody] ConfirmTraOrderRequestViewModel request)
        {
            if (request == null)
            {
                request = new ConfirmTraOrderRequestViewModel();
            }
            request.Cid         = this.GetCid();
            request.Oid         = this.GetOid();
            request.OrderSource = this.GetOrderSource();
            ConfirmTraOrderResponseViewModel responseViewModel =
                _confirmTraOrderViewApplication.GetTraComfireOrderView(request);

            ResponseBaseViewModel <ConfirmTraOrderResponseViewModel> v =
                new ResponseBaseViewModel <ConfirmTraOrderResponseViewModel>
            {
                Flag = new ResponseCodeViewModel()
                {
                    Code = 0, MojoryToken = this.GetToken()
                },
                Data = responseViewModel
            };

            return(v);
        }
        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);
        }