public static DataTransferObject.Order.FlightView GetOrderFlightView(DataTransferObject.FlightQuery.FlightView flightView) { return(new DataTransferObject.Order.FlightView { SerialNo = flightView.Serial, Airline = flightView.AirlineCode, FlightNo = flightView.FlightNo, Departure = flightView.Departure.Code, Arrival = flightView.Arrival.Code, AirCraft = flightView.Aircraft, TakeoffTime = flightView.Departure.Time, LandingTime = flightView.Arrival.Time, YBPrice = flightView.YBPrice, Bunk = flightView.BunkCode, Fare = flightView.Fare, Type = flightView.BunkType == null ? BunkType.Economic : flightView.BunkType.Value, IsShare = flightView.IsShare, DepartureTerminal = flightView.Departure.Terminal, ArrivalTerminal = flightView.Arrival.Terminal }); }
private static DataTransferObject.FlightQuery.FlightView GetFlightView(Segment flightView) { var airline = Service.FoundationService.QueryAirline(flightView.AirlineCode); if (airline == null) { throw new CustomException("暂不支持航空公司 " + flightView.AirlineCode); } var basicPrice = Service.FoundationService.QueryBasicPrice(airline.Code.Value, flightView.AirportPair.Departure, flightView.AirportPair.Arrival, flightView.Date); if (basicPrice == null) { throw new CustomException("系统中无运价信息"); } var bafView = Service.FoundationService.QueryBAF(airline.Code.Value, basicPrice.Mileage); var result = new DataTransferObject.FlightQuery.FlightView { AirlineCode = airline.Code.Value, AirlineName = airline.ShortName, FlightNo = flightView.InternalNo, Aircraft = flightView.AircraftType, Departure = getAirportView(flightView.AirportPair.Departure, flightView.TerminalOfDeparture, flightView.Date, flightView.DepartureTime), Arrival = getAirportView(flightView.AirportPair.Arrival, flightView.TerminalOfArrival, flightView.Date, flightView.ArrivalTime), YBPrice = basicPrice.Price, AirportFee = Service.FoundationService.QueryAirportFee(flightView.AircraftType), BAF = bafView.Adult, AdultBAF = bafView.Adult, ChildBAF = bafView.Child, BunkCode = flightView.CabinSeat, SeatCount = flightView.SeatCount, IsShare = flightView.IsShared }; result.Arrival.Time = result.Arrival.Time.AddDays(flightView.AddDays); return(result); }
private static void setBunkInfo(DataTransferObject.FlightQuery.FlightView flightView, VoyageTypeValue voyageType, PassengerTypeValue passengerType, TravelTypeValue travelType) { var bunks = Service.FoundationService.QueryBunk(flightView.AirlineCode, flightView.Departure.Code, flightView.Arrival.Code, flightView.Departure.Time.Date, flightView.BunkCode, voyageType, travelType, passengerType); //更改退改签规定数据源 var pattern = new Regex("^[a-zA-Z\\d/]+$"); var refundDetail = FoundationService.QueryDetailList(flightView.AirlineCode, flightView.BunkCode).Where(item => pattern.IsMatch(item.Bunks)); string refundRegulation = string.Empty; string changeRegulation = string.Empty; string endorseRegulation = string.Empty; string remark = string.Empty; foreach (var item in refundDetail) { refundRegulation += "航班起飞前:" + item.ScrapBefore + ";航班起飞后:" + item.ScrapAfter; changeRegulation += "航班起飞前:" + item.ChangeBefore + ";航班起飞后:" + item.ChangeAfter; endorseRegulation += item.Endorse; remark = item.Remark.Replace(" ", "").Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", ""); } if (string.IsNullOrWhiteSpace(refundRegulation)) { refundRegulation = "以航司具体规定为准"; } if (string.IsNullOrWhiteSpace(changeRegulation)) { changeRegulation = "以航司具体规定为准"; } foreach (var item in bunks) { item.RefundRegulation = refundRegulation; item.ChangeRegulation = changeRegulation; item.EndorseRegulation = endorseRegulation; item.Remarks = remark; } var bunk = chooseBunk(bunks, voyageType); if (bunk != null) { flightView.EI = bunk.EI; flightView.BunkType = bunk.Type; // 明折明扣舱 var generalBunk = bunk as Service.Foundation.Domain.GeneralBunk; if (generalBunk != null) { var adultDiscount = generalBunk.GetDiscount(flightView.BunkCode); var adultFare = Utility.Calculator.Round(flightView.YBPrice * adultDiscount, 1); if (passengerType == PassengerTypeValue.Child) { flightView.Discount = Utility.Calculator.Round(adultDiscount / 2, -3); flightView.Fare = Utility.Calculator.Round(adultFare / 2, 1); } else { flightView.Discount = adultDiscount; flightView.Fare = adultFare; } var firstBusinessBunk = generalBunk as Service.Foundation.Domain.FirstBusinessBunk; if (firstBusinessBunk != null) { flightView.BunkDescription = firstBusinessBunk.Description; } return; } // 特价舱 var promotionBunk = bunk as Service.Foundation.Domain.PromotionBunk; if (promotionBunk != null) { flightView.BunkDescription = promotionBunk.Description; return; } // 免票舱 var freeBunk = bunk as Service.Foundation.Domain.FreeBunk; if (freeBunk != null) { flightView.BunkDescription = freeBunk.Description; return; } // 往返产品舱、联程舱、团队舱 if (bunk is Service.Foundation.Domain.ProductionBunk || bunk is Service.Foundation.Domain.TransferBunk || bunk is Service.Foundation.Domain.TeamBunk) { return; } throw new CustomException("不支持该舱位导入"); } throw new CustomException("未获取到支持该行程的相关舱位信息"); }