示例#1
0
        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;
            }
        }
示例#2
0
        public override ICollection <VisitCustomers> GetVisitCustomers()
        {
            Visits.Clear();
            foreach (var vis in db.VisitCustomers)
            {
                Visits.Add(vis);
            }

            return(Visits);
        }
示例#3
0
 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;
     }
 }
示例#5
0
        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;
            }
        }
示例#6
0
        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);
            }
        }
示例#7
0
        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);
                    }
                }
            }
        }
示例#8
0
        public void AddVisit(string name, int age)
        {
            Visit visit = new Visit(name, age);

            Visits.Add(visit);
        }
示例#9
0
 public virtual void AddVisit(SiteVisit visit)
 {
     Visits.Add(visit);
     visit.Site = this;
 }