async Task ExecuteLoadVisitsCommand(Guest selectedGuest) { if (IsBusy) { return; } IsBusy = true; try { Visits.Clear(); var visits = await VisitDataStore.GetMembersAsync(true); foreach (var visit in visits) { if (visit.GuestId == selectedGuest.PersonalCode) { Visits.Add(visit); } } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public override ICollection <VisitCustomers> GetVisitCustomers() { Visits.Clear(); foreach (var vis in db.VisitCustomers) { Visits.Add(vis); } return(Visits); }
public void AddVisit(DateTime dateTime, bool visited) { if (Visits == null) { Visits = new List <VisitInfo>(); } Visits.Add(new VisitInfo { Date = dateTime, Visited = visited }); }
private void InitializeVisits(ICollection <Visit> visits) { foreach (var wrapper in Visits) { wrapper.PropertyChanged -= VisitWrapper_PropertyChanged; } Visits.Clear(); foreach (var visit in visits) { var wrapper = new VisitWrapper(visit); Visits.Add(wrapper); wrapper.PropertyChanged += VisitWrapper_PropertyChanged; } }
async Task ExecuteLoadVisitsCommand() { if (IsBusy) { return; } IsBusy = true; try { Visits.Clear(); var dorms = await VisitDataStore.GetMembersAsync(true); foreach (var dorm in dorms) { if (Title == "History") { if (dorm.IsOver) { Visits.Add(dorm); } } else if (Title == "Upcoming") { if (!dorm.IsOver) { Visits.Add(dorm); } } else { Visits.Add(dorm); } } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void LoadData() { Visits.Clear(); var models = petsData.GetVisits(petDescription.Id.Value); if (models == null) { return; } foreach (var model in models) { var vm = mapper.Map(model, new VisitViewModel(petsData, mapper)); vm.IsDirty = false; Visits.Add(vm); } }
public void UpdateStatusDueToAppointmentBooking(Visit bookedVisit, BookingRemark bookingRemark, UserRole userRole) { if (bookingRemark == null) { return; } // preconditions if (Status != WorkStatusType.VisitNeeded && Status != WorkStatusType.VisitOpen) { return; } if (bookedVisit != null || bookingRemark.ResultCode.Outcome != ResultCodeOutcomeType.Done) { WorkOrderRemarks.Add(bookingRemark); } // check when status VISIT_NEEDED if (Status == WorkStatusType.VisitNeeded) { if (bookingRemark.ResultCode.Outcome == ResultCodeOutcomeType.Done) { if (bookedVisit != null) { var visit = Visits.FirstOrDefault(v => v.Id == bookedVisit.Id); if (visit == null) { Visits.Add(bookedVisit); } else { visit.AppointmentWindowId = bookedVisit.AppointmentWindowId; visit.AppointmentWindow = bookedVisit.AppointmentWindow; visit.WindowStart = bookedVisit.WindowStart; visit.WindowEnd = bookedVisit.WindowEnd; } } } if (bookingRemark.ResultCode.Outcome == ResultCodeOutcomeType.Abort) { ChangeStatusTo(WorkStatusType.Closed, userRole); } } // check when status VISIT_OPEN if (Status == WorkStatusType.VisitOpen) { var visit = Visits.OrderByDescending(v => v.WindowStart) .FirstOrDefault(); if (visit != null && visit.SuperState == VisitSuperStateType.Provisional) { if (bookingRemark.ResultCode.Outcome == ResultCodeOutcomeType.Done && bookedVisit != null) { visit.AppointmentWindowId = bookedVisit.AppointmentWindowId; visit.AppointmentWindow = bookedVisit.AppointmentWindow; visit.WindowStart = bookedVisit.WindowStart; visit.WindowEnd = bookedVisit.WindowEnd; } if (bookingRemark.ResultCode.Outcome == ResultCodeOutcomeType.Abort) { visit.ChangeStatusTo(VisitStatusType.Closed, userRole); ChangeStatusTo(WorkStatusType.Closed, userRole); } } } }
public void AddVisit(string name, int age) { Visit visit = new Visit(name, age); Visits.Add(visit); }
public virtual void AddVisit(SiteVisit visit) { Visits.Add(visit); visit.Site = this; }