private static void setBunkInfo(FlightView flightView, VoyageTypeValue voyageType, PassengerTypeValue passengerType, TravelTypeValue travelType, PriceView patPrice)
        {
            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).Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
                changeRegulation  += ("航班起飞前:" + item.ChangeBefore + ";航班起飞后:" + item.ChangeAfter).Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
                endorseRegulation += item.Endorse.Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
                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, flightView.YBPrice, patPrice);

            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("未获取到支持该行程的相关舱位信息");
        }
Exemple #2
0
 /// <summary>
 /// 查询舱位信息
 /// </summary>
 /// <param name="airline">航空公司代码</param>
 /// <param name="departure">出发机场代码</param>
 /// <param name="arrival">到达机场代码</param>
 /// <param name="flightDate">航班日期</param>
 /// <param name="bunkCode">舱位代码</param>
 /// <param name="itineraryType">行程类型</param>
 /// <param name="travelType">旅行类型</param>
 /// <param name="passengerType">旅客类型</param>
 public static IEnumerable <Bunk> QueryBunk(string airline, string departure, string arrival, DateTime flightDate, string bunkCode,
                                            VoyageTypeValue itineraryType, TravelTypeValue travelType, PassengerTypeValue passengerType)
 {
     return(BunkCollection.Instance.QueryBunk(airline, departure, arrival, flightDate, bunkCode, itineraryType, travelType, passengerType));
 }
Exemple #3
0
 /// <summary>
 /// 查询舱位信息
 /// </summary>
 /// <param name="airline">航空公司</param>
 /// <param name="departure">出发</param>
 /// <param name="arrival">到达</param>
 /// <param name="flightDate">航班日期</param>
 /// <param name="code">舱位代码</param>
 /// <param name="itineraryType">行程类型</param>
 /// <param name="travelType">旅行类型</param>
 /// <param name="passengerType">旅客类型</param>
 public IEnumerable <Bunk> QueryBunk(UpperString airline, UpperString departure, UpperString arrival, DateTime flightDate, UpperString code,
                                     VoyageTypeValue itineraryType, TravelTypeValue travelType, PassengerTypeValue passengerType)
 {
     return(QueryBunk(airline, departure, arrival, flightDate, code).Where(bunk => bunk != null &&
                                                                           (bunk.VoyageType & itineraryType) == itineraryType &&
                                                                           (bunk.PassengerType & passengerType) == passengerType &&
                                                                           (bunk.TravelType & travelType) == travelType).ToList());
     //var bunk = QueryBunk(airline, departure, arrival, flightDate, code);
     //if(bunk != null
     //    && (bunk.VoyageType & itineraryType) == itineraryType
     //    && (bunk.PassengerType & passengerType) == passengerType
     //    && (bunk.TravelType & travelType) == travelType) {
     //    return bunk;
     //}
     //return null;
 }