Пример #1
0
        private void pbAddCart_Click(object sender, EventArgs e)
        {
            Logger.logger(musicCD.name + " Form Add Cart");
            if (mtQuantity.Text != "" && int.Parse(mtQuantity.Text) != 0)
            {
                foreach (var it in MainForm.shoppingCart.ItemsToPurchase)
                {
                    if (it.Product == this.musicCD)
                    {
                        it.Quantity += int.Parse(mtQuantity.Text);

                        if (it.Quantity > 99)
                        {
                            MessageBox.Show("You have reached maximum capacity." + Environment.NewLine + "Max Capacity: 99", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            it.Quantity = 99;
                        }
                        else
                        {
                            MessageBox.Show(int.Parse(mtQuantity.Text) + " " + it.Product.name + " has been added to your shopping cart.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        return;
                    }
                }
                ItemToPurchase item = new ItemToPurchase();
                item.Product  = this.musicCD;
                item.Quantity = int.Parse(mtQuantity.Text);
                MainForm.shoppingCart.ItemsToPurchase.Add(item);
                MessageBox.Show(item.Quantity + " " + item.Product.name + " has been added to your shopping cart.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        public void create(ItemToPurchase item)
        {
            this.item = item;
            this.Size = new Size(180, 110);

            this.BackColor   = Color.Transparent;
            this.BorderStyle = BorderStyle.FixedSingle;
            this.Visible     = true;

            PictureBox picture = new PictureBox();

            picture.Size     = new Size(40, 65);
            picture.Image    = item.product.Image;
            picture.SizeMode = PictureBoxSizeMode.StretchImage;
            picture.Location = new Point(65, 10);

            Label lblname = new Label();

            lblname.Size      = new Size(165, 20);
            lblname.Font      = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular);
            lblname.TextAlign = ContentAlignment.MiddleCenter;
            lblname.Text      = item.product.Name1;
            lblname.Location  = new System.Drawing.Point(0, 80);

            this.Controls.Add(picture);
            this.Controls.Add(lblname);
        }
Пример #3
0
 /// <summary>
 /// This function deletes according to product name all products from cart.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnCancelItem_Click(object sender, EventArgs e)
 {
     Logger.log("Click to Cancel " + lblName.Text + " Button.");
     try
     {
         DialogResult dialogResult = new DialogResult();
         dialogResult = MessageBox.Show("Are you sure you want to cancel the product?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
         if (dialogResult == DialogResult.Yes)
         {
             CancelControl = true;
             for (int i = 0; i < int.Parse(lblProductQuantitiy.Text); i++)
             {
                 ItemToPurchase item = new ItemToPurchase();
                 item.Product  = Temp_product;
                 item.Quantity = 1;
                 MainWindow.cart.removeProduct(item);
                 Util.FillShoppingListScreen();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         Logger.log("Exception: " + ex.Message);
     }
 }
Пример #4
0
 public string[] printProducts(ItemToPurchase myitem)
 {
     //string[] row = { (this.m_customerId).ToString(), this.m_paymentAmount.ToString(), this.m_paymentType, myitem.getProduct(), myitem.getQuantity().ToString() };
     //return row;
     string[] row = { myitem.getProduct().getID().ToString(), myitem.getProduct().getName(), myitem.getProduct().getPrice().ToString() + "TL", myitem.getQuantity().ToString() };
     return(row);
 }
Пример #5
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            Logger.log("Click to Delete from Cart " + lblMusicCDName.Text + " Book Button.");
            lblProductNumber.Text = (int.Parse(lblProductNumber.Text) + 1).ToString();
            ItemToPurchase item = new ItemToPurchase();

            item.Product  = new MusicCD(lblMusicCDName.Text, lblMusicCDPrice.Text, ID, picBox);
            item.Quantity = 1;
            MainWindow.cart.addProduct(item);
        }
Пример #6
0
 /// <summary>
 /// This function subtracts the selected product from customer's cart.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubtractProduct_Click(object sender, EventArgs e)
 {
     Logger.log("Click to Delete from Cart " + lblMagazineName.Text + " Book Button.");
     if (int.Parse(lblProductNumber.Text) > 0)
     {
         lblProductNumber.Text = (int.Parse(lblProductNumber.Text) - 1).ToString();
         ItemToPurchase item = new ItemToPurchase();
         item.Product  = new Magazine(lblMagazineName.Text, lblPrice.Text);
         item.Quantity = 1;
         MainWindow.cart.removeProduct(item);
     }
 }
Пример #7
0
        private void btnAddProduct_Click_1(object sender, EventArgs e)
        {
            if (cbProductQuantity.Text == "")
            {
                MessageBox.Show("Please Set Quantity!");
            }
            else
            {
                CreatorProduct myProduct = new CreatorProduct();
                string[]       myArray   = new string[2];
                myArray = ProductTypeControl();



                if (myArray[0] == "Book")
                {
                    Product myBook = myProduct.FactoryMethod(ProductType.Book);
                    myBook.setID(Convert.ToInt32(listBook.Items[Convert.ToInt32(myArray[1])].SubItems[0].Text));
                    myBook.setName(listBook.Items[Convert.ToInt32(myArray[1])].SubItems[1].Text);
                    myBook.setPrice(Convert.ToInt32(listBook.Items[Convert.ToInt32(myArray[1])].SubItems[2].Text));
                    ItemToPurchase item = new ItemToPurchase(myBook, Convert.ToInt32(cbProductQuantity.Text));
                    myShoppingCart.addProduct(item);
                    string[] row  = myShoppingCart.printProducts(item);
                    var      line = new ListViewItem(row);
                    listProducts.Items.Add(line);
                }
                else if (myArray[0] == "MusicCD")
                {
                    Product myMusicCD = myProduct.FactoryMethod(ProductType.MusicCD);
                    myMusicCD.setID(Convert.ToInt32(listMusicCD.Items[Convert.ToInt32(myArray[1])].SubItems[0].Text));
                    myMusicCD.setName(listMusicCD.Items[Convert.ToInt32(myArray[1])].SubItems[1].Text);
                    myMusicCD.setPrice(Convert.ToInt32(listMusicCD.Items[Convert.ToInt32(myArray[1])].SubItems[2].Text));
                    ItemToPurchase item = new ItemToPurchase(myMusicCD, Convert.ToInt32(cbProductQuantity.Text));
                    myShoppingCart.addProduct(item);
                    string[] row  = myShoppingCart.printProducts(item);
                    var      line = new ListViewItem(row);
                    listProducts.Items.Add(line);
                }
                else if (myArray[0] == "Magazine")
                {
                    Product myMagazine = myProduct.FactoryMethod(ProductType.Magazine);
                    myMagazine.setID(Convert.ToInt32(listMagazine.Items[Convert.ToInt32(myArray[1])].SubItems[0].Text));
                    myMagazine.setName(listMagazine.Items[Convert.ToInt32(myArray[1])].SubItems[1].Text);
                    myMagazine.setPrice(Convert.ToInt32(listMagazine.Items[Convert.ToInt32(myArray[1])].SubItems[2].Text));
                    ItemToPurchase item = new ItemToPurchase(myMagazine, Convert.ToInt32(cbProductQuantity.Text));
                    myShoppingCart.addProduct(item);
                    string[] row  = myShoppingCart.printProducts(item);
                    var      line = new ListViewItem(row);
                    listProducts.Items.Add(line);
                }
            }
        }
Пример #8
0
 public void removeProduct(ItemToPurchase item)
 {
     ItemsToPurchase.Remove(item);
     foreach (var it in list)
     {
         if (it.item == item)
         {
             list.Remove(it);
             break;
         }
     }
     refreshPanel();
 }
Пример #9
0
 private void btnAddToCart_Click(object sender, EventArgs e)
 {
     if (tbMagazineName.Text != "" || tbMusicCDName.Text != "" || txtBookName.Text != "")
     {
         ItemToPurchase Item1 = new ItemToPurchase();
         Book           book  = new Book("0", txtBookName.Text, Convert.ToDouble(txtBookPrice.Text));
         Item1.Product  = book;
         Item1.Quantity = int.Parse(txtQuantitiybook.Text);
         itemsOnCart.Add(Item1);
         MessageBox.Show("item is added to your shopping cart");
     }
     else
     {
         MessageBox.Show("Please Select Product To add Shoppingcart");
     }
 }
Пример #10
0
 private void btnaddtocartmusic_Click(object sender, EventArgs e)
 {
     if (tbMagazineName.Text != "" || tbMusicCDName.Text != "" || txtBookName.Text != "")
     {
         ItemToPurchase Item3 = new ItemToPurchase();
         MusicCD        music = new MusicCD("0", tbMusicCDName.Text, Convert.ToDouble(tbMusicCDPrice.Text));
         Item3.Product  = music;
         Item3.Quantity = int.Parse(tbquantymusic.Text);
         itemsOnCart.Add(Item3);
         MessageBox.Show("item is added to your shopping cart");
     }
     else
     {
         MessageBox.Show("Please Select Product To add Shoppingcart");
     }
 }
Пример #11
0
 /// <summary>
 /// This function adds the selected product to customer's cart.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddProduct_Click(object sender, EventArgs e)
 {
     Logger.log("Click to Add to Cart " + lblName.Text + " Button.");
     try
     {
         provider.NumberDecimalSeparator = ".";
         lblProductQuantitiy.Text        = (int.Parse(lblProductQuantitiy.Text) + 1).ToString();
         lblTotalPrice.Text = ((double.Parse(Temp_product.Price, provider) * (int.Parse(lblProductQuantitiy.Text))) + " $").ToString();
         ItemToPurchase item = new ItemToPurchase();
         item.Product  = Temp_product;
         item.Quantity = 1;
         MainWindow.cart.addProduct(item);
         TotalPaymentControl = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #12
0
        public void AddCartClick(object sender, EventArgs e)
        {
            foreach (var it in Home.shopCart.ItemsToPurchase)
            {
                if (it.product == book)
                {
                    it.quantity++;
                    return;
                }
            }
            ItemToPurchase item = new ItemToPurchase();

            item.product = book;
            item.quantity++;
            Home.shopCart.ItemsToPurchase.Add(item);
            string buttonname = "AddCartClick";

            SaveLog.Savelog(buttonname);
        }
Пример #13
0
        void addCart(object sender, EventArgs e)
        {
            Logger.logger(magazine.name + " Panel Add Cart");
            foreach (var it in MainForm.shoppingCart.ItemsToPurchase)
            {
                if (it.Product == this.magazine)
                {
                    it.Quantity++;
                    MessageBox.Show(it.Product.name + " has been added to your shopping cart.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            ItemToPurchase item = new ItemToPurchase();

            item.Product  = this.magazine;
            item.Quantity = 1;
            MainForm.shoppingCart.ItemsToPurchase.Add(item);
            MessageBox.Show(item.Product.name + " has been added to your shopping cart.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #14
0
        public void AddCartClick(object sender, EventArgs e)
        {
            foreach (var it in Home.shopCart.ItemsToPurchase)
            {
                if (it.product == music)
                {
                    it.quantity = 1;
                    return;
                }
            }
            ItemToPurchase item = new ItemToPurchase();

            item.product = music;
            item.quantity++;
            Home.shopCart.ItemsToPurchase.Add(item);
            MessageBox.Show("Added to shoppingcart");
            string buttonname = "MusicAddCart";

            SaveLog.Savelog(buttonname);
        }
Пример #15
0
 /// <summary>
 /// This function subtracts the selected product from customer's cart.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubtractProduct_Click(object sender, EventArgs e)
 {
     Logger.log("Click to Subtract from Cart " + lblName.Text + " Button.");
     try
     {
         if (int.Parse(lblProductQuantitiy.Text) > 0)
         {
             lblProductQuantitiy.Text = (int.Parse(lblProductQuantitiy.Text) - 1).ToString();
             lblTotalPrice.Text       = ((double.Parse(Temp_product.Price) * (int.Parse(lblProductQuantitiy.Text))) + " $").ToString();
             ItemToPurchase item = new ItemToPurchase();
             item.Product  = Temp_product;
             item.Quantity = 1;
             MainWindow.cart.removeProduct(item);
             TotalPaymentControl = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #16
0
 /// <summary>
 /// This parameter is constructor.
 /// </summary>
 /// <param name="purchase">This parameter is purchase.</param>
 public UC_ShoppingItem(ItemToPurchase purchase)
 {
     InitializeComponent();
     try
     {
         provider.NumberDecimalSeparator = ".";
         lblName.Text             = purchase.Product.Name;
         lblProductQuantitiy.Text = purchase.Quantity.ToString();
         lblUnitPrice.Text        = purchase.Product.Price + " $";
         lblTotalPrice.Text       = ((purchase.Quantity * double.Parse(purchase.Product.Price, provider)) + " $").ToString();
         picCoverPage.Image       = Util.ResizeBitmap(Util.stringToImage(purchase.Product.Picture),
                                                      picCoverPage.Width, picCoverPage.Height);
         ID           = purchase.Product.Id;
         picBox       = purchase.Product.Picture;
         Temp_product = purchase.Product;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #17
0
        public static void ItemAddToCart_Click(object sender, EventArgs e)
        {
            string presentTabName = CustomerPanel.PRESENT_TAB.Text;

            Button   AddToCartButton           = (Button)sender;
            GroupBox GroupBoxOfAddToCartButton = (GroupBox)AddToCartButton.Parent;
            string   itemName = GroupBoxOfAddToCartButton.Controls[1].Text;


            ItemToPurchase item = ListOfItemsToPurchase.Find(i => i.Product.Name == itemName);

            if (item != null)      //  Demek ki listede daha önce varmış, eklenmiş.
            {
                item.Quantity++;
            }

            else if (presentTabName == "Book")
            {
                ListOfItemsToPurchase.Add(new ItemToPurchase(Factory.GetBook(itemName), 1));
            }

            else if (presentTabName == "Magazine")
            {
                ListOfItemsToPurchase.Add(new ItemToPurchase(Factory.GetMagazine(itemName), 1));
            }

            else if (presentTabName == "MusicCD")
            {
                ListOfItemsToPurchase.Add(new ItemToPurchase(Factory.GetMusicCD(itemName), 1));
            }


            MessageBox.Show(itemName + " is added to the Cart!");


            string log = presentTabName + "\t" + itemName;

            Logger.logger(log);
        }
Пример #18
0
 private void addProduct(ItemToPurchase itemToAdd)
 {
     itemsToPurchase.Add(itemToAdd);
 }
Пример #19
0
 private void removeProduct(ItemToPurchase itemToRemove)
 {
     itemsToPurchase.Remove(itemToRemove);
 }
Пример #20
0
 public void addProduct(ItemToPurchase product)
 {
     m_itemsToPurchase.Add(product);
 }
Пример #21
0
 /**
  *\brief A function to remove a product from the item list
  *\param item: An item to remove from the item list
  */
 public void RemoveProduct(ItemToPurchase item)
 {
     ListOfItemsToPurchase.Remove(item);
 }
Пример #22
0
 public void removeProduct(ItemToPurchase product)
 {
     m_itemsToPurchase.Remove(product);
 }
Пример #23
0
        public void create(ItemToPurchase item)
        {
            this.item        = item;
            this.Size        = new Size(450, 75);
            this.BackColor   = Color.Transparent;
            this.BorderStyle = BorderStyle.FixedSingle;
            this.Visible     = true;

            PictureBox picture = new PictureBox();

            picture.Size     = new Size(40, 60);
            picture.Image    = item.product.Image;
            picture.SizeMode = PictureBoxSizeMode.StretchImage;
            picture.Location = new Point(35, 5);

            Label lblname = new Label();

            lblname.AutoSize = true;
            lblname.Text     = item.product.Name1;
            lblname.Location = new System.Drawing.Point(90, 25);

            txtquantity           = new TextBox();
            txtquantity.TextAlign = HorizontalAlignment.Center;
            txtquantity.Size      = new Size(25, 10);
            txtquantity.Text      = item.quantity.ToString();
            txtquantity.ReadOnly  = true;
            txtquantity.Location  = new System.Drawing.Point(260, 25);

            Button btndecrease = new Button();

            btndecrease.Image     = Properties.Resources.down;
            btndecrease.Size      = new Size(20, 20);
            btndecrease.FlatStyle = FlatStyle.Flat;
            btndecrease.FlatAppearance.BorderSize = 0;
            btndecrease.Location = new System.Drawing.Point(235, 25);
            btndecrease.Click   += new EventHandler(btnDecrease);

            Button btnincrease = new Button();

            btnincrease.Image     = Properties.Resources.up;
            btnincrease.Size      = new Size(20, 20);
            btnincrease.FlatStyle = FlatStyle.Flat;
            btnincrease.FlatAppearance.BorderSize = 0;
            btnincrease.Location = new System.Drawing.Point(290, 25);
            btnincrease.Click   += new EventHandler(btnIncrease);

            lbltotalprice          = new Label();
            lbltotalprice.AutoSize = true;
            lbltotalprice.Text     = (item.product.Price1 * item.quantity).ToString() + " TL";
            lbltotalprice.Location = new System.Drawing.Point(390, 25);

            Button btndelete = new Button();

            btndelete.Image     = Properties.Resources.Delete;
            btndelete.Size      = new Size(30, 30);
            btndelete.FlatStyle = FlatStyle.Flat;
            btndelete.FlatAppearance.BorderSize = 0;
            btndelete.Location = new System.Drawing.Point(3, 20);
            btndelete.Click   += new EventHandler(btnDelete);

            this.Controls.Add(btnincrease);
            this.Controls.Add(btndecrease);
            this.Controls.Add(picture);
            this.Controls.Add(lblname);
            this.Controls.Add(btndelete);
            this.Controls.Add(txtquantity);
            this.Controls.Add(lbltotalprice);
        }
Пример #24
0
 private void btnRemoveProduct_Click(object sender, EventArgs e)
 {
     if (cbRemovedProductQuantity.Text == "")
     {
         MessageBox.Show("Please Set Quantity!");
     }
     else
     {
         string[] properties;
         int      place = 0;
         for (int i = 0; i < listProducts.Items.Count; i++)
         {
             if (listProducts.Items[i].Selected == true)
             {
                 int newQuantity = 0;
                 if (Convert.ToInt32(listProducts.Items[i].SubItems[0].Text) > 100 && Convert.ToInt32(listProducts.Items[i].SubItems[0].Text) < 200)
                 {
                     properties = new string[PropertiesCountOfItem("Book")];
                     Book myBook = new Book();
                     place      = Convert.ToInt32(listProducts.Items[i].SubItems[0].Text) - 100;
                     properties = myBook.printProperties(place);
                     myBook.setID(Convert.ToInt32(properties[0]));
                     myBook.setName(properties[1]);
                     myBook.setPrice(Convert.ToInt32(properties[2]));
                     myBook.setISBN(Convert.ToInt32(properties[3]));
                     myBook.setAuthor(properties[4]);
                     myBook.setPublisher(properties[5]);
                     ItemToPurchase item = new ItemToPurchase(myBook, Convert.ToInt32(cbRemovedProductQuantity.Text));
                     myShoppingCart.removeProduct(item);
                     if (Convert.ToInt32(cbRemovedProductQuantity.Text) >= Convert.ToInt32(listProducts.Items[i].SubItems[3].Text))
                     {
                         listProducts.Items[i].Remove();
                     }
                     else
                     {
                         newQuantity = Convert.ToInt32(listProducts.Items[i].SubItems[3].Text) - Convert.ToInt32(cbRemovedProductQuantity.Text);
                         listProducts.Items[i].SubItems[3].Text = newQuantity.ToString();
                         listProducts.Refresh();
                     }
                 }
                 else if (Convert.ToInt32(listProducts.Items[i].SubItems[0].Text) > 200 && Convert.ToInt32(listProducts.Items[i].SubItems[0].Text) < 300)
                 {
                     properties = new string[PropertiesCountOfItem("Magazine")];
                     Magazine myMagazine = new Magazine();
                     place      = Convert.ToInt32(listProducts.Items[i].SubItems[0].Text) - 200;
                     properties = myMagazine.printProperties(place);
                     myMagazine.setID(Convert.ToInt32(properties[0]));
                     myMagazine.setName(properties[1]);
                     myMagazine.setPrice(Convert.ToInt32(properties[2]));
                     myMagazine.setissue(properties[3]);
                     myMagazine.setType(properties[4]);
                     ItemToPurchase item = new ItemToPurchase(myMagazine, Convert.ToInt32(cbRemovedProductQuantity.Text));
                     myShoppingCart.removeProduct(item);
                     if (Convert.ToInt32(cbRemovedProductQuantity.Text) >= Convert.ToInt32(listProducts.Items[i].SubItems[3].Text))
                     {
                         listProducts.Items[i].Remove();
                     }
                     else
                     {
                         newQuantity = Convert.ToInt32(listProducts.Items[i].SubItems[3].Text) - Convert.ToInt32(cbRemovedProductQuantity.Text);
                         listProducts.Items[i].SubItems[3].Text = newQuantity.ToString();
                         listProducts.Refresh();
                     }
                 }
                 else
                 {
                     properties = new string[PropertiesCountOfItem("MusicCD")];
                     MusicCD myMusicCD = new MusicCD();
                     place      = Convert.ToInt32(listProducts.Items[i].SubItems[0].Text) - 300;
                     properties = myMusicCD.printProperties(place);
                     myMusicCD.setID(Convert.ToInt32(properties[0]));
                     myMusicCD.setName(properties[1]);
                     myMusicCD.setPrice(Convert.ToInt32(properties[2]));
                     myMusicCD.setsinger(properties[3]);
                     myMusicCD.setType(properties[4]);
                     ItemToPurchase item = new ItemToPurchase(myMusicCD, Convert.ToInt32(cbRemovedProductQuantity.Text));
                     myShoppingCart.removeProduct(item);
                     if (Convert.ToInt32(cbRemovedProductQuantity.Text) >= Convert.ToInt32(listProducts.Items[i].SubItems[3].Text))
                     {
                         listProducts.Items[i].Remove();
                     }
                     else
                     {
                         newQuantity = Convert.ToInt32(listProducts.Items[i].SubItems[3].Text) - Convert.ToInt32(cbRemovedProductQuantity.Text);
                         listProducts.Items[i].SubItems[3].Text = newQuantity.ToString();
                         listProducts.Refresh();
                     }
                 }
             }
         }
     }
 }
        public ShoppingItemPanel(ItemToPurchase item)
        {
            this.item        = item;
            this.Size        = new Size(460, 85);
            this.BorderStyle = BorderStyle.FixedSingle;

            lblItemName           = new Label();
            lblItemName.AutoSize  = false;
            lblItemName.Size      = new Size(200, 20);
            lblItemName.Text      = item.Product.name;
            lblItemName.BackColor = Color.Transparent;
            lblItemName.Font      = new Font("Microsoft Sans Serif", (float)11.25, FontStyle.Italic);
            this.Controls.Add(lblItemName);

            lblItemType          = new Label();
            lblItemType.AutoSize = false;
            lblItemType.Size     = new Size(200, 15);
            lblItemType.Font     = new Font("Microsoft Sans Serif", (float)10.25, FontStyle.Italic);
            if (item.Product is Book)
            {
                lblItemType.Text = "Book";
            }
            else if (item.Product is Magazine)
            {
                lblItemType.Text = "Magazine";
            }
            else
            {
                lblItemType.Text = "Music CD";
            }
            lblItemType.BackColor = Color.Transparent;
            this.Controls.Add(lblItemType);

            lblPrice           = new Label();
            lblPrice.AutoSize  = true;
            lblPrice.Font      = new Font("Microsoft Sans Serif", (float)10.25, FontStyle.Regular);
            lblPrice.Text      = item.Product.discountedPrice * item.Quantity + " TL";
            lblPrice.BackColor = Color.Transparent;
            this.Controls.Add(lblPrice);

            cbQuantity = new ComboBox();
            for (int i = 1; i <= 100; i++)
            {
                cbQuantity.Items.Add(i.ToString());
            }
            cbQuantity.SelectedIndex         = item.Quantity - 1;
            cbQuantity.SelectedIndexChanged += new EventHandler(cbChange);
            cbQuantity.Size             = new Size(61, 21);
            cbQuantity.IntegralHeight   = false;
            cbQuantity.DropDownStyle    = ComboBoxStyle.DropDownList;
            cbQuantity.MaxDropDownItems = 6;
            this.Controls.Add(cbQuantity);

            pbThumbnail           = new PictureBox();
            pbThumbnail.Image     = item.Product.image;
            pbThumbnail.SizeMode  = PictureBoxSizeMode.Zoom;
            pbThumbnail.Size      = new Size(59, 78);
            pbThumbnail.BackColor = Color.Transparent;
            this.Controls.Add(pbThumbnail);

            btnRemoveItem            = new Button();
            btnRemoveItem.Text       = "Remove Item";
            btnRemoveItem.TextAlign  = ContentAlignment.MiddleRight;
            btnRemoveItem.Size       = new Size(100, 25);
            btnRemoveItem.FlatStyle  = FlatStyle.Flat;
            btnRemoveItem.BackColor  = Color.Snow;
            btnRemoveItem.Click     += new EventHandler(butonClick);
            btnRemoveItem.Image      = Properties.Resources.removeitem;
            btnRemoveItem.ImageAlign = ContentAlignment.MiddleLeft;
            this.Controls.Add(btnRemoveItem);

            this.Controls[0].Location = new Point(63, 24);  // Name label
            this.Controls[0].BringToFront();
            this.Controls[1].Location = new Point(63, 54);  // Type label
            this.Controls[1].BringToFront();
            this.Controls[2].Location = new Point(366, 26); // Price label
            this.Controls[2].BringToFront();
            this.Controls[3].Location = new Point(276, 24); //  Combobox
            this.Controls[3].BringToFront();
            this.Controls[4].Location = new Point(3, 3);    // picturebox
            this.Controls[4].BringToFront();
            this.Controls[5].Location = new Point(340, 55); //Button
        }
Пример #26
0
 /**
  *\brief A function to add a product to the item list
  *\param item: An item to add to the item list
  */
 public void AddProduct(ItemToPurchase item)
 {
     ListOfItemsToPurchase.Add(item);
 }