Ejemplo n.º 1
0
        protected async override void OnInitialize()
        {
            Flights.AddRange(await bookedFlightsService.GetFlightsAsync());

            if (VoiceCommandName == "Status")
            {
                var booking = Flights.First(b => b.Name == Booking);

                SelectFlightAsync(booking, true);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新特殊票资源数
        /// </summary>
        /// <param name="pnrPair"></param>
        /// <param name="isFullFlight">是否所有航段都是实际航段【非弃程】</param>
        /// <param name="patPrice"></param>
        /// <param name="isStandby"></param>
        /// <param name="checkPat"></param>
        /// <param name="isthridRelation"></param>
        /// <returns></returns>
        internal bool UpdateContentForResource(PNRPair pnrPair, bool isFullFlight, decimal?patPrice, bool isStandby, Guid oemId, bool checkPat = false, bool isthridRelation = false)
        {
            bool result = false;

            if (!(_flights.First().Bunk is FreeBunk) && (checkPat || !isthridRelation))
            {
                if (!patPrice.HasValue)
                {
                    throw new CustomException("缺少编码价格信息");
                }
                checkFare(patPrice.Value);
                apportionFare(patPrice.Value);
                _passengers.ForEach(passenger => passenger.RefreshPrice());
                result = true;
            }
            Code = pnrPair;
            if (!isStandby && (!checkPat || !isthridRelation))
            {
                //if (string.IsNullOrEmpty(pnrPair.PNR))
                //{
                //    var firstFlight = _flights.First();
                //    var transferPNRResult = CommandService.TransferPNRCode(pnrPair, new FlightNumber(firstFlight.Carrier.Code, firstFlight.FlightNo), firstFlight.TakeoffTime.Date);
                //    if (!transferPNRResult.Success) throw new CustomException("提取编码信息失败");
                //    pnrPair.PNR = transferPNRResult.Result.PnrPair.PNR;
                //}

                ExecuteResult <ReservedPnr> pnrDetailExecResult = CommandService.GetReservedPnr(pnrPair, oemId);
                if (!pnrDetailExecResult.Success)
                {
                    throw new CustomException("提取编码信息失败");
                }
                if (pnrDetailExecResult.Result.HasCanceled)
                {
                    throw new CustomException("编码为取消状态");
                }
                checkPassengers(pnrDetailExecResult.Result.Passengers);
                checkFlights(pnrDetailExecResult.Result.Voyage.Segments, isFullFlight);
                updateFlights(pnrDetailExecResult.Result.Voyage.Segments);
                PNRContent = pnrDetailExecResult.Result.PnrRawData;
                var firstPassenger = Passengers.First();
                PatContent = Command.Domain.Utility.ContentBulider.GetPatString(Flights.First().Bunk.Code,
                                                                                firstPassenger.Price.Fare, firstPassenger.Price.AirportFee, firstPassenger.Price.BAF);
            }
            return(result);
        }
Ejemplo n.º 3
0
        private void RenderMap()
        {
            BmpPlanner.Children.Clear();

            if (RenderWeatherConditions)
            {
                BmpPlanner.Children.Add(new MapTileLayer()
                {
                    TileSource = new MSLPTileSource(),
                    Opacity    = 1
                });
            }

            if (RenderFIRMS)
            {
                BmpPlanner.Children.Add(new MapTileLayer()
                {
                    TileSource = new FIRMSTileSource(),
                    Opacity    = 1
                });
            }

            MapLayer labelLayer = new MapLayer();

            int totalFireCount = 0;

            if (_draftMapModel != null)
            {
                RenderMap(_draftMapModel, labelLayer, null, null);
            }

            foreach (var aoi in AreasOfInterest)
            {
                RenderMap(aoi.MapModel, labelLayer, null, null);
            }

            foreach (var flight in Flights)
            {
                totalFireCount += RenderMap(flight.MapModel, labelLayer, "Potential fire", (ControlTemplate)Application.Current.Resources["FirePushPinTemplate"]);
            }

            if (RenderRedFlagAlerts)
            {
                foreach (var redflag in RedFlagsNotifications)
                {
                    RenderMap(redflag.MapModel, labelLayer, "Red flag warning", null);
                }
            }

            if (totalFireCount > 0)
            {
                var centerPoint = Flights.Where((f) => f.FireDetected).First().MapModel.Marks.First();
                BmpPlanner.SetView(new Location(centerPoint.Latitude, centerPoint.Longitude), Math.Max(MAP_ZOOM_LEVEL_AREA, BmpPlanner.ZoomLevel));

                FireAlert  = Visibility.Visible;
                AreaIsGood = Visibility.Collapsed;
                NotifyPropertyChanged("AreaIsGood");
                NotifyPropertyChanged("FireAlert");
            }
            else if (Flights.Any())
            {
                var centerPoint = Flights.First().MapModel.Polygons.First().CenterPosition();
                BmpPlanner.SetView(new Location(centerPoint.Latitude, centerPoint.Longitude), Math.Max(MAP_ZOOM_LEVEL_AREA, BmpPlanner.ZoomLevel));

                AreaIsGood = Visibility.Visible;
                FireAlert  = Visibility.Collapsed;
                NotifyPropertyChanged("AreaIsGood");
                NotifyPropertyChanged("FireAlert");
            }
            else if (AreasOfInterest.Any())
            {
                var centerPoint = AreasOfInterest.First().MapModel.Polygons.First().CenterPosition();
                BmpPlanner.SetView(new Location(centerPoint.Latitude, centerPoint.Longitude), Math.Max(MAP_ZOOM_LEVEL_AREA, BmpPlanner.ZoomLevel));
            }

            BmpPlanner.Children.Add(labelLayer);
        }