/// <summary> /// delete function /// </summary> public void Delete() { try { if (PublicVariables.isMessageDelete) { if (Messages.DeleteMessage()) { TaxInfo infoTax = new TaxInfo(); TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo(); TaxBll bllTax = new TaxBll(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); bool isExist = bllTax.TaxReferenceCheck(decTaxId); if (!isExist) { if ((bllTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1) { Messages.ReferenceExistsMessage(); } else { bllTax.TaxDetailsDeleteWithTaxId(decTaxId); bllAccountLedger.AccountLedgerDelete(decLedgerId); Messages.DeletedMessage(); TaxSearchGridFill(); TaxSelectionGridFill(); Clear(); SearchClear(); } } else { Messages.ReferenceExistsMessage(); } } } else { TaxInfo infoTax = new TaxInfo(); TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo(); TaxBll bllTax = new TaxBll(); bool isExist = bllTax.TaxReferenceCheck(decTaxId); if (!isExist) { if ((bllTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1) { Messages.ReferenceExistsMessage(); } else { bllTax.TaxDetailsDeleteWithTaxId(decTaxId); Messages.DeletedMessage(); TaxSearchGridFill(); TaxSelectionGridFill(); Clear(); SearchClear(); } } else { Messages.ReferenceExistsMessage(); } } } catch (Exception ex) { MessageBox.Show("TC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }