예제 #1
0
        public async void AddPromotion(Promotion promotion)
        {
            Promotions.Add(promotion);
            await SaveBranch();

            _navigationService.NavigateTo(nameof(BranchPromotionsPage));
        }
예제 #2
0
        public async void AddPromotionAsync(String s, Object d)
        {
            var promotion = new Promotion(s, (Discount)d);

            var promotionResult = await _companyService.AddPromotion(Company.Id, promotion);

            Promotions.Add(promotionResult);
            AlertService.Toast("Promotie toegevoegd", $"De promotie {promotionResult.Description} toegevoegd");
        }
        private void ExtractPromotions(XmlDocument xmlDoc)
        {
            var nodeList = xmlDoc.SelectNodes("/PROMOTIONSCATALOG/PROMOTIONS/PROMOTION");

            foreach (XmlNode node in nodeList)
            {
                Promotion promo       = new Promotion();
                Product   product     = new Product();
                var       productNode = node.FirstChild;
                product.Name   = productNode.Attributes["name"].Value;
                promo.Product  = product;
                promo.Quantity = int.Parse(node.Attributes["quantity"].Value);
                promo.Price    = decimal.Parse(node.Attributes["price"].Value);
                Promotions.Add(promo);
            }
        }
예제 #4
0
        private void HandleEmpty()
        {
            Image image = new Image()
            {
                Path = "img/establishments/none/empty.jpg"
            };
            List <Image> images = new List <Image>();

            images.Add(image);

            if (Subscriptions.Count == 0)
            {
                Establishment establishment = new Establishment()
                {
                    Name   = "Je hebt nog geen abonnementen",
                    Images = images
                };
                Subscriptions.Add(establishment);
            }

            if (Promotions.Count == 0)
            {
                Promotion p = new Promotion()
                {
                    Name   = "Er zijn nog geen promoties toegevoegd",
                    Images = images
                };

                Promotions.Add(p);
            }

            if (Events.Count == 0)
            {
                Event e = new Event()
                {
                    Name   = "Er zijn nog geen events toegevoegd",
                    Images = images
                };

                Events.Add(e);
            }
        }
예제 #5
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Promotions.Clear();
                var promotions = new List <Promotion>()
                {
                    new Promotion()
                    {
                        Id = 1, Name = "Promoção de Verão", Title = "Promoção de Verão", ShortDescription = "Musculação mensal, qualquer dia e horário por apenas R$ 69,90…", Description = "Musculação mensal, qualquer dia e horário por apenas R$ 69,90.", UrlImage = "summerpromotion"
                    },
                    new Promotion()
                    {
                        Id = 2, Name = "Suplementação", Title = "Promoção de Suplementos", ShortDescription = "Marcas nacionais e internacionais pelo melhor preço...", Description = "Marcas nacionais e internacionais pelo melhor preço", UrlImage = "suplementpromotion"
                    },
                };
                foreach (var item in promotions)
                {
                    Promotions.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #6
0
        public async void GetPromotions(Guid companyId)
        {
            if (Promotions == null)
            {
                Promotions = new ObservableCollection <SharedPromotion>();
            }
            Promotions.Clear();
            HttpClient client = new HttpClient();
            string     res    = await client.GetStringAsync(new Uri("http://localhost:51070/api/Promotion?companyID=" + companyId));

            var list = JsonConvert.DeserializeObject <List <SharedPromotion> >(res);

            foreach (var item in list)
            {
                // Navigate to promotionpage
                // item.Command = new DelegateCommand<Guid>(GoToPromotionDetail);
                Promotions.Add(item);
            }
            if (list.Count > 0)
            {
                Visible = Visibility.Visible;
            }
            RaisePropertyChanged("Promotions");
        }
예제 #7
0
 public void AddPromotion(Promotion promo)
 {
     Promotions.Add(promo);
     CalculateTotal();
 }
예제 #8
0
 public void AddPromotionToPromotionModel(Promotion promotion)
 {
     Promotions.Add(new PromotionModel(promotion));
 }