Exemple #1
0
        // Added items from books---------------------------------------------------------------------------------------
        public void completeBooksItem(string table)
        {
            List <String> title    = new List <String>();
            List <String> author   = new List <String>();
            List <int>    price    = new List <int>();
            List <int>    quantity = new List <int>();

            workServerOnMainInterface.createInfoBooksArray(table, ref title, ref author, ref price, ref quantity);
            if (title.Count == author.Count && title.Count == price.Count && title.Count == quantity.Count)
            {
                flowLayoutPanel.Controls.Clear();
                manageBook = new ManageBook();
                for (int i = 0; i < title.Count; i++)
                {
                    string[] quantityCombo = new string[quantity[i] + 1];
                    for (int j = 0; j < quantityCombo.Length; j++)
                    {
                        quantityCombo[j] = (j).ToString();
                    }
                    manageBook.createBook(title[i], author[i], price[i], quantity[i], quantityCombo, basketItems, table /*, new Bitmap(@"D:\Лабораторки_С#\Course\ProjectImages\cancel.png")*/);
                }

                for (int i = 0; i < manageBook.getAllManageBooks().Count; i++)
                {
                    flowLayoutPanel.Controls.Add(manageBook.getAllManageBooks()[i]);
                }
            }
        }
Exemple #2
0
 public void addBooksToBasket(ManageBook manageBook)
 {
     for (int i = 0; i < manageBook.getAllManageBooks().Count; i++)
     {
         int newQuantityItems = manageBook.getAllManageBooks()[i].infoComboQuantitySelected();  // to update quantity of product
         if (newQuantityItems > 0)
         {
             if (!basketItems.checkSimilarAddedBook(manageBook.getAllManageBooks()[i]))
             {
                 basketItems.addBooksItems(manageBook.getAllManageBooks()[i]);
             }
         }
     }
 }