Ejemplo n.º 1
0
        public CatalogPage(GoodsCategory item, List <string> GoodsNameCart1, List <CartGoods> GoodsCartList1, List <int> GoodsPiece)
        {
            InitializeComponent();
            GoodsNameCart = GoodsNameCart1;
            GoodsCartList = GoodsCartList1;
            Piece         = GoodsPiece;
            AddGoodsCategory();
            AddGoodsInformation();
            AddGoodsImage();
            AddGoodsToCatalog();
            DisplayDatabase();
            GetValueForShopCartInfo(GoodsCartList);


            List <Goods>            goods1            = GoodsDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsCategory>    goodscategory1    = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsInformation> goodsinformation1 = GoodsInformationDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsImage>       goodsimage1       = GoodsImageDatabase.GetItemsNotDoneAsync().Result;

            var query = from goods in goods1
                        join goodscategory in goodscategory1 on goods.GoodsCategoryID equals goodscategory.GoodsCategoryID
                        where goodscategory.Category == item.Category
                        join goodsinformation in goodsinformation1 on goods.GoodsInformationID equals goodsinformation.GoodsInformationID
                        join goodsimage in goodsimage1 on goods.GoodsImageID equals goodsimage.ImageID
                        select new { Name = goods.Name, Price = goods.Price, Category = goodscategory.Category, Type = goodsinformation.Type, ImageName = goodsimage.ImageName };

            GoodsListview.ItemsSource = query;
        }
Ejemplo n.º 2
0
        public DetailPage(Goods selectedgoods, List <string> GoodsNameFromCart, List <CartGoods> GoodsFromCart, List <int> PieceList1)
        {
            InitializeComponent();
            GoodsName     = GoodsNameFromCart;
            GoodsCartList = GoodsFromCart;
            PieceList     = PieceList1;
            GetValueForShopCartInfo(GoodsCartList);
            List <Goods> goods1 = GoodsDatabase.GetItemsNotDoneAsync().Result;


            Goods goods = new Goods();

            for (int i = 0; i < goods1.Count; i++)
            {
                if (selectedgoods.Name.Equals(goods1[i].Name))
                {
                    goods = goods1[i];
                }
            }
            var category          = GoodsCategoryDatabase.GetItemAsync(goods.GoodsCategoryID).Result;
            var information       = GoodsInformationDatabase.GetItemAsync(goods.GoodsInformationID).Result;
            var queryofcatefories = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
            var queryofimage      = GoodsImageDatabase.GetItemAsync(goods.GoodsImageID).Result;

            ListViewOfCategories.ItemsSource = queryofcatefories;
            Name.Text            = goods.Name;
            YearOfRealising.Text = information.YearOfRealising.ToString();
            Category.Text        = category.Category;
            Type.Text            = information.Type.ToString();
            Price.Text           = goods.Price.ToString() + " Kc";
            Buy_Button.Tag       = goods.Name;
            Description.Text     = information.Description.ToString();

            ImageOfAlbum.Source = new BitmapImage(new Uri($"{queryofimage.ImageName}", UriKind.Relative));
        }
Ejemplo n.º 3
0
        private void Search_Click(object sender, RoutedEventArgs e)
        {
            string SearchWord                         = Search.Text.ToString();
            var    queryofsearchingword               = GoodsDatabase.GetSearchWord(SearchWord).Result;
            List <GoodsCategory>    goodscategory1    = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsInformation> goodsinformation1 = GoodsInformationDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsImage>       goodsimage1       = GoodsImageDatabase.GetItemsNotDoneAsync().Result;

            var query = from goods in queryofsearchingword
                        join goodscategory in goodscategory1 on goods.GoodsCategoryID equals goodscategory.GoodsCategoryID
                        join goodsinformation in goodsinformation1 on goods.GoodsInformationID equals goodsinformation.GoodsInformationID
                        join goodsimage in goodsimage1 on goods.GoodsImageID equals goodsimage.ImageID
                        select new { Name = goods.Name, Price = goods.Price, Category = goodscategory.Category, Type = goodsinformation.Type, ImageName = goodsimage.ImageName };

            GoodsListview.ItemsSource = query;
        }
Ejemplo n.º 4
0
        private void ListViewOfCategories_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ListViewOfCategories.SelectedItem != null)
            {
                var item = ListViewOfCategories.SelectedItem as GoodsCategory;


                List <Goods>            goods1            = GoodsDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsCategory>    goodscategory1    = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsInformation> goodsinformation1 = GoodsInformationDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsImage>       goodsimage1       = GoodsImageDatabase.GetItemsNotDoneAsync().Result;

                var query = from goods in goods1
                            join goodscategory in goodscategory1 on goods.GoodsCategoryID equals goodscategory.GoodsCategoryID
                            where goodscategory.Category == item.Category
                            join goodsinformation in goodsinformation1 on goods.GoodsInformationID equals goodsinformation.GoodsInformationID
                            join goodsimage in goodsimage1 on goods.GoodsImageID equals goodsimage.ImageID
                            select new { Name = goods.Name, Price = goods.Price, Category = goodscategory.Category, Type = goodsinformation.Type, ImageName = goodsimage.ImageName };

                GoodsListview.ItemsSource = query;
            }
        }
Ejemplo n.º 5
0
        public void AddGoodsImage()
        {
            //DisplayDatabase();
            string[] ImageName = new string[] { "Assets/AntiFlag-UndergroundNetwork.jpg", "Assets/Blink182-EnemaOfTheState.jpg", "Assets/BoxCarRacer-Album.jpg", "Assets/GoodCharlote-TheYoungAndTheHopeless.jpg", "Assets/GreenDay-AmericanIdiot.jpg", "Assets/SimplePlan-StillNotGetAny.jpg", "Assets/Sum41-AllKillerNoFiller.jpg" };

            for (int i = 0; i < ImageName.Length; i++)
            {
                GoodsImage image = new GoodsImage();
                image.ImageName = ImageName[i];
                int count = 0;
                foreach (GoodsImage item in GoodsImageDatabase.GetItemsAsync().Result)
                {
                    if (item.ImageName.Equals(ImageName[i]))
                    {
                        count += 1;
                    }
                }
                if (count == 0)
                {
                    GoodsImageDatabase.SaveItemAsync(image);
                }
            }
        }
Ejemplo n.º 6
0
        private void DisplayDatabase()
        {
            List <Goods>            goods1            = GoodsDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsCategory>    goodscategory1    = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsInformation> goodsinformation1 = GoodsInformationDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsImage>       goodsimage1       = GoodsImageDatabase.GetItemsNotDoneAsync().Result;

            var query = from goods in goods1
                        join goodscategory in goodscategory1 on goods.GoodsCategoryID equals goodscategory.GoodsCategoryID
                        join goodsinformation in goodsinformation1 on goods.GoodsInformationID equals goodsinformation.GoodsInformationID
                        join goodsimage in goodsimage1 on goods.GoodsImageID equals goodsimage.ImageID
                        select new { Name = goods.Name, Price = goods.Price, Category = goodscategory.Category, Type = goodsinformation.Type, ImageName = goodsimage.ImageName };

            var queryofcategories = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;

            Debug.WriteLine(goods1.Count);
            foreach (Goods Item in goods1)
            {
                Debug.WriteLine(Item);
            }
            GoodsListview.ItemsSource        = query;
            ListViewOfCategories.ItemsSource = queryofcategories;
        }
Ejemplo n.º 7
0
        public void GetJoinedDatatable(string selectedtext)
        {
            List <Goods> goods1 = new List <Goods>();

            if (selectedtext.Equals("dle nazvu"))
            {
                goods1 = GoodsDatabase.GetGoodsByName().Result;
            }
            else if (selectedtext.Equals("od nejlevnejsiho"))
            {
                goods1 = GoodsDatabase.GetGoodsByLowestPrice().Result;
            }
            else if (selectedtext.Equals("od nejdrazsiho"))
            {
                goods1 = GoodsDatabase.GetGoodsByHighestPrice().Result;
            }

            List <GoodsCategory>    goodscategory1    = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsInformation> goodsinformation1 = GoodsInformationDatabase.GetItemsNotDoneAsync().Result;
            List <GoodsImage>       goodsimage1       = GoodsImageDatabase.GetItemsNotDoneAsync().Result;

            var query = from goods in goods1
                        join goodscategory in goodscategory1 on goods.GoodsCategoryID equals goodscategory.GoodsCategoryID
                        join goodsinformation in goodsinformation1 on goods.GoodsInformationID equals goodsinformation.GoodsInformationID
                        join goodsimage in goodsimage1 on goods.GoodsImageID equals goodsimage.ImageID
                        select new { Name = goods.Name, Price = goods.Price, Category = goodscategory.Category, Type = goodsinformation.Type, ImageName = goodsimage.ImageName };

            var queryofcategories = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;

            Debug.WriteLine(goods1.Count);
            foreach (Goods Item in goods1)
            {
                Debug.WriteLine(Item);
            }
            GoodsListview.ItemsSource        = query;
            ListViewOfCategories.ItemsSource = queryofcategories;
        }
Ejemplo n.º 8
0
        private void OrderBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string value = OrderBox.SelectedItem.ToString();

            ComboBoxItem cbi          = (ComboBoxItem)OrderBox.SelectedItem;
            string       selectedText = cbi.Content.ToString();

            if (selectedText.Equals("neseřazeno"))
            {
            }

            if (selectedText.Equals("dle nazvu"))
            {
                GetJoinedDatatable(selectedText);
            }

            if (selectedText.Equals("od nejlevnejsiho"))
            {
                GetJoinedDatatable(selectedText);
            }

            if (selectedText.Equals("od nejdrazsiho"))
            {
                GetJoinedDatatable(selectedText);
            }

            if (selectedText.Equals("od nejnovejsiho"))
            {
                List <Goods>            goods1            = GoodsDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsCategory>    goodscategory1    = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsInformation> goodsinformation1 = GoodsInformationDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsImage>       goodsimage1       = GoodsImageDatabase.GetItemsNotDoneAsync().Result;

                var query = from goods in goods1
                            join goodscategory in goodscategory1 on goods.GoodsCategoryID equals goodscategory.GoodsCategoryID
                            join goodsinformation in goodsinformation1 on goods.GoodsInformationID equals goodsinformation.GoodsInformationID
                            join goodsimage in goodsimage1 on goods.GoodsImageID equals goodsimage.ImageID
                            orderby goodsinformation.YearOfRealising descending
                            select new { Name = goods.Name, Price = goods.Price, Category = goodscategory.Category, Type = goodsinformation.Type, ImageName = goodsimage.ImageName };

                var queryofcategories = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;

                Debug.WriteLine(goods1.Count);
                foreach (Goods Item in goods1)
                {
                    Debug.WriteLine(Item);
                }
                GoodsListview.ItemsSource        = query;
                ListViewOfCategories.ItemsSource = queryofcategories;
            }

            if (selectedText.Equals("od nejstarsiho"))
            {
                List <Goods>            goods1            = GoodsDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsCategory>    goodscategory1    = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsInformation> goodsinformation1 = GoodsInformationDatabase.GetItemsNotDoneAsync().Result;
                List <GoodsImage>       goodsimage1       = GoodsImageDatabase.GetItemsNotDoneAsync().Result;

                var query = from goods in goods1
                            join goodscategory in goodscategory1 on goods.GoodsCategoryID equals goodscategory.GoodsCategoryID
                            join goodsinformation in goodsinformation1 on goods.GoodsInformationID equals goodsinformation.GoodsInformationID
                            join goodsimage in goodsimage1 on goods.GoodsImageID equals goodsimage.ImageID
                            orderby goodsinformation.YearOfRealising
                            select new { Name = goods.Name, Price = goods.Price, Category = goodscategory.Category, Type = goodsinformation.Type, ImageName = goodsimage.ImageName };

                var queryofcategories = GoodsCategoryDatabase.GetItemsNotDoneAsync().Result;

                Debug.WriteLine(goods1.Count);
                foreach (Goods Item in goods1)
                {
                    Debug.WriteLine(Item);
                }
                GoodsListview.ItemsSource        = query;
                ListViewOfCategories.ItemsSource = queryofcategories;
            }
        }