Esempio 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;
        }
Esempio 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));
        }
Esempio n. 3
0
        public void AddGoodsToCatalog()
        {
            //DisplayDatabase();
            GoodsName = new string[] { "Blink-182 - Enema of the State", "Simple Plan - Still Not Getting Any...", "Good Charlotte - The Young and the Hopeless", "Sum 41 - All Killer No Filler", "Anti-Flag - Underground Network", "Green day - American Idiot", "Boxcar Racer - Boxcar Racer" };
            int[] GoodsPrice       = new int[] { 449, 329, 249, 229, 319, 399, 239 };
            int[] GoodsCategory    = new int[] { 1, 1, 2, 2, 1, 1, 2 };
            int[] GoodsInformation = new int[] { 1, 2, 3, 4, 5, 6, 7 };
            int[] GoodsImage       = new int[] { 1, 2, 3, 4, 5, 6, 7 };

            for (int i = 0; i < GoodsName.Length; i++)
            {
                Goods goods = new Goods();
                goods.Name               = GoodsName[i];
                goods.Price              = GoodsPrice[i];
                goods.GoodsCategoryID    = GoodsCategory[i];
                goods.GoodsInformationID = GoodsInformation[i];
                goods.GoodsImageID       = GoodsImage[i];
                int count = 0;
                foreach (Goods item in GoodsDatabase.GetItemsAsync().Result)
                {
                    if (item.Name.Equals(GoodsName[i]))
                    {
                        count += 1;
                    }
                }
                if (count == 0)
                {
                    GoodsDatabase.SaveItemAsync(goods);
                }
            }
        }
Esempio n. 4
0
        public List <Goods> GetGoodsToList(List <OrderGoods> ordergoods)
        {
            List <Goods> goodslist = new List <Goods>();

            for (int i = 0; i < ordergoods.Count; i++)
            {
                var goods = GoodsDatabase.GetItemAsyncByID(ordergoods[i].GoodsID).Result;
                goodslist.Add(goods);
            }

            return(goodslist);
        }
Esempio n. 5
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;
        }
Esempio n. 6
0
        private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (GoodsListview.SelectedItem != null)
            {
                var item = GoodsListview.SelectedItem;

                for (int i = 0; i < GoodsName.Length; i++)
                {
                    if (item.ToString().Contains(GoodsName[i]))
                    {
                        var goods            = GoodsDatabase.GetItemAsync(GoodsName[i]).Result;
                        NavigationService ns = NavigationService.GetNavigationService(this);
                        ns.Navigate(new DetailPage(goods, GoodsNameCart, GoodsCartList, Piece));
                    }
                }
            }
        }
Esempio n. 7
0
 public ShopPage(List <string> GoodsNameFromCatalog, List <int> GoodsPiece)
 {
     InitializeComponent();
     GoodsName = GoodsNameFromCatalog;
     Piece     = GoodsPiece;
     for (int i = 0; i < GoodsName.Count; i++)
     {
         Goods     goods     = GoodsDatabase.GetItemAsync(GoodsName[i]).Result;
         CartGoods CartGoods = new CartGoods();
         CartGoods.GoodsID       = goods.GoodsID;
         CartGoods.Name          = goods.Name;
         CartGoods.Price         = goods.Price;
         CartGoods.GoodsQauntity = Piece[i];
         CartGoods.TotalPrice    = Piece[i] * goods.Price;
         CartGoodsList.Add(CartGoods);
     }
     listView.ItemsSource = CartGoodsList;
     GetValueForShopCartInfo(CartGoodsList);
 }
Esempio n. 8
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;
            }
        }
Esempio n. 9
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;
        }
Esempio n. 10
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;
        }
Esempio n. 11
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;
            }
        }
Esempio n. 12
0
        public FinishPage(PotentialCustomer Customer1, Transport TransportToSend, List <string> GoodsName, List <CartGoods> GoodsInCart, List <int> Piece1)
        {
            InitializeComponent();
            Piece = Piece1;

            Address Address = new Address();

            Address.Street     = Customer1.Street;
            Address.Town       = Customer1.Town;
            Address.PostNumber = int.Parse(Customer1.PostCode.ToString());
            AddressDatabase.SaveItemAsync(Address);
            DebugMethod();

            ContactInformation Contact = new ContactInformation();

            Contact.Email = Customer1.Mail;
            Contact.Phone = Customer1.Phone;
            ContactInformationDatabase.SaveItemAsync(Contact);
            DebugMethod();

            Customer Customer = new Customer();

            Customer.AddressID            = Address.AddressID;
            Customer.ContactInformationID = Contact.ContactInformationID;
            Customer.Name    = Customer1.Name;
            Customer.Surname = Customer1.Surname;
            CustomerDatabase.SaveItemAsync(Customer);
            DebugMethod();

            OrderTransport Transport = new OrderTransport();

            Transport.TypeOfTransport = TransportToSend.Name;
            Transport.Price           = TransportToSend.Price;
            OrderTransportDatabase.SaveItemAsync(Transport);
            DebugMethod();

            Random r   = new Random();
            int    rnd = r.Next();

            int TotalPrice = 0;

            for (int i = 0; i < GoodsInCart.Count; i++)
            {
                TotalPrice += GoodsInCart[i].TotalPrice;
            }

            TotalPrice += Transport.Price;
            Order Order = new Order();

            Order.CustomerID  = Customer.CustomerID;
            Order.TransportID = Transport.TransportID;

            Order.OrderNumber = rnd;
            Order.OrderPrice  = TotalPrice;
            OrderDatabase.SaveItemAsync(Order);
            DebugMethod();

            Number.Text = Order.OrderNumber.ToString();

            List <Customer> clist = new List <Customer>();

            clist = CustomerDatabase.GetItemsAsync().Result;

            for (int i = 0; i < GoodsName.Count; i++)
            {
                OrderGoods OrderGoods = new OrderGoods();
                OrderGoods.OrderID = Order.OrderID;
                Goods goods = GoodsDatabase.GetItemAsync(GoodsName[i]).Result;
                OrderGoods.GoodsQauntity = GoodsInCart[i].GoodsQauntity;
                OrderGoods.GoodsID       = goods.GoodsID;
                OrderGoodsDatabase.SaveItemAsync(OrderGoods);
                DebugMethod();
            }

            var ordergoods = OrderGoodsDatabase.GetItemsAsync().Result;
            var order      = OrderDatabase.GetItemsAsync().Result;
        }