コード例 #1
0
        /// <summary>
        /// 根据PAT文本内容,获取价格信息。
        /// </summary>
        /// <param name="str">文本内容</param>
        /// <returns>价格列表</returns>
        internal static List <PriceView> GetPNRPrices(string str)
        {
            // 如果中间有换行,这里将无法处理,所以再替换一下,把所有的分号再替换回来;
            str = Regex.Replace(str, ";", "");

            List <PriceView> prices          = null;
            Regex            pattern         = new Regex(RegexUtil.PATCmdRegex);
            MatchCollection  matchCollection = pattern.Matches(str);

            if (matchCollection.Count > 0)
            {
                prices = new List <PriceView>();
                PriceView price = null;
                foreach (Match match in matchCollection)
                {
                    price      = new PriceView();
                    price.Fare = decimal.Parse(match.Groups["Fare"].Value);
                    if (!string.IsNullOrEmpty(match.Groups["AirportTax"].Value))
                    {
                        price.AirportTax = decimal.Parse(match.Groups["AirportTax"].Value);
                    }
                    else
                    {
                        price.AirportTax = 0;
                    }

                    price.BunkerAdjustmentFactor = decimal.Parse(match.Groups["BunkerAdjustmentFactor"].Value);
                    price.Total = decimal.Parse(match.Groups["Total"].Value);
                    prices.Add(price);
                }
            }

            return(prices);
        }
コード例 #2
0
        private void OnDoubleClick(object sender, RoutedEventArgs e)
        {
            var       item = assortmentGrid.SelectedValue as Item;
            PriceView view = new PriceView(new PriceViewModel
            {
                Id    = item.Id,
                Price = item.Price
            });

            view.Show();
        }
コード例 #3
0
ファイル: CartService.cs プロジェクト: dKluev/Site
        public void UpdateOrder(string customerType)
        {
            var order = OrderService.GetCurrentOrder();

            if (order == null)
            {
                return;
            }
//            var newPriceTypePart = PriceTypes.GetByCustomerType(customerType);

            /*         string prevPriceTypePart;
             *       if (order.CustomerType == null)
             *           prevPriceTypePart = newPriceTypePart;*/
//            var prevPriceTypePart = PriceTypes.GetByCustomerType(
//                OrderCustomerType.GetOpposite(customerType));
            order.CustomerType = customerType;
            if (customerType == OrderCustomerType.PrivatePerson)
            {
                /*      order.NumberOfStudents = null;
                 *    order.StudentFIOs = null;*/
            }

            var forDelete = new List <decimal>();

            foreach (var orderDetail in order.OrderDetails.Where(x => !x.IsTestCert))
            {
                if (orderDetail.Group_ID.HasValue)
                {
                    orderDetail.PriceType_TC = OrderService.GetPriceTypeForGroup(
                        orderDetail.Group,
                        PriceTypes.IsBusiness(orderDetail.PriceType_TC),
                        order.CustomerType);
                }
                else
                {
                    orderDetail.PriceType_TC = null;
                }

                var prices = PriceService
                             .GetAllPricesForCourseFilterByCustomerTye(orderDetail.Course_TC,
                                                                       order.CustomerType, orderDetail.Track_TC).AsQueryable();

                PriceView price = null;
                if (orderDetail.PriceType_TC != null)
                {
                    price = prices
                            .FirstOrDefault(p => p.PriceType_TC == orderDetail.PriceType_TC);
                }

                if (price != null)
                {
                    orderDetail.Price = price.Price;
                }
                else
                {
                    var maxPrice = prices.GetDefault();
                    if (maxPrice == null)
                    {
                        forDelete.Add(orderDetail.OrderDetailID);
                    }
                    else
                    {
                        orderDetail.Price        = maxPrice.Price;
                        orderDetail.PriceType_TC = maxPrice.PriceType_TC;
                    }
                }
            }
            foreach (var forDeleteId in forDelete)
            {
                order.OrderDetails.Remove(order.OrderDetails.First(x => x.OrderDetailID == forDeleteId));
            }
            OrderService.SubmitChanges();
            UpdateDiscount(true);
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="segments"></param>
        /// <param name="itineraryType"></param>
        /// <param name="passengerType"></param>
        /// <param name="isTeam"></param>
        /// <param name="patPrice">在双重类型的仓位上用户区分仓位类型,null的情况下只会选择普通类型</param>
        /// <returns></returns>
        public static IEnumerable <DataTransferObject.FlightQuery.FlightView> GetQueryFlightView(IEnumerable <Segment> segments,
                                                                                                 ItineraryType itineraryType, PassengerType passengerType, bool isTeam, PriceView patPrice)
        {
            var index              = 1;
            var result             = segments.Select(s => GetFlightView(s, passengerType)).OrderBy(item => item.Departure.Time).ToList();
            var voyageType         = GetVoyageTypeValue(itineraryType, result.Count);
            var passengerTypeValue = passengerType == PassengerType.Child ? PassengerTypeValue.Child : PassengerTypeValue.Adult;
            var travelTypeValue    = isTeam ? TravelTypeValue.Team : TravelTypeValue.Individual;

            result.ForEach(item => {
                item.Serial = index++;
                setBunkInfo(item, voyageType, passengerTypeValue, travelTypeValue, patPrice);
            });
            CheckFlights(result, itineraryType);
            return(result);
        }
コード例 #5
0
        private static Bunk chooseBunk(IEnumerable <Bunk> bunks, VoyageTypeValue voyageType, decimal YBPrice, PriceView price)
        {
            if (bunks.Any(b => b is Service.Foundation.Domain.GeneralBunk) &&
                bunks.Any(b => b is Service.Foundation.Domain.PromotionBunk))
            {
                var generalBunk = bunks.FirstOrDefault(b => b is GeneralBunk) as GeneralBunk;
                if (price == null)
                {
                    return(generalBunk);
                }
                decimal nomalPrice = Utility.Calculator.Round(generalBunk.GetDiscount(generalBunk.Code.Value) * YBPrice, 1);
                if (price.Fare >= nomalPrice)
                {
                    return(generalBunk);
                }
                return(bunks.FirstOrDefault(b => b is PromotionBunk));
            }
            if (bunks.Count() < 2)
            {
                return(bunks.FirstOrDefault());
            }
            switch (voyageType)
            {
            case VoyageTypeValue.OneWay:
                var generalBunk = bunks.FirstOrDefault(b => b is Service.Foundation.Domain.GeneralBunk);
                if (generalBunk == null)
                {
                    return(bunks.First());
                }
                return(generalBunk);

            case VoyageTypeValue.RoundTrip:
                var productionBunk = bunks.FirstOrDefault(b => b is Service.Foundation.Domain.ProductionBunk);
                if (productionBunk == null)
                {
                    return(bunks.First());
                }
                return(productionBunk);

            default:
                return(bunks.First());
            }
        }
コード例 #6
0
        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("未获取到支持该行程的相关舱位信息");
        }
コード例 #7
0
 void PickerSemana_SelectedIndexChanged(System.Object sender, System.EventArgs e)
 {
     PriceView.TranslationY = 600;
     PriceView.TranslateTo(0, 0, 800, Easing.SinInOut);
 }
コード例 #8
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     PriceView.TranslationY = 600;
     PriceView.TranslateTo(0, 0, 1500, Easing.SinInOut);
 }