コード例 #1
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);
        }
コード例 #2
0
        public bool UpdateTripNumberInfo(List <string> tripNumberList, string ticketNumber, EnumTripStatus tripStatus, string useOffice, string iataCode, string ticketCompanyName)
        {
            bool IsUpdate = false;

            if (tripNumberList == null || tripNumberList.Count == 0)
            {
                throw new OrderCommException("需要修改的行程单数据不能为空!");
            }
            var result = m_travelPaperRepository.FindAll(p => tripNumberList.Contains(p.TripNumber)).ToList();

            if (result.Count > 0)
            {
                result.ForEach(p =>
                {
                    TravelPaper travelPaper = p;
                    if (travelPaper != null)
                    {
                        string tripNumber   = p.TripNumber;
                        StringBuilder sbCon = new StringBuilder();
                        if (!string.IsNullOrEmpty(ticketNumber) && ticketNumber != travelPaper.TicketNumber)
                        {
                            travelPaper.TicketNumber = ticketNumber;
                            sbCon.AppendFormat("原票号:{0} 新票号:{1},", travelPaper.TicketNumber, tripNumber);
                        }
                        if (tripStatus != travelPaper.TripStatus)
                        {
                            travelPaper.TripStatus = tripStatus;
                            sbCon.AppendFormat("原状态:{0} 新状态:{1},", EnumItemManager.GetDesc(travelPaper.TripStatus), EnumItemManager.GetDesc(tripStatus));
                        }
                        if (!string.IsNullOrEmpty(useOffice) && useOffice != travelPaper.UseOffice)
                        {
                            travelPaper.UseOffice = useOffice;
                            sbCon.AppendFormat("原Office号:{0} 新Office号:{1},", travelPaper.UseOffice, useOffice);
                        }
                        if (!string.IsNullOrEmpty(iataCode) && iataCode != travelPaper.IataCode)
                        {
                            travelPaper.IataCode = iataCode;
                            sbCon.AppendFormat("原航协号:{0} 新航协号:{1},", travelPaper.IataCode, iataCode);
                        }
                        if (!string.IsNullOrEmpty(ticketCompanyName) && ticketCompanyName != travelPaper.TicketCompanyName)
                        {
                            travelPaper.TicketCompanyName = ticketCompanyName;
                            sbCon.AppendFormat("原填开单位:{0} 新填开单位:{1},", travelPaper.TicketCompanyName, ticketCompanyName);
                        }
                        travelPaper.WriteLog(new TravelPaperLog()
                        {
                            OperationType     = "修改",
                            OperationPerson   = currentUser.OperatorAccount,
                            OperationDatetime = System.DateTime.Now,
                            OperationContent  = sbCon.ToString()
                        });
                        unitOfWorkRepository.PersistUpdateOf(travelPaper);
                    }
                });
                //提交
                unitOfWork.Commit();
                IsUpdate = true;
            }
            else
            {
                throw new OrderCommException("未能查到行程单数据!");
            }
            return(IsUpdate);
        }