private void bSellItemAdd_Click(object sender, EventArgs e)
 {
     QuantityForm form = new QuantityForm();
     if (form.ShowDialog(1, DbActionsEnum.Create) == System.Windows.Forms.DialogResult.OK)
     {
         SaleItem si = new SaleItem(form.ResultData, this.prodsSellTab.getSelectedProduct());
         this.saleCart.addSaleItem(si);
     }
 }
Esempio n. 2
0
 public void addSaleItem(SaleItem saleItem)
 {
     bool alreadyExist = false;
     foreach (SaleItem item in this.items)
     {
         if (item.Product.Id == saleItem.Product.Id)
         {
             alreadyExist = true;
             item.Quantity += saleItem.Quantity;
             break;
         }
     }
     if (!alreadyExist)
     {
         this.items.Add(saleItem);
     }
     this.dgvSaleItems.Refresh();
 }