private void InitCart() { DataTable dt = ExecuteQuery("SELECT psd.pvcID, pvcName, pvcPerPack, pvcTypeUnit, quantity, psd.sellPrice FROM MsPVC mp, PVCSalesDetail psd WHERE psd.pvcID = mp.pvcID AND pvcSalesID = " + pvcSalesID + " ORDER BY mp.pvcTypeID"); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { int pvcID = Int32.Parse(dt.Rows[i]["pvcID"].ToString()); string pvcName = dt.Rows[i]["pvcName"].ToString(); decimal pvcPerPack = Decimal.Parse(dt.Rows[i]["pvcPerPack"].ToString()); string pvcTypeUnit = dt.Rows[i]["pvcTypeUnit"].ToString(); decimal quantity = Decimal.Parse(dt.Rows[i]["quantity"].ToString()); int sellPrice = Int32.Parse(dt.Rows[i]["sellPrice"].ToString()); PVCSalesUpdateList temp = new PVCSalesUpdateList(this, pvcID, pvcName, quantity, sellPrice, pvcTypeUnit, pvcPerPack); list.Add(temp); } } }
private void btnAddToCart_Click(object sender, EventArgs e) { if (nudQty.Value != 0) { for (int i = 0; i < list.Count; i++) { if (list[i].getPVCID() == pvcID) { list.RemoveAt(i); } } PVCSalesUpdateList temp = new PVCSalesUpdateList(this, pvcID, tbNamaPVC.Text, nudQty.Value, Convert.ToInt32(nudPrice.Value), LblPVCType.Text, nudPerPack.Value); list.Add(temp); RefreshCart(); } else { main.SetMessage("Pilih PVC dan isi QTY dulu!"); nudPack.Focus(); nudPack.Select(0, 9); } }
internal void DeleteCartList(PVCSalesUpdateList input) { list.Remove(input); RefreshCart(); }