public List <objCashMemo> GetChallanList(string strPartyName) { tblCashMemoTableAdapter adp = new tblCashMemoTableAdapter(); List <objCashMemo> showList = new List <objCashMemo>(); foreach (var x in adp.GetBillList(strPartyName)) { objCashMemo aCashMemo = new objCashMemo(); aCashMemo.intBillId = x.intBillId; aCashMemo.monDue = Convert.ToDouble(x.monDue); aCashMemo.strPartyName = "Bill : " + x.intBillId.ToString() + " Due : " + x.monDue.ToString(); showList.Add(aCashMemo); } return(showList); }
protected void btnAdd_Click(object sender, EventArgs e) { if (addButtonVerification()) { if (Session["List"] == null) { records = new List <objCashMemo>(); } else { records = (List <objCashMemo>)Session["List"]; } objCashMemo aCashMemo = new objCashMemo(); aCashMemo.intBillId = Convert.ToInt32(drpBill.Text); aCashMemo.monTotal = Convert.ToDouble(lblDueBalance.Text); if (txtPaidAmount.Text != "") { aCashMemo.monPaid = Convert.ToDouble(txtPaidAmount.Text); } else { aCashMemo.monPaid = 0; } if (txtTAX.Text != "") { aCashMemo.monTAX = Convert.ToDouble(txtTAX.Text); } else { aCashMemo.monTAX = 0; } if (drpDiscount.Text == "Rest is Due") { aCashMemo.monDiscount = 0; aCashMemo.monDue = Math.Round(aCashMemo.monTotal - (aCashMemo.monPaid + aCashMemo.monTAX), 2); } else { aCashMemo.monDue = 0; aCashMemo.monDiscount = Math.Round(aCashMemo.monTotal - (aCashMemo.monPaid + aCashMemo.monTAX), 2); } records.Add(aCashMemo); dgv.DataSource = records; dgv.DataBind(); if (Session["List"] != null) { btnCreateCashMemo.Visible = true; } else { btnCreateCashMemo.Visible = false; } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please fill Client fields.')", true); } }