Пример #1
0
        private void AddItemToListView(string ID, string Name, int Amount, int Price, string SID)
        {
            bool exist = false;
            int  money = Amount * Price;

            foreach (SellItemInfor ItemInfor in ListSellItem)
            {
                string IDProduct = ItemInfor.ProductID;
                if (IDProduct == ID)
                {
                    ItemInfor.Amount = Amount + ItemInfor.Amount;
                    int Money = ItemInfor.Amount * Price;
                    ItemInfor.Money = Money;
                    exist           = true;
                    break;
                }
            }
            if (!exist)
            {
                SellItemInfor Item = new SellItemInfor(ID, Name, Amount, Price, money, SID);
                ListSellItem.Add(Item);
            }
            TotalValue         = TotalValue + money;
            txtTotalMoney.Text = TotalValue.ToString();
            LoadListView();
        }
Пример #2
0
 private void dgvListProduct_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == 5)
     {
         SellItemInfor item = ListSellItem[e.RowIndex];
         TotalValue         = TotalValue - item.Money;
         Pay                = TotalValue - TotalValue;
         txtTotalMoney.Text = TotalValue.ToString();
         ListSellItem.RemoveAt(e.RowIndex);
         LoadListView();
     }
 }