Example #1
0
        public async void load()
        {
            CoreStackLayout.Children.Clear();
            NoResultsLabel.IsVisible = false;
            LoadingLayout.IsVisible  = true;
            Loading.IsRunning        = true;
            PastryShopRestClient pastryShopRC = new PastryShopRestClient();

            pastryShop = await pastryShopRC.GetAsyncById(pastryShop.ID);

            if (pastryShop == null)
            {
                return;
            }
            LoadingLayout.IsVisible = false;
            Loading.IsRunning       = false;
            if (pastryShop != null && pastryShop.PointOfSales.Count != 0)
            {
                NoResultsLabel.IsVisible = false;
            }
            else
            {
                NoResultsLabel.IsVisible = true;
            }
            foreach (PointOfSale p in pastryShop.PointOfSales)
            {
                CoreStackLayout.Children.Add(MakePointOfSaleStackLayout(p));
            }
        }
        public async void Reload()
        {
            PastryShopRestClient pastryShopRC = new PastryShopRestClient();

            pastryShop = await pastryShopRC.GetAsyncById(pastryShop.ID);

            if (pastryShop == null)
            {
                return;
            }
            Load();
        }
        public async void UpdateOrderNotificationNumber()
        {
            PastryShopRestClient pastryShopRestClient = new PastryShopRestClient();

            pastryShop = await pastryShopRestClient.GetAsyncById(pastryShop.ID);

            if (pastryShop == null)
            {
                return;
            }
            int number = pastryShop.Orders.Count(o => !o.SeenPastryShop);

            NorificationsNumber.Source = "_" + (number != 0 ? (number > 9 ? "9plus.png" : number + ".png") : "");
        }
Example #4
0
        public async void Load(bool reload)
        {
            if (reload)
            {
                var pastryShopRC = new PastryShopRestClient();
                pastryShop = await pastryShopRC.GetAsyncById(pastryShop.ID);

                if (pastryShop == null)
                {
                    return;
                }
            }
            CoreStackLayout.Children.Clear();
            pastryShop.PointOfSales.ToList().ForEach(p => CoreStackLayout.Children.Add(MakePointOfSaleStackLayout(p)));
        }
Example #5
0
        public async void Load(bool reloadParentval)
        {
            this.reloadParent = reloadParentval;
            PastryShopRestClient pastryShopRC = new PastryShopRestClient();

            pastryShop = await pastryShopRC.GetAsyncById(App.Connected.Id);

            if (pastryShop == null)
            {
                return;
            }
            ContentLayout.Children.Clear();
            foreach (var pastryShopDeleveryMethod in pastryShop.PastryShopDeleveryMethods)
            {
                ContentLayout.Children.Add(MakeDeleveryMethodLayout(pastryShopDeleveryMethod));
            }
        }
Example #6
0
        public async void load()
        {
            PastryShopRestClient pastryShopRC = new PastryShopRestClient();

            pastryShop = await pastryShopRC.GetAsyncById(App.Connected.Id);

            if (pastryShop == null)
            {
                return;
            }
            phoneNumberTypes = await phoneNumberTypeRC.GetAsync();

            priceRanges = await priceRangeTypeRC.GetAsync();

            if (phoneNumberTypes == null || priceRanges == null)
            {
                return;
            }
            PriceRange.ItemsSource = priceRanges;

            Name.Text                = pastryShop.Name;
            Email.Text               = pastryShop.Email;
            Password.Text            = pastryShop.Password;
            ShortDesc.Text           = pastryShop.ShortDesc;
            LongDesc.Text            = pastryShop.LongDesc;
            LongDesc.TextColor       = Color.Black;
            PriceRange.SelectedIndex = priceRanges.IndexOf(priceRanges.FirstOrDefault(pr => pr.ID == pastryShop.PriceRange_FK));
            Address.ClassId          = pastryShop.Address_FK.ToString();
            Number.Text              = pastryShop.Address.Number.ToString();
            Street.Text              = pastryShop.Address.Street;
            City.Text                = pastryShop.Address.City;
            ZipCode.Text             = pastryShop.Address.ZipCode.ToString();
            State.Text               = pastryShop.Address.State;
            Country.Text             = pastryShop.Address.Country;

            foreach (var phoneNumber in pastryShop.PhoneNumbers)
            {
                StackLayout phoneNumberStackLayout = CreatePhoneNumberStackLayout(phoneNumber);
                PhoneNumberStackLayouts.Add(phoneNumberStackLayout);
            }
            StackLayout lastPhoneNumberStackLayout = CreatePhoneNumberStackLayout(null);

            PhoneNumberStackLayouts.Add(lastPhoneNumberStackLayout);
        }
        public async void load()
        {
            NoResultsLabel.IsVisible = false;
            Liste.ItemsSource        = null;
            LoadingLayout.IsVisible  = true;
            Loading.IsRunning        = true;
            PastryShopRestClient pastryShopRC = new PastryShopRestClient();

            pastryShop = await pastryShopRC.GetAsyncById(pastryShop.ID);

            if (pastryShop == null)
            {
                return;
            }
            if (pastryShop.Products.Count == 0)
            {
                NoResultsLabel.IsVisible = true;
            }
            LoadingLayout.IsVisible = false;
            Loading.IsRunning       = false;
            Liste.ItemsSource       = pastryShop.Products;
        }
Example #8
0
        public async void load(bool reload)
        {
            if (reload)
            {
                ListLayout.IsVisible    = false;
                LoadingLayout.IsVisible = true;
                Loading.IsRunning       = true;
                PastryShopRestClient pastryShopRC = new PastryShopRestClient();
                pastryShop = await pastryShopRC.GetAsyncById(pastryShop.ID);

                if (pastryShop == null)
                {
                    return;
                }
                Loading.IsRunning       = false;
                LoadingLayout.IsVisible = false;
            }
            displayedProducts.Clear();
            pastryShop.Products.OrderBy(p => p.Name).ToList().ForEach(p => displayedProducts.Add(p));
            selectedSortType.SortTypeIndex   = 0;
            selectedSortType.IsAsc           = true;
            selectedPriceRange.MaxPriceRange = maxPriceRange.MaxPriceRange = pastryShop.Products.Max(p => p.Price);
            selectedPriceRange.MinPriceRange = maxPriceRange.MinPriceRange = pastryShop.Products.Min(p => p.Price);
        }
        protected async override void OnAppearing()
        {
            PastryShopRestClient pastryShopRC = new PastryShopRestClient();

            pastryShop = await pastryShopRC.GetAsyncById(pastryShop.ID);
        }
        private async void Load(bool reload)
        {
            if (reload)
            {
                PastryShopRestClient pastryShopRC = new PastryShopRestClient();
                pastryShop = await pastryShopRC.GetAsyncById(App.Connected.Id);

                if (pastryShop == null)
                {
                    return;
                }
            }
            Rating.Text          = pastryShop.Rating.ToString();
            NumberOfReviews.Text = "(" + pastryShop.NumberOfRatings.ToString() + " avis)";
            Cover.Source         = pastryShop.CoverPic;
            ProfilImage.Source   = pastryShop.ProfilePic;
            PastryName.Text      = pastryShop.Name;
            Address.Text         = pastryShop.Address.ToString();
            Desc.Text            = pastryShop.LongDesc;
            Email.Text           = pastryShop.Email;
            PriceRange.Text      = pastryShop.PriceRange.MinPriceRange + "-" + pastryShop.PriceRange.MaxPriceRange;
            PhoneNumbersLayout.Children.Clear();
            foreach (PhoneNumber phone in pastryShop.PhoneNumbers)
            {
                Grid grid = new Grid()
                {
                    RowDefinitions = { new RowDefinition()
                                       {
                                           Height = GridLength.Auto
                                       } },
                    ColumnDefinitions =
                    {
                        new ColumnDefinition()
                        {
                            Width = new GridLength(1, GridUnitType.Star)
                        },
                        new ColumnDefinition()
                        {
                            Width = new GridLength(1, GridUnitType.Star)
                        }
                    }
                };
                grid.Children.Add(new Label()
                {
                    Text = phone.Number, TextColor = Color.Black, FontSize = 18
                }, 0, 0);
                grid.Children.Add(new Label()
                {
                    Text = phone.PhoneNumberType.Type, TextColor = Color.Black, FontSize = 18
                }, 1, 0);
                PhoneNumbersLayout.Children.Add(grid);
            }
            CategoriesLayout.Children.Clear();
            foreach (var category in pastryShop.Categories)
            {
                CategoriesLayout.Children.Add(new Label()
                {
                    Text = category.CategoryName, TextColor = Color.Black, FontSize = 18
                });
            }
            DeleveryMethodsLayout.Children.Clear();
            float height = 0;

            foreach (var pastryShopDeleveryMethod in pastryShop.PastryShopDeleveryMethods)
            {
                height += 50;
                StackLayout paymentLayout = new StackLayout();
                foreach (var pastryDeleveryPayment in pastryShopDeleveryMethod.PastryDeleveryPayments)
                {
                    height += 40;
                    paymentLayout.Children.Add(new Label()
                    {
                        Text      = pastryDeleveryPayment.Payment.PaymentMethod,
                        TextColor = Color.Black,
                        FontSize  = 15
                    });
                }
                DeleveryMethodsLayout.Children.Add(new StackLayout()
                {
                    Children =
                    {
                        new StackLayout()
                        {
                            Orientation = StackOrientation.Horizontal,
                            Spacing     = 20,
                            Children    =
                            {
                                new Label()
                                {
                                    Text      = "- " + pastryShopDeleveryMethod.DeleveryMethod.DeleveryType,
                                    TextColor = Color.Black,
                                    FontSize  = 18
                                },
                                new StackLayout()
                                {
                                    Orientation     = StackOrientation.Horizontal,
                                    VerticalOptions = LayoutOptions.End,
                                    Children        =
                                    {
                                        new Label()
                                        {
                                            Text           = "Delais:",
                                            TextColor      = Color.Black,
                                            FontSize       = 15,
                                            FontAttributes = FontAttributes.Bold
                                        },
                                        new Label()
                                        {
                                            Text      = pastryShopDeleveryMethod.DeleveryDelay.ToString(),
                                            TextColor = Color.Black,
                                            FontSize  = 15
                                        }
                                    }
                                }
                            }
                        },
                        new StackLayout()
                        {
                            Padding     = new Thickness(30, 0, 0, 0),
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                new Label()
                                {
                                    Text           = "Payment:",
                                    TextColor      = Color.Black,
                                    FontSize       = 15,
                                    FontAttributes = FontAttributes.Bold
                                },
                                paymentLayout
                            }
                        }
                    }
                });
            }
            DeleveryMethodsLayout.HeightRequest = height;
        }