internal void RemoveCart(SalesPVCList salesPVCList) { for (int i = 0; i < cart.Count; i++) { if (cart[i].GetPVCID() == salesPVCList.GetPVCID()) { RemoveCartList(i); break; } } }
private void btnAddToCart_Click(object sender, EventArgs e) { if (customerID > 0) { if (pvcID > 0) { if (nudQty.Value != 0) { decimal awal = 0; for (int i = 0; i < cart.Count; i++) { if (cart[i].GetPVCID() == pvcID) { //awal = cart[i].GetQty(); RemoveCartList(i); break; } } SalesPVCList temp = new SalesPVCList(this, pvcID, pvcTypeID, tbNamaPVC.Text, nudQty.Value + awal, nudPerPack.Value, Convert.ToInt32(nudPrice.Value)); cart.Add(temp); RefreshCartList(); ClearField(); btnSearchPVC.Focus(); } else { main.SetMessage("Qty tidak bisa 0"); nudPack.Focus(); } } else { btnSearchPVC_Click(sender, e); } } else { btnSearchCustomer_Click(sender, e); } }