Exemplo n.º 1
0
        // End books----------------------------------------------------------------------------------------------------------------------------------------------



        ////////////////////////////
        ///////////// Creating ORDER
        ////////////////////////////
        ///

        public void createOrder() // ДОБАВИТЬ ОЧИСТКУ И ЗАКРЫТИЕ КОРЗИНЫ ПОСЛЕ ПОДТВЕРЖДЕНИЯ ЗАКАЗА!!!!!!!!
        {
            void addingToBookPurchase()
            {
                for (int i = 0; i < getBooksInBasket().Count; i++)
                {
                    if (getBooksInBasket()[i].infoComboQuantitySelected() > 0)
                    {
                        workServerBasket.createBookPurchaseTable(getBooksInBasket()[i].Title, getBooksInBasket()[i].Author, getBooksInBasket()[i].Price,
                                                                 getBooksInBasket()[i].infoComboQuantitySelected(),
                                                                 workServerBasket.UsersId(UserNameLabelBasket.Text));
                        workServerBasket.updateQuantityItemsInTables(getBooksInBasket()[i].getNameTable(), getBooksInBasket()[i].Title,
                                                                     getBooksInBasket()[i].infoComboQuantityAmount() - getBooksInBasket()[i].infoComboQuantitySelected());
                    }
                }
            }

            void addingToClothesPurchase()
            {
                for (int i = 0; i < getClothesInBasket().Count; i++)
                {
                    if (getClothesInBasket()[i].infoComboQuantitySelected() > 0)
                    {
                        workServerBasket.createClothesPurchaseTable(getClothesInBasket()[i].Title, getClothesInBasket()[i].Brand, getClothesInBasket()[i].Material,
                                                                    getClothesInBasket()[i].Sex, getClothesInBasket()[i].Price,
                                                                    getClothesInBasket()[i].infoComboQuantitySelected(),
                                                                    workServerBasket.UsersId(UserNameLabelBasket.Text));
                        workServerBasket.updateQuantityItemsInTables(getClothesInBasket()[i].getNameTable(), getClothesInBasket()[i].Title,
                                                                     getClothesInBasket()[i].infoComboQuantityAmount() - getClothesInBasket()[i].infoComboQuantitySelected());
                    }
                }
            }

            void addingToLaptopsPcsPurchase()
            {
                for (int i = 0; i < getLaptopsPcsInBasket().Count; i++)
                {
                    if (getLaptopsPcsInBasket()[i].infoComboQuantitySelected() > 0)
                    {
                        workServerBasket.createLaptopsPcsPurchaseTable(getLaptopsPcsInBasket()[i].Title, getLaptopsPcsInBasket()[i].CPU, getLaptopsPcsInBasket()[i].RAM,
                                                                       getLaptopsPcsInBasket()[i].HDD, getLaptopsPcsInBasket()[i].SSD, getLaptopsPcsInBasket()[i].GPU,
                                                                       getLaptopsPcsInBasket()[i].OS, getLaptopsPcsInBasket()[i].Price,
                                                                       getLaptopsPcsInBasket()[i].infoComboQuantitySelected(),
                                                                       workServerBasket.UsersId(UserNameLabelBasket.Text));
                        workServerBasket.updateQuantityItemsInTables(getLaptopsPcsInBasket()[i].getNameTable(), getLaptopsPcsInBasket()[i].Title,
                                                                     getLaptopsPcsInBasket()[i].infoComboQuantityAmount() - getLaptopsPcsInBasket()[i].infoComboQuantitySelected());
                    }
                }
            }

            void addingToHphonesPurchase()
            {
                for (int i = 0; i < getHphonesInBasket().Count; i++)
                {
                    if (getHphonesInBasket()[i].infoComboQuantitySelected() > 0)
                    {
                        workServerBasket.createHphonesPurchaseTable(getHphonesInBasket()[i].Title, getHphonesInBasket()[i].Mic, getHphonesInBasket()[i].Type,
                                                                    getHphonesInBasket()[i].WorkingHours, getHphonesInBasket()[i].Resistance,
                                                                    getHphonesInBasket()[i].Price, getHphonesInBasket()[i].infoComboQuantitySelected(),
                                                                    workServerBasket.UsersId(UserNameLabelBasket.Text));
                        workServerBasket.updateQuantityItemsInTables(getHphonesInBasket()[i].getNameTable(), getHphonesInBasket()[i].Title,
                                                                     getHphonesInBasket()[i].infoComboQuantityAmount() - getHphonesInBasket()[i].infoComboQuantitySelected());
                    }
                }
            }

            void addingToTvsPurchase()
            {
                for (int i = 0; i < getTvsInBasket().Count; i++)
                {
                    if (getTvsInBasket()[i].infoComboQuantitySelected() > 0)
                    {
                        workServerBasket.createTvsPurchaseTable(getTvsInBasket()[i].Title, getTvsInBasket()[i].ScreenDiagonal, getTvsInBasket()[i].Resolution,
                                                                getTvsInBasket()[i].Features, getTvsInBasket()[i].Price, getTvsInBasket()[i].infoComboQuantitySelected(),
                                                                workServerBasket.UsersId(UserNameLabelBasket.Text));
                        workServerBasket.updateQuantityItemsInTables(getTvsInBasket()[i].getNameTable(), getTvsInBasket()[i].Title,
                                                                     getTvsInBasket()[i].infoComboQuantityAmount() - getTvsInBasket()[i].infoComboQuantitySelected());
                    }
                }
            }

            void addingToSmartWatchesPurchase()
            {
                for (int i = 0; i < getSmartWatchInBasket().Count; i++)
                {
                    if (getSmartWatchInBasket()[i].infoComboQuantitySelected() > 0)
                    {
                        workServerBasket.createSmartWathesTable(getSmartWatchInBasket()[i].Title, getSmartWatchInBasket()[i].CompatibleOS,
                                                                getSmartWatchInBasket()[i].Sensors, getSmartWatchInBasket()[i].ScreenResolution,
                                                                getSmartWatchInBasket()[i].Price, getSmartWatchInBasket()[i].infoComboQuantitySelected(),
                                                                workServerBasket.UsersId(UserNameLabelBasket.Text));
                        workServerBasket.updateQuantityItemsInTables(getSmartWatchInBasket()[i].getNameTable(), getSmartWatchInBasket()[i].Title,
                                                                     getSmartWatchInBasket()[i].infoComboQuantityAmount() - getSmartWatchInBasket()[i].infoComboQuantitySelected());
                    }
                }
            }

            void addingToSmartPhonesPurchase()
            {
                for (int i = 0; i < getSmartPhonesInBasket().Count; i++)
                {
                    if (getSmartPhonesInBasket()[i].infoComboQuantitySelected() > 0)
                    {
                        workServerBasket.createSmartPhonesTable(getSmartPhonesInBasket()[i].Title, getSmartPhonesInBasket()[i].InternalMemory,
                                                                getSmartPhonesInBasket()[i].Ram, getSmartPhonesInBasket()[i].CameraResolution,
                                                                getSmartPhonesInBasket()[i].ScreenDiagonal, getSmartPhonesInBasket()[i].Capacity,
                                                                getSmartPhonesInBasket()[i].Price, getSmartPhonesInBasket()[i].infoComboQuantitySelected(),
                                                                workServerBasket.UsersId(UserNameLabelBasket.Text));
                        workServerBasket.updateQuantityItemsInTables(getSmartPhonesInBasket()[i].getNameTable(), getSmartPhonesInBasket()[i].Title,
                                                                     getSmartPhonesInBasket()[i].infoComboQuantityAmount() - getSmartPhonesInBasket()[i].infoComboQuantitySelected());
                    }
                }
            }

            addingToBookPurchase();
            addingToClothesPurchase();
            addingToLaptopsPcsPurchase();
            addingToHphonesPurchase();
            addingToTvsPurchase();
            addingToSmartWatchesPurchase();
            addingToSmartPhonesPurchase();
        }