Esempio n. 1
0
        public static ResponseAfterSaleOrder ToResponseAfterSaleOrder(this AfterSaleOrder p)
        {
            var model       = Mapper.Map <AfterSaleOrder, ResponseAfterSaleOrder>(p);
            var currentUser = AuthManager.GetCurrentUser();

            if (!string.IsNullOrEmpty(currentUser.Type) && currentUser.Type != "Buyer")
            {
                if (!(p is ChangeOrder))
                {
                    model.Money = model.SMoney;
                }
                if (p.Order.CarrierCode != AuthManager.GetCurrentUser().Code)
                {
                    model.TotalMoney = p.AfterCPMoney;
                }
            }
            return(model);
        }
Esempio n. 2
0
        public TravelAppResponse VoidTrip(BPiaoBao.AppServices.DataContracts.DomesticTicket.TravelAppRequrst req)
        {
            TravelAppResponse response = new TravelAppResponse();

            try
            {
                FlightService flightDestineService = new FlightService(this.m_businessmanRepository, currentUser);
                response = flightDestineService.VoidTrip(req);
                if (response.IsSuc)
                {
                    if (response.PnrAnalysisTripNumber.Trim() != req.TripNumber.Trim())
                    {
                        response.IsSuc = false;
                    }
                    else
                    {
                        if (req.Flag == 0)
                        {
                            //更改状态
                            Order       order       = this.orderRepository.FindAll(p => p.OrderId == req.OrderId).FirstOrDefault();
                            TravelPaper travelPaper = this.m_travelPaperRepository.FindAll(p => p.TripNumber == req.TripNumber).FirstOrDefault();
                            if (order != null && travelPaper != null)
                            {
                                order.Passengers.Each(p =>
                                {
                                    if (p.Id == req.PassengerId)
                                    {
                                        p.PassengerTripStatus = EnumPassengerTripStatus.HasVoid;
                                    }
                                });
                                travelPaper.OrderId     = req.OrderId;
                                travelPaper.PassengerId = req.PassengerId;
                                travelPaper.TripStatus  = EnumTripStatus.HasObsoleteUsed;
                                travelPaper.InvalidTime = System.DateTime.Now;
                                string strLog = "行程单号:" + response.TripNumber + "票号:" + response.TicketNumber + " Office:" + response.CreateOffice + " " + response.ShowMsg;
                                travelPaper.WriteLog(new TravelPaperLog()
                                {
                                    OperationContent  = strLog,
                                    OperationType     = "作废行程单",
                                    OperationDatetime = System.DateTime.Now,
                                    OperationPerson   = currentUser.OperatorAccount
                                });
                                order.OrderLogs.Add(new OrderLog()
                                {
                                    OperationContent  = strLog,
                                    OperationDatetime = System.DateTime.Now,
                                    OperationPerson   = currentUser.OperatorAccount,
                                    IsShowLog         = true
                                });
                                unitOfWorkRepository.PersistUpdateOf(order);
                                unitOfWorkRepository.PersistUpdateOf(travelPaper);
                                unitOfWork.Commit();
                            }
                        }
                        else
                        {
                            //更改状态
                            int            id          = int.Parse(req.OrderId);
                            AfterSaleOrder order       = this.AfterSaleorderRepository.FindAll(p => p.Id == id).FirstOrDefault();
                            TravelPaper    travelPaper = this.m_travelPaperRepository.FindAll(p => p.TripNumber == req.TripNumber).FirstOrDefault();
                            if (order != null && travelPaper != null)
                            {
                                order.Passenger.Each(p =>
                                {
                                    if (p.Id == req.PassengerId)
                                    {
                                        p.PassengerTripStatus = EnumPassengerTripStatus.HasVoid;
                                    }
                                });
                                travelPaper.OrderId     = req.OrderId;
                                travelPaper.PassengerId = req.PassengerId;
                                travelPaper.TripStatus  = EnumTripStatus.HasObsoleteUsed;
                                travelPaper.InvalidTime = System.DateTime.Now;
                                string strLog = "改签行程单号:" + response.TripNumber + "改签票号:" + response.TicketNumber + " 改签Office:" + response.CreateOffice + " " + response.ShowMsg;
                                travelPaper.WriteLog(new TravelPaperLog()
                                {
                                    OperationContent  = strLog,
                                    OperationType     = "作废改签行程单",
                                    OperationDatetime = System.DateTime.Now,
                                    OperationPerson   = currentUser.OperatorAccount
                                });
                                order.Order.OrderLogs.Add(new OrderLog()
                                {
                                    OperationContent  = strLog,
                                    OperationDatetime = System.DateTime.Now,
                                    OperationPerson   = currentUser.OperatorAccount,
                                    IsShowLog         = true
                                });
                                unitOfWorkRepository.PersistUpdateOf(order);
                                unitOfWorkRepository.PersistUpdateOf(travelPaper);
                                unitOfWork.Commit();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new CustomException(111, ex.Message);
            }
            return(response);
        }