/// <summary>
        /// Updates the Statistics TextBoxes with the current information
        /// </summary>
        public void UpdateStatistics()
        {
            Customers.Clear();
            Facilities.Clear();
            Cleaners.Clear();
            Rooms.Clear();

            foreach (Customer c in GlobalStatistics.Customers)
            {
                if (c.InArea != null)
                {
                    Customers.AppendText($"ID: {c.ID} \t {c.Name} \t {c.AssignedRoom.ID} \t Location: {c.InArea.ID}\n");
                }
                else
                {
                    Customers.AppendText($"ID: {c.ID} \t {c.Name} \t {c.AssignedRoom.ID}\n");
                }
            }
            foreach (Cleaner c in GlobalStatistics.Cleaners)
            {
                if (c.CurrentTask != null)
                {
                    Cleaners.AppendText($"ID: {c.CleanerID} \t {c.Name} \t Current Task: {c.CurrentTask.RoomToClean.Area.ID}\n");
                }
                else
                {
                    Cleaners.AppendText($"ID: {c.CleanerID} \t {c.Name}\n");
                }
            }
            foreach (Room c in GlobalStatistics.Rooms)
            {
                if (c.RoomOwner == null)
                {
                    Rooms.AppendText($"ID: {c.ID} \t Room {c.Classification} Stars \t EMPTY\n");
                }
                else
                {
                    Rooms.AppendText($"ID: {c.ID} \t Room {c.Classification} Stars \t {c.RoomOwner.ID}\n");
                }
            }
            foreach (Restaurant c in GlobalStatistics.Restaurants)
            {
                Facilities.AppendText($"ID: {c.ID} \t Eating Time: {c.EatingTime} \t {c.Capacity}\n");
            }
            foreach (Cinema c in GlobalStatistics.Cinemas)
            {
                Facilities.AppendText($"ID: {c.ID} \t Movie Time: {c.MovieTime}\n");
            }
            foreach (Fitness c in GlobalStatistics.FitnessCenters)
            {
                Facilities.AppendText($"ID: {c.ID}\n");
            }
        }
예제 #2
0
        public async Task <ApplicationProductList> GetAllProductsAsync()
        {
            var uri = UriHelper.CombineUri(GlobalSetting.Instance.GatewayShoppingEndpoint, $"{ApiUrlBase}/all");

            ApplicationProductList result = await _requestProvider.GetAsync <ApplicationProductList>(uri);

            _applicationProductList = result;

            if (Beverages != null)
            {
                Beverages.Clear();
                CannedGoods.Clear();
                Cleaners.Clear();
                DryGoods.Clear();
                PaperGoods.Clear();
                PersonalCare.Clear();
                Others.Clear();
            }

            // populate product types
            foreach (var i in result.Items)
            {
                if (i.Type == null)
                {
                    i.Type = "others";
                }

                switch (i.Type.ToLower())
                {
                case "beverage":
                    Beverages.Add(new ProductModel(i));
                    break;

                case "canned goods":
                    CannedGoods.Add(new ProductModel(i));
                    break;

                case "cleaners":
                    Cleaners.Add(new ProductModel(i));
                    break;

                case "dry goods":
                    DryGoods.Add(new ProductModel(i));
                    break;

                case "paper goods":
                    PaperGoods.Add(new ProductModel(i));
                    break;

                case "personal care":
                    PersonalCare.Add(new ProductModel(i));
                    break;

                default:
                    Others.Add(new ProductModel(i));
                    break;
                }
            }

            Beverages    = SortCategory(_beverages);
            CannedGoods  = SortCategory(_cannedGoods);
            Cleaners     = SortCategory(_cleaners);
            DryGoods     = SortCategory(_dryGoods);
            PaperGoods   = SortCategory(_paperGoods);
            PersonalCare = SortCategory(_personalCare);
            Others       = SortCategory(_others);

            return(result);
        }