コード例 #1
0
 public static void AddImage(Article article,ArticleControl control,string path ="")
 {
     if (path == "") path = article.ImagePath;
     AddImageToControl(control,path);
     BindingPrice(article, control);
     BindingName(article, control);
 }
コード例 #2
0
        public TransWindow(MainWindow sklepWin, Article article, string message,DoShoping doShoping, bool isLearning)
        {
            this.InitializeComponent();
            shopWin = sklepWin;
            actualArticle = article;
            shoping = doShoping;
            Info.Text = message;
               // BitmapImage btn = new BitmapImage();
              //  btn.BeginInit();
              //  btn.UriSource = new Uri(article.ImagePath, UriKind.Relative);
             //   btn.EndInit();
            try {
                InfoImage.Source = new BitmapImage(new Uri(article.ImagePath));
            }catch(Exception ex) {
                string path = AppDomain.CurrentDomain.BaseDirectory + "images\\png\\noimage.png";
                InfoImage.Source = new BitmapImage(new Uri(path));
            }
            if(!article.IsForShooping && isLearning) {
                btnGet.Visibility = System.Windows.Visibility.Hidden;

                /////////////
                btnCancel.IsDefault = true;
            }
            if ( shopWin.MyBasket.InBasket==null || (!shopWin.MyBasket.InBasket.ContainsKey(article))) {
                btnOut.Visibility=Visibility.Hidden;
            }
            // Insert code required on objsect creation below this point.
        }
コード例 #3
0
ファイル: ProductsTest.cs プロジェクト: pszczesz/sklepik2015
 public void SetUp()
 {
     testProducts = new Products();
     Article testArticle1 = new Article() {
                                              GraphElem = null,
                                              ImagePath = "c:\\ggg.png",
                                              Name = "maslo",
                                              Price = 23.2M,
                                              Quantity = 23.6,
                                              IsForShooping = true,
                                         };
     Article testArticle2 = new Article() {
                                              GraphElem = null,
                                              ImagePath = "c:\\ggg.png",
                                              Name = "mleko",
                                              Price = 0M,
                                              Quantity = 23.6,
                                              IsForShooping = false,
     };
     Article testArticle3 = new Article() {
                                              GraphElem = null,
                                              ImagePath = "c:\\ggg.png",
                                              Name = "cukier",
                                              Price = 15.2m,
                                              Quantity = 100.1,
                                              IsForShooping = true,
     };
     testProducts.AddArticle(testArticle1);
     testProducts.AddArticle(testArticle2);
     testProducts.AddArticle(testArticle3);
 }
コード例 #4
0
ファイル: Products.cs プロジェクト: pszczesz/sklepik2015
 public void AddArticle(Article article)
 {
     if(products == null) {
         products = new List<Article>();
     }
     products.Add(article);
 }
コード例 #5
0
        private Article FillArticle(SklepDBDataSet.ArticlesRow article, string imagePath)
        {
            Article art = new Article();
            art.Name =article.Name;
            art.Price = article.Price;
            art.ImagePath =imagePath+ article.ImagePath;
            art.ImagePathAlt = article.IsImagePathAltNull() ?imagePath+ "noname.png" : imagePath+article.ImagePathAlt;
            art.IsForShooping = article.IsForShoping;
            art.Quantity = article.Quantity;
            art.PlaceNo = article.PlaceNo;
            art.DeskNo = article.DeskNo;

            return art;
        }
コード例 #6
0
ファイル: Basket.cs プロジェクト: pszczesz/sklepik2015
 public void AddToBasket(Article article)
 {
     if (InBasket == null) InBasket = new Dictionary<Article, int>();
     if (InBasket.ContainsKey(article)) {
         int oldQuantity = InBasket[article];
         InBasket[article] = oldQuantity + 1;
         OnPropertyChanged("InBasket");
     }
     else {
         InBasket.Add(article, 1);
         OnPropertyChanged("InBasket");
     }
     UpdateJustShoped();
 }
コード例 #7
0
 public ArticleInfo(Article control)
 {
     InitializeComponent();
     string imageFile = control.ImagePath;
     //string basePath = AppDomain.CurrentDomain.BaseDirectory + "images\\";
     Contener.DataContext = control;
     try {
         ArticleInfoImg.Source = new BitmapImage(new Uri( imageFile));
     } catch {
         string path = AppDomain.CurrentDomain.BaseDirectory + "images\\png\\noimage.png";
         ArticleInfoImg.Source = new BitmapImage(new Uri(path));
         //MessageBox.Show("Nie znaleziono!!");
     }
 }
コード例 #8
0
ファイル: DoShopingTest.cs プロジェクト: pszczesz/sklepik2015
        public void SetUp()
        {
            MyBasket=new Basket();
             toShoping = new Products();

             testShop = new Shop();
             testShop.NameShop = "mój sklep spożywczy";
             Article testArticle1 = new Article() {
                                                     GraphElem = null,
                                                     ImagePath = "c:\\ggg.png",
                                                     Name = "maslo",
                                                     Price = 23.2M,
                                                     Quantity = 23.6,
                                                     IsForShooping = true,
                                                 };
            Article testArticle2 = new Article() {
                                                     GraphElem = null,
                                                     ImagePath = "c:\\ggg.png",
                                                     Name = "mleko",
                                                     Price = 0M,
                                                     Quantity = 23.6,
                                                     IsForShooping = false,
                                                 };
            Article testArticle3 = new Article() {
                                                     GraphElem = null,
                                                     ImagePath = "c:\\ggg.png",
                                                     Name = "cukier",
                                                     Price = 15.2m,
                                                     Quantity = 100.1,
                                                     IsForShooping = true,
                                                 };
            toShoping.AddArticle(testArticle1);
            toShoping.AddArticle(testArticle2);
            toShoping.AddArticle(testArticle3);

             MyClient=new Client(){Cash = 50m,Name = "klient",ToShoping = toShoping};
             ArticlesRepository myArticlesRepository = new ArticlesRepository();
             testShop.AllArticles = myArticlesRepository.GenerSomeOfProducts("images/");
             myDoShoping = new DoShoping(MyClient, MyBasket);
        }
コード例 #9
0
ファイル: Basket.cs プロジェクト: pszczesz/sklepik2015
 public decimal RemoveAllArticles(Article article)
 {
     decimal cashRerurned = 0;
     if (inBasket.ContainsKey(article)) {
         cashRerurned = -article.Price*InBasket[article];
         InBasket.Remove(article);
     }
     UpdateJustShoped();
     return cashRerurned;
 }
コード例 #10
0
ファイル: Basket.cs プロジェクト: pszczesz/sklepik2015
 public int GetQuantityFromBasket(Article article)
 {
     if (InBasket.ContainsKey(article))
         return InBasket[article];
     return 0;
 }
コード例 #11
0
ファイル: Basket.cs プロジェクト: pszczesz/sklepik2015
        public decimal RemoveArticleFromBasket(Article article)
        {
            if (InBasket.ContainsKey(article)) {
                decimal cashReturned;
                int oldValue = InBasket[article];
                if (oldValue > 1) {
                    InBasket[article] = oldValue - 1;

                    cashReturned = (InBasket[article] - oldValue)*article.Price;
                }
                else {
                    InBasket.Remove(article);
                    cashReturned = -1*article.Price;
                }
                UpdateJustShoped();

                return cashReturned;
            }
            return 0;
        }
コード例 #12
0
 public static void BindingPrice(Article article, ArticleControl control)
 {
     control.cena.Text=article.PriceStr();
 }
コード例 #13
0
 public static void BindingName(Article article, ArticleControl control)
 {
     control.nazwa.Text = article.Name;
 }
コード例 #14
0
        public Products GenerSomeOfProducts(string pathToImages)
        {
            var products = new Products();
            #region ArticleTestGener
            var artTest1 = new Article {
                Name = "Maslo",
                ImagePath = pathToImages + "maslo.png",
                GraphElem = null,
                Price = 3.4m,
                Quantity = 100,
                IsForShooping = true,
                PlaceNo = 0,
                DeskNo = 1,
            };
            var artTest2 = new Article {
                Name = "Mleko",
                ImagePath = pathToImages + "mleko.png",
                GraphElem = null,
                Price = 0.89m,
                Quantity = 50,
                IsForShooping = true,
                PlaceNo = 1,
                DeskNo = 1,
            };
            var artTest3 = new Article {
                Name = "Cukier",
                ImagePath = pathToImages + "cukier.png",
                GraphElem = null,
                Price = 3.99m,
                Quantity = 200,
                IsForShooping = false,
                PlaceNo = 2,
                DeskNo = 1,
            };
            var artTest4 = new Article {
                Name = "Śmietana",
                ImagePath = pathToImages + "smietana.png",
                GraphElem = null,
                Price = 1.99m,
                Quantity = 1000,
                IsForShooping = false,
                PlaceNo = 3,
                DeskNo = 1,
            };
            var artTest5 = new Article {
                Name = "Bułka",
                ImagePath = pathToImages + "bulka.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 100,
                IsForShooping = true,
                DeskNo = 1,
            };
            var artTest6 = new Article {
                Name = "Makaron",
                ImagePath = pathToImages + "makaron.png",
                GraphElem = null,
                Quantity = 5.00,
                IsForShooping = false,
                Price = 3.49M,
                DeskNo = 1,
            };
            var artTest7 = new Article {
                Name = "Cukierki",
                ImagePath = pathToImages + "cukierki.png",
                GraphElem = null,
                Price = 7.40m,
                Quantity = 100,
                IsForShooping = false,
                DeskNo = 1,
            };
            var artTest8 = new Article {
                Name = "Czekolada",
                ImagePath = pathToImages + "czekolada.png",
                GraphElem = null,
                Price = 0.89m,
                Quantity = 50,
                IsForShooping = false,
                DeskNo = 2,
            };
            var artTest9 = new Article {
                Name = "Woda gazow.",
                ImagePath = pathToImages + "woda_gaz.png",
                GraphElem = null,
                Price = 3.99m,
                Quantity = 200,
                IsForShooping = false,
                DeskNo = 2,
            };
            var artTest10 = new Article {
                Name = "Kawa",
                ImagePath = pathToImages + "kawa.png",
                GraphElem = null,
                Price = 11.99m,
                Quantity = 1000,
                IsForShooping = false,
                DeskNo = 2,
            };
            var artTest11 = new Article {
                Name = "Ser",
                ImagePath = pathToImages + "ser_z.png",
                GraphElem = null,
                Price = 7.99m,
                Quantity = 100,
                IsForShooping = false,
                DeskNo = 2,
            };
            var artTest12 = new Article {
                Name = "Inna Woda gaz",
                ImagePath = pathToImages + "woda_gaz2.png",
                GraphElem = null,
                Quantity = 5.00,
                IsForShooping = true,
                Price = 1.49M,
            };
            var artTest13 = new Article {
                Name = "Banany",
                ImagePath = pathToImages + "png\\banany2.png",
                GraphElem = null,
                Quantity = 10.00,
                Price = 3.99m,
                IsForShooping = true,
            };
            var artTest14 = new Article {
                Name = "Cukier2",
                ImagePath = pathToImages + "png\\cukier.png",
                GraphElem = null,
                Price = 2.99m,
                Quantity = 100,
                IsForShooping = true,
            };
            var artTest15 = new Article {
                Name = "Kiełbasa zwycz.",
                ImagePath = pathToImages + "png\\kielbasa.png",
                GraphElem = null,
                Price = 7.89m,
                Quantity = 20,
                IsForShooping = true,
                DeskNo = 3,
            };
            var artTest16 = new Article {
                Name = "Żelki cukierki",
                ImagePath = pathToImages + "png\\zelki.png",
                GraphElem = null,
                Price = 4.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 3,
            };
            var artTest17 = new Article {
                Name = "Pasztet",
                ImagePath = pathToImages + "png\\pasztet.png",
                GraphElem = null,
                Price = 6.49m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 3,
            };
            var artTest18 = new Article {
                Name = "Pomarańcze",
                ImagePath = pathToImages + "png\\pomarancze.png",
                GraphElem = null,
                Price = 23.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 3,
            };
            var artTest19 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 3,
            };
            var artTest20 = new Article {
                Name = "pasta do zebow",
                ImagePath = pathToImages + "pasta do zebow.jpg",
                GraphElem = null,
                Price = 13.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 3,
            };
            var artTest21 = new Article {
                Name = "zel pod prysznic",
                ImagePath = pathToImages + "zel pod prysznic.jpg",
                GraphElem = null,
                Price = 10.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 3,
            };
            var artTest22 = new Article {
                Name = "krem nivea",
                ImagePath = pathToImages + "krem nivea.jpg",
                GraphElem = null,
                Price = 3.79m,
                Quantity = 10,
                IsForShooping = true,
            };
            var artTest23 = new Article {
                Name = "szampon do wlosow",
                ImagePath = pathToImages + "szampon do wlosow.jpg",
                GraphElem = null,
                Price = 13.90m,
                Quantity = 10,
                IsForShooping = true,
            };
            var artTest24 = new Article {
                Name = "zel do golenia",
                ImagePath = pathToImages + "zel do golenia.jpg",
                GraphElem = null,
                Price = 15.99m,
                Quantity = 10,
                IsForShooping = true,
            };
            var artTest25 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
            };
            var artTest26 = new Article {
                Name = "mydlo",
                ImagePath = pathToImages + "mydlo.jpg",
                GraphElem = null,
                Price = 2.19m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };

            var artTest27 = new Article {
                Name = "mydlo kostka",
                ImagePath = pathToImages + "mydlo kostka.jpg",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest28 = new Article {
                Name = "plyn do mycia rak",
                ImagePath = pathToImages + "plyn do mycia rak.jpg",
                GraphElem = null,
                Price = 2.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest29 = new Article {
                Name = "prezerwatywy",
                ImagePath = pathToImages + "prezerwatywy.jpg",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest30 = new Article {
                Name = "plyn do plukania ust",
                ImagePath = pathToImages + "plyn do plukania ust.jpg",
                GraphElem = null,
                Price = 19.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest31 = new Article {
                Name = "krem ochronny",
                ImagePath = pathToImages + "krem ochronny.jpg",
                GraphElem = null,
                Price = 10.90m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest32 = new Article {
                Name = "dezodorant",
                ImagePath = pathToImages + "dezodorant.jpg",
                GraphElem = null,
                Price = 11.90m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest33 = new Article {
                Name = "szczoteczka do zebow",
                ImagePath = pathToImages + "szczoteczka do zebow.jpg",
                GraphElem = null,
                Price = 6.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest34 = new Article {
                Name = "oliwka bambino",
                ImagePath = pathToImages + "oliwka bambino.jpg",
                GraphElem = null,
                Price = 11.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest35 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };

            var artTest36 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
                DeskNo = 4,
            };
            var artTest37 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
            };
            var artTest38 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
            };
            var artTest39 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
            };
            var artTest40 = new Article {
                Name = "Papier toaletowy",
                ImagePath = pathToImages + "png\\papier toaletowy.png",
                GraphElem = null,
                Price = 0.99m,
                Quantity = 10,
                IsForShooping = true,
            };

            #endregion
            products.AddArticle(artTest1);
            products.AddArticle(artTest2);
            products.AddArticle(artTest3);
            products.AddArticle(artTest4);
            products.AddArticle(artTest5);
            products.AddArticle(artTest6);

            products.AddArticle(artTest7);
            products.AddArticle(artTest8);
            products.AddArticle(artTest9);
            products.AddArticle(artTest10);
            products.AddArticle(artTest11);
            products.AddArticle(artTest12);
            products.AddArticle(artTest13);
            products.AddArticle(artTest14);
            products.AddArticle(artTest15);
            products.AddArticle(artTest16);
            products.AddArticle(artTest17);
            products.AddArticle(artTest18);
            products.AddArticle(artTest19);
            products.AddArticle(artTest20);
            products.AddArticle(artTest21);
            products.AddArticle(artTest22);
            products.AddArticle(artTest23);
            products.AddArticle(artTest24);
            products.AddArticle(artTest25);
            products.AddArticle(artTest26);
            products.AddArticle(artTest27);
            products.AddArticle(artTest28);
            products.AddArticle(artTest29);
            products.AddArticle(artTest30);
            products.AddArticle(artTest31);
            products.AddArticle(artTest32);
            products.AddArticle(artTest33);
            products.AddArticle(artTest34);
            products.AddArticle(artTest35);
            products.AddArticle(artTest36);
            products.AddArticle(artTest37);
            products.AddArticle(artTest38);
            products.AddArticle(artTest39);
            products.AddArticle(artTest40);
            generProducts = products;

                return products;
        }
コード例 #15
0
 private void WeHaveShoping(Article getColisionWith, bool isLearning)
 {
     DoShoping doShoping = new DoShoping(client,myBasket);
     string message;
     if (getColisionWith.IsForShooping || !isLearning) {
       /*  message = "Możesz kupić artykuł: " + getColisionWith.Name + "\n w cenie "
                          + getColisionWith.Price.ToString("C2") + ".\n"
                          + "Obecnie masz : " + client.CashString;
         MessageBoxResult dialogResult = MessageBox.Show(message, "Czy kupujesz?\n", MessageBoxButton.YesNo);
         if (dialogResult == MessageBoxResult.Yes) {
             doShoping.ArticleToBasket(getColisionWith);
        *  UpdateBasketList();
         */
             message = "Możesz kupić artykuł:\n " + getColisionWith.Name + "\n w cenie "
                          + getColisionWith.Price.ToString("C2") + ".\n"
                          + "Obecnie masz : " + client.CashString;
             TransWindow newTransWindow = new TransWindow(this,getColisionWith,message,doShoping,isLearning);
         newTransWindow.ShowDialog();
         }
      else {
         message = "Nie możesz kupić tego towaru!";
         TransWindow newTransWindow = new TransWindow(this, getColisionWith, message,doShoping,isLearning);
         newTransWindow.ShowDialog();
     }
 }