void ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                //ItineraryDailyBreakDown.Clear();
                KT.BusinessLayer.Itinerary itineraryManager = new KT.BusinessLayer.Itinerary();
                DateTime startDate     = DateTime.Today.AddDays(-2);
                var      itineraryList = itineraryManager.GetItineraryList();
                int      cntr          = 0;
                foreach (TripServices dto in itineraryList)
                {
                    cntr++;
                    var      newItem     = new ItineraryViewModel(_navigation);
                    DateTime tripStartDt = DateTime.Parse(dto.StartDate);

                    //TODO; change after demo
                    newItem.TripId        = dto.ItineraryId;
                    newItem.TripName      = dto.Name;
                    newItem.TripSchedule  = $"{tripStartDt.ToString("MMM ddd, yyyy")} - {tripStartDt.AddDays(dto.NoOfDays).ToString("MMM dd, yyyy")}";
                    newItem.BackImagePath = $"KtMobileApp.Assets.Images.Activity_{cntr + 10}_128_128.png";

                    ItineraryList.Add(newItem);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        private void AddTrip(string tripReferenceNumber)
        {
            //TODO: DB is failing to open
            KT.BusinessLayer.Itinerary itineraryManager = new KT.BusinessLayer.Itinerary();
            TripImportStatus           tripCallResponse = itineraryManager.AddItinerary(tripReferenceNumber);

            //AFTER success
            if (tripCallResponse == TripImportStatus.Add || tripCallResponse == TripImportStatus.Update)
            {
                ImportTripReferenceStatusMessage = tripCallResponse == TripImportStatus.Update ? "Itinerary updated with latest info !" : "Successfully Imported !";
                ShowImportTripView       = false;
                ShowImportTripStatusView = true;
                ShowSuccessIcon          = true;
                ShowFailedIcon           = false;
            }
            else
            {
                ImportTripReferenceStatusMessage = "Problem loading api response";
                ShowImportTripView       = false;
                ShowImportTripStatusView = true;
                ShowFailedIcon           = true;
                ShowSuccessIcon          = false;
            }
        }
示例#3
0
        void ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                ItineraryDailyBreakDown.Clear();
                KT.BusinessLayer.Itinerary itineraryManager = new KT.BusinessLayer.Itinerary();
                DateTime startDate = DateTime.Today.AddDays(-2);
                var      itineraryDailyBreakdown = itineraryManager.GetItineraryDays(_itineraryVm.TripId);
                int      cntr = 0;
                foreach (ItineraryDays dto in itineraryDailyBreakdown)
                {
                    cntr++;
                    var      newItem     = new ItineraryDailyBreakDown(_navigation);
                    DateTime tripDayDate = DateTime.Parse(dto.ItineraryDayDate);

                    //TODO; change after demo
                    dto.ItineraryDayDate = tripDayDate.ToString("MMM dd, yyyy");

                    newItem.DayNumber               = dto.Day;
                    newItem.Location                = dto.Summary;
                    newItem.TripDayDate             = dto.ItineraryDayDate;
                    newItem.ItineraryDayDescription = dto.Notes;
                    newItem.itineraryDayId          = dto.ItineraryDayId;

                    //Check for past days
                    if (tripDayDate < DateTime.Today)
                    {
                        newItem.IsPast = true;
                    }

                    //Set selected item background color for current day
                    if (tripDayDate == DateTime.Today)
                    {
                        newItem.CurrentTripDaySelectedItem = Color.FromHex("BFAD87");
                    }
                    newItem.ImageResourcePassedPath   = "KtMobileApp.Assets.Images.checked_48_48.png";
                    newItem.ImageResourceActivityPath = $"KtMobileApp.Assets.Images.Activity_{cntr}_128_128.png";



                    ItineraryDailyBreakDown.Add(newItem);

                    //Add next day
                    //startDate = startDate.AddDays(1);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }