示例#1
0
        public Main(Client client)
        {
            InitializeComponent();
            Client         = client;
            nameLabel.Text = $"Greetings {client.Name}";

            var apiclient = new ApiClient();

            trip = apiclient.GetTripsByClientId(Client.Id)
                   .OrderByDescending(t => t.Visits
                                      .OrderByDescending(v => v.Arrival)
                                      .FirstOrDefault().Arrival)
                   .FirstOrDefault();

            ScheduleList.ItemsSource = trip.Visits;

            var checkins = apiclient.GetCheckins(Client.Id, trip.Id);

            foreach (var tripVisit in trip.Visits)
            {
                var checkinItem = CheckinRequest.From(tripVisit);
                if (checkins.Any(c => c.Visit.Id == tripVisit.Id))
                {
                    checkinItem.CheckedIn = true;
                }

                checkinRequestItems.Add(checkinItem);
            }

            CheckinList.ItemsSource = checkinRequestItems;

            UpdateMainPageDetails();
        }
示例#2
0
 public static CheckinPost From(CheckinRequest r, string tripId, string clientId)
 {
     return(new CheckinPost
     {
         TripId = tripId,
         VisitId = r.Visit.Id,
         ClientId = clientId
     });
 }