Exemplo n.º 1
0
 public PastryShopMasterPage(PastryShopMasterDetailPage pastryShopMasterDetailPage, PastryShop pastryShop)
 {
     InitializeComponent();
     this.pastryShopMasterDetailPage = pastryShopMasterDetailPage;
     this.pastryShop = pastryShop;
     UpdateOrderNotificationNumber(pastryShop.Orders.ToList());
 }
Exemplo n.º 2
0
 public PastryShopProductForm(PSProductList ProductsList, PastryShop pastryShop)
 {
     InitializeComponent();
     this.pastryShop   = pastryShop;
     this.ProductsList = ProductsList;
     Load();
 }
Exemplo n.º 3
0
        public IHttpActionResult PutPastryShop(int id, PastryShop pastryShop)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pastryShop.ID)
            {
                return(BadRequest());
            }

            db.Entry(pastryShop).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PastryShopExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 4
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));
            }
        }
Exemplo n.º 5
0
        public PastryShopProfile(PastryShopMasterDetailPage pastryShopMasterDetailPage, PastryShop pastryShop)
        {
            InitializeComponent();
            this.pastryShop = pastryShop;
            this.pastryShopMasterDetailPage = pastryShopMasterDetailPage;
            //ToolbarItems.Clear();
            ProductList = new ToolbarItem
            {
                Icon     = "products.png",
                Text     = "Produits",
                Order    = ToolbarItemOrder.Primary,
                Priority = 0
            };
            ProductList.Clicked += ProductListOnClick;

            pointOfSaleList = new ToolbarItem()
            {
                Text  = "Points de vente",
                Order = ToolbarItemOrder.Secondary
            };
            pointOfSaleList.Clicked += PointOfSaleList_Clicked;

            ToolbarItems.Add(ProductList);
            ToolbarItems.Add(pointOfSaleList);
            Load();
        }
Exemplo n.º 6
0
        public async void SubmitOnClick(Object sender, EventArgs e)
        {
            if (starIndex != 0)
            {
                PastryShop pastryShopTemp = new PastryShop()
                {
                    ID              = pastryShop.ID,
                    Name            = pastryShop.Name,
                    Email           = pastryShop.Email,
                    Password        = pastryShop.Password,
                    Address_FK      = pastryShop.Address_FK,
                    ProfilePic      = pastryShop.ProfilePic,
                    CoverPic        = pastryShop.CoverPic,
                    PriceRange_FK   = pastryShop.PriceRange_FK,
                    LongDesc        = pastryShop.LongDesc,
                    ShortDesc       = pastryShop.ShortDesc,
                    NumberOfRatings = ++pastryShop.NumberOfRatings,
                    RatingSum       = pastryShop.RatingSum + starIndex,
                };

                var x = pastryShopTemp;
                PastryShopRestClient pastryShopRC = new PastryShopRestClient();
                if (!(await pastryShopRC.PutAsync(pastryShop.ID, pastryShopTemp)))
                {
                    ;
                }
                Load(true);
                ResetToolbar();
            }
            else
            {
                ReactionLabel.Text = "Select a star!";
            }
        }
Exemplo n.º 7
0
        private void SelectedNot(Object sender, ItemTappedEventArgs e)
        {
            PastryShop p = (PastryShop)e.Item;

            (sender as ListView).SelectedItem = null;
            Navigation.PushAsync(new PastryShopProfile(p));
        }
 public PastryShopEnteringMenu(PastryShop pastryShop)
 {
     InitializeComponent();
     NavigationPage.SetHasBackButton(this, false);
     this.pastryShop = pastryShop;
     load();
 }
Exemplo n.º 9
0
        public PastryShopMasterDetailPage(PastryShop pastryShop)
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);
            Master            = new PastryShopMasterPage(this, pastryShop);
            pastryShopProfile = new PastryShopProfile(this, pastryShop);
            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                Detail = new NavigationPage(pastryShopProfile);
                break;

            case Device.Android:
                Detail = new NavigationPage(pastryShopProfile);
                break;;

            case Device.WinPhone:
            case Device.Windows:
                Detail = pastryShopProfile;
                break;

            default:
                Detail = new NavigationPage(pastryShopProfile);
                break;
            }
            IsPresentedChanged += PastryShopMasterDetailPage_IsPresentedChanged;
        }
Exemplo n.º 10
0
 public PastryShopProductForm(PastryShopEnteringMenu ProductsPage, PastryShop pastryShop)
 {
     InitializeComponent();
     this.pastryShop   = pastryShop;
     this.productsPage = ProductsPage;
     Load();
 }
Exemplo n.º 11
0
 public EditCategories(EditProfileInfo editProfileInfo, PastryShop pastryShop)
 {
     BackgroundColor      = Color.FromHex("#CC000000");
     this.pastryShop      = pastryShop;
     this.editProfileInfo = editProfileInfo;
     InitializeComponent();
     Load();
 }
Exemplo n.º 12
0
 public PastryShopPointOfSaleForm(PastryShopEnteringPointOfSales pastryShopEnteringPointOfSales, PastryShop pastryShop)
 {
     InitializeComponent();
     this.pastryShop = pastryShop;
     this.pastryShopEnteringPointOfSales        = pastryShopEnteringPointOfSales;
     PhoneNumberStackLayouts.CollectionChanged += PhoneNumberStackLayouts_CollectionChanged;
     load();
 }
Exemplo n.º 13
0
 public PointOfSaleForm(PointOfSalesList pointOfSalesList, PastryShop pastryShop)
 {
     InitializeComponent();
     this.pastryShop       = pastryShop;
     this.pointOfSalesList = pointOfSalesList;
     PhoneNumberStackLayouts.CollectionChanged += PhoneNumberStackLayouts_CollectionChanged;
     load();
 }
Exemplo n.º 14
0
 public AddDeleveryMethodForm(EditDeleveryMethods editDeleveryMethods, PastryShop pastryShop)
 {
     BackgroundColor          = Color.FromHex("#CC000000");
     this.pastryShop          = pastryShop;
     this.editDeleveryMethods = editDeleveryMethods;
     InitializeComponent();
     Load();
     DeleveryPicker.SelectedIndexChanged += DeleveryPicker_SelectedIndexChanged;
 }
Exemplo n.º 15
0
        public PSProductList(PastryShop pastryShop)
        {
            InitializeComponent();
            this.pastryShop = pastryShop;
            BodyLayout.TranslateTo(0, -50);
            List.SeparatorVisibility = SeparatorVisibility.None;

            addProduct = new ToolbarItem
            {
                Icon     = "plus.png",
                Text     = "Ajouter",
                Order    = ToolbarItemOrder.Primary,
                Priority = 0
            };
            addProduct.Clicked += AddProduct_Clicked;

            filterToolbarItem = new ToolbarItem()
            {
                Text  = "Filtrer",
                Order = ToolbarItemOrder.Secondary,
                Icon  = "filter.png"
            };
            filterToolbarItem.Clicked += FilterToolbarItem_Clicked;

            searchToolbarItem = new ToolbarItem()
            {
                Text  = "Chercher",
                Order = ToolbarItemOrder.Primary,
                Icon  = "search.png"
            };
            searchToolbarItem.Clicked += SearchToolbarItem_Clicked;

            endSearchToolbarItem = new ToolbarItem()
            {
                Text  = "Terminer",
                Order = ToolbarItemOrder.Primary,
                Icon  = "close.png"
            };
            endSearchToolbarItem.Clicked += EndSearchToolbarItem_Clicked;

            sortToolbarItem = new ToolbarItem()
            {
                Text  = "Trier",
                Order = ToolbarItemOrder.Primary,
                Icon  = "sort.png"
            };
            sortToolbarItem.Clicked += SortToolbarItem_Clicked;

            ToolbarItems.Add(addProduct);
            ToolbarItems.Add(searchToolbarItem);
            ToolbarItems.Add(sortToolbarItem);
            ToolbarItems.Add(filterToolbarItem);

            displayedProducts.CollectionChanged += DisplayedProducts_CollectionChanged;
            List.ItemsSource = displayedProducts;
            load(false);
        }
Exemplo n.º 16
0
 public PastryShopThirdStep(PastryShop pastry)
 {
     InitializeComponent();
     NavigationPage.SetHasBackButton(this, false);
     CategoriesListView.SeparatorVisibility      = SeparatorVisibility.None;
     DeleveryMethodsListView.SeparatorVisibility = SeparatorVisibility.None;
     this.pastry = pastry;
     localDeleveryMethods.CollectionChanged += LocalDeleveryMethods_CollectionChanged;
     load();
 }
Exemplo n.º 17
0
        public PastryShopProfile(PastryShop pastryShop)
        {
            InitializeComponent();
            this.pastryShop = pastryShop;
            ToolbarItems.Clear();

            RateItem = new ToolbarItem
            {
                Icon     = "fullStarItem.png",
                Text     = "Noter",
                Order    = ToolbarItemOrder.Primary,
                Priority = 0
            };
            RateItem.Clicked += RateOnClick;

            ProductList = new ToolbarItem
            {
                Icon     = "products.png",
                Text     = "Produits",
                Order    = ToolbarItemOrder.Primary,
                Priority = 0
            };
            ProductList.Clicked += ProductListOnClick;

            submitItem = new ToolbarItem
            {
                Icon     = "confirm.png",
                Text     = "Envoyer",
                Order    = ToolbarItemOrder.Primary,
                Priority = 0
            };
            submitItem.Clicked += SubmitOnClick;

            cancelItem = new ToolbarItem
            {
                Icon     = "close.png",
                Text     = "Annuler",
                Order    = ToolbarItemOrder.Primary,
                Priority = 1
            };
            cancelItem.Clicked += CanelOnClick;

            PointOfSalesItem = new ToolbarItem()
            {
                Text  = "Points de vente",
                Order = ToolbarItemOrder.Secondary
            };
            PointOfSalesItem.Clicked += PointOfSalesItem_Clicked;
#pragma warning restore CS0618 // Type or member is obsolete
            ToolbarItems.Add(RateItem);
            ToolbarItems.Add(ProductList);
            ToolbarItems.Add(PointOfSalesItem);
            Load(false);
        }
Exemplo n.º 18
0
        public IHttpActionResult GetPastryShop(string email)
        {
            PastryShop pastryShop = db.PastryShops.FirstOrDefault(p => p.Email == email);

            if (pastryShop == null)
            {
                return(NotFound());
            }

            return(Ok(pastryShop));
        }
Exemplo n.º 19
0
        public IHttpActionResult GetPastryShop(int id)
        {
            PastryShop pastryShop = db.PastryShops.Find(id);

            if (pastryShop == null)
            {
                return(NotFound());
            }

            return(Ok(pastryShop));
        }
Exemplo n.º 20
0
        public async void Reload()
        {
            PastryShopRestClient pastryShopRC = new PastryShopRestClient();

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

            if (pastryShop == null)
            {
                return;
            }
            Load();
        }
Exemplo n.º 21
0
        public PastryShopProductList(PastryShop pastryShop)
        {
            InitializeComponent();
            this.pastryShop = pastryShop;
            BodyLayout.TranslateTo(0, -50);
            List.SeparatorVisibility = SeparatorVisibility.None;

            filterToolbarItem = new ToolbarItem()
            {
                Text  = "Filtrer",
                Order = ToolbarItemOrder.Primary,
                Icon  = "filter.png"
            };
            filterToolbarItem.Clicked += FilterToolbarItem_Clicked;

            searchToolbarItem = new ToolbarItem()
            {
                Text  = "Chercher",
                Order = ToolbarItemOrder.Primary,
                Icon  = "search.png"
            };
            searchToolbarItem.Clicked += SearchToolbarItem_Clicked;

            endSearchToolbarItem = new ToolbarItem()
            {
                Text  = "Terminer",
                Order = ToolbarItemOrder.Primary,
                Icon  = "close.png"
            };
            endSearchToolbarItem.Clicked += EndSearchToolbarItem_Clicked;

            sortToolbarItem = new ToolbarItem()
            {
                Text  = "Trier",
                Order = ToolbarItemOrder.Primary,
                Icon  = "sort.png"
            };
            sortToolbarItem.Clicked += SortToolbarItem_Clicked;

            ToolbarItems.Add(searchToolbarItem);
            ToolbarItems.Add(filterToolbarItem);
            ToolbarItems.Add(sortToolbarItem);

            displayedProducts.CollectionChanged += DisplayedProducts_CollectionChanged;
            List.ItemsSource = displayedProducts;
            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);
        }
Exemplo n.º 22
0
 public PointOfSalesList(PastryShop pastryShop)
 {
     this.pastryShop = pastryShop;
     InitializeComponent();
     addToolbarItem = new ToolbarItem()
     {
         Text  = "Ajouter",
         Order = ToolbarItemOrder.Primary,
         Icon  = "plus.png"
     };
     addToolbarItem.Clicked += AddToolbarItem_OnClicked;
     ToolbarItems.Add(addToolbarItem);
     Load(false);
 }
Exemplo n.º 23
0
        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") : "");
        }
Exemplo n.º 24
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)));
        }
Exemplo n.º 25
0
        private async void Apply(object sender, EventArgs e)
        {
            if (!newSelectedCategories.Any() && !toRemoveCategories.Any())
            {
                await PopupNavigation.PopAsync();

                return;
            }
            if (!allSelectedCategories.Any())
            {
                await DisplayAlert("Erreur", "Au moins une catégorie doit être selectionné!", "Ok");

                return;
            }
            await PopupNavigation.PushAsync(new LoadingPopupPage());

            pastryShop.Categories.ToList().ForEach(c => c.PastryShops.Clear());
            newSelectedCategories.ForEach(c => c.PastryShops.Clear());
            PastryShop p = new PastryShop()
            {
                ID              = pastryShop.ID,
                Name            = pastryShop.Name,
                Email           = pastryShop.Email,
                Password        = pastryShop.Password,
                ShortDesc       = pastryShop.ShortDesc,
                LongDesc        = pastryShop.LongDesc,
                CoverPic        = pastryShop.CoverPic,
                ProfilePic      = pastryShop.ProfilePic,
                PriceRange_FK   = pastryShop.PriceRange_FK,
                Address_FK      = pastryShop.Address_FK,
                NumberOfRatings = pastryShop.NumberOfRatings,
                RatingSum       = pastryShop.RatingSum,
                Categories      = pastryShop.Categories
            };

            toRemoveCategories.ForEach(rc => p.Categories.Remove(p.Categories.FirstOrDefault(c => c.ID == rc.ID)));
            newSelectedCategories.ForEach(sc => p.Categories.Add(sc));
            var pastryShopRC = new PastryShopRestClient();

            if (await pastryShopRC.PutAsyncCategories(p.ID, p))
            {
                await DisplayAlert("Succées", "Liste de catégories mise à jours!", "Ok");

                editProfileInfo.UpdateParent = true;
                editProfileInfo.load();
                await PopupNavigation.PopAsync();
            }
        }
Exemplo n.º 26
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));
            }
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
0
        public IHttpActionResult PutPastryShopCategories(int id, PastryShop pastryShop)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pastryShop.ID)
            {
                return(BadRequest());
            }

            var existingPastry     = db.PastryShops.FirstOrDefault(p => p.ID == id);
            var toDeleteCategories = existingPastry.Categories.Except(pastryShop.Categories, c => c.ID).ToList <Category>();
            var toAddCategories    = pastryShop.Categories.Except(existingPastry.Categories, c => c.ID).ToList <Category>();

            toDeleteCategories.ForEach(c => existingPastry.Categories.Remove(c));
            foreach (var category in toAddCategories)
            {
                if (db.Entry(category).State == EntityState.Detached)
                {
                    db.Categories.Attach(category);
                }
                existingPastry.Categories.Add(category);
            }

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PastryShopExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 29
0
        public IHttpActionResult PostPastryShop(PastryShop pastryShop)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            foreach (Category pastryShopCategory in pastryShop.Categories)
            {
                db.Entry(pastryShopCategory).State = EntityState.Unchanged;
            }
            db.PastryShops.Add(pastryShop);
            db.SaveChanges();

            //db.PastryShops.Add(pastryShop);
            //db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = pastryShop.ID }, pastryShop));
        }
Exemplo n.º 30
0
        public async void EmailVerified()
        {
            Address address = new Address()
            {
                Number  = Int32.Parse(Number.Text),
                Street  = Street.Text,
                City    = City.Text,
                State   = State.Text,
                Country = Country.Text,
                ZipCode = Int32.Parse(ZipCode.Text)
            };

            PastryShop pastryShop = new PastryShop()
            {
                Name          = Name.Text,
                Email         = Email.Text.ToLower(),
                Password      = Password.Text,
                Address       = address,
                LongDesc      = LongDesc.Text,
                ShortDesc     = ShortDesc.Text,
                PriceRange_FK = priceRanges.ElementAt(PriceRange.SelectedIndex).ID
            };

            foreach (StackLayout s in PhoneNumberStackLayouts)
            {
                if ((s.Children[0] as Entry).Text != "")
                {
                    PhoneNumber p = new PhoneNumber()
                    {
                        Number             = (s.Children[0] as Entry).Text,
                        PhoneNumberType_FK = (phoneNumberTypes.ElementAt((s.Children[1] as Picker).SelectedIndex)).ID,
                    };
                    pastryShop.PhoneNumbers.Add(p);
                }
            }
            //NavigationPage navigationPage = new NavigationPage(new ContentPage());
            //await navigationPage.PushAsync(new PastryShopUploadPhotos(pastryShop));
            //toUpload = true;
            await Navigation.PushAsync(new PastryShopUploadPhotos(pastryShop));
        }