protected void lvGrid_ItemCommand(object sender, ListViewCommandEventArgs e) { if (Page.IsValid) { if (e.CommandName == "change") { int taxId = Convert.ToInt32(e.CommandArgument); iBiz.FinPro.Generic.Taxes bTax = new iBiz.FinPro.Generic.Taxes(); iBiz.FinPro.Generic.Taxes.objfin_Taxes objTax = new iBiz.FinPro.Generic.Taxes.objfin_Taxes(); objTax = bTax.Select(taxId); if (objTax != null) { hfTaxId.Value = objTax.taxId.ToString(); tbTaxDescription.Text = objTax.taxTransNarration; tbTaxTitle.Text = objTax.taxTitle; tbTaxValue.Text = objTax.taxValue.ToString("0.00"); ddlTaxType.SelectedIndex = 1; if (!objTax.taxTypeIsPercent) { ddlTaxType.SelectedIndex = 0; } mpeNewAccount.Show(); } } } }
protected void lbtnSubmit_Click(object sender, EventArgs e) { if (Page.IsValid) { iBiz.FinPro.Generic.Taxes bTax = new iBiz.FinPro.Generic.Taxes(); iBiz.FinPro.Generic.Taxes.objfin_Taxes objTax = new iBiz.FinPro.Generic.Taxes.objfin_Taxes(); bool isPercent = true; if (ddlTaxType.SelectedIndex == 0) { isPercent = false; } if (string.IsNullOrEmpty(hfTaxId.Value)) { objTax.taxCreatedBy = thisUser; objTax.taxCreatedIP = Request.UserHostAddress; objTax.taxCreatedOn = DateTime.Now; objTax.taxTitle = tbTaxTitle.Text; objTax.taxTransNarration = tbTaxDescription.Text; objTax.taxTypeIsPercent = isPercent; objTax.taxValue = Convert.ToDecimal(tbTaxValue.Text); objTax.taxAccountId = 0; bTax.Add(objTax); rnNotify.Show("Tax has been created."); } else { objTax = bTax.Select(Convert.ToInt32(hfTaxId.Value)); objTax.taxTitle = tbTaxTitle.Text; objTax.taxTransNarration = tbTaxDescription.Text; objTax.taxTypeIsPercent = isPercent; objTax.taxValue = Convert.ToDecimal(tbTaxValue.Text); bTax.Update(objTax); rnNotify.Show("Tax has been updated."); } hfTaxId.Value = ""; mpeNewAccount.Hide(); Load_Data(); } }