Ejemplo n.º 1
0
        public async void InputDataToBinding()
        {
            if (typePage == Status.InItemPage.Item)
            {
                categoryData = await GetCategoryData();

                itemDate = await GetItemData();

                TheData = itemDate.Select(x => new ItemPageModel()
                {
                    Id               = x.Id,
                    Color            = x.Color,
                    DataName         = x.Name,
                    CountItemVisible = false,
                    Number           = x.Price.ToString("#,###.00"),
                    NumberVisible    = true
                }).ToList();
                SearchData   = TheData;
                CategoryName = categoryData.Select(x => x.Name).ToList();
                CategoryName.Add("All Items");
                Picker        = true;
                Laber         = false;
                ItemColor     = "#ededed";
                CategoryColor = "#ffffff";
                DiscountColor = "#ffffff";
            }
            else if (typePage == Status.InItemPage.Categories)
            {
                categoryData = await GetCategoryData();

                TheData = categoryData.Select(x => new ItemPageModel()
                {
                    Id               = x.Id,
                    Color            = x.Color,
                    DataName         = x.Name,
                    CountItem        = x.CountItem.ToString() + " Items",
                    CountItemVisible = true,
                    NumberVisible    = false
                }).ToList();
                SearchData    = TheData;
                NamePage      = "Categories";
                Picker        = false;
                Laber         = true;
                ItemColor     = "#ffffff";
                CategoryColor = "#ededed";
                DiscountColor = "#ffffff";
            }
            else if (typePage == Status.InItemPage.Discount)
            {
                discountData = GetDiscountData().Result;
                TheData      = discountData.Select(x => new ItemPageModel()
                {
                    Id               = x.Id,
                    Color            = "#d6d6d6",
                    DataName         = x.DiscountName,
                    CountItemVisible = false,
                    Number           = (!x.IsPercentage) ? x.Amount.ToString("#,###.00") : (x.Amount / 100).ToString("#%"),
                    NumberVisible    = true
                }).ToList();
                SearchData    = TheData;
                NamePage      = "Discounts";
                Picker        = false;
                Laber         = true;
                ItemColor     = "#ffffff";
                CategoryColor = "#ffffff";
                DiscountColor = "#ededed";
            }
        }