/// <summary> /// save function /// </summary> public void SaveFunction() { try { TaxInfo infoTax = new TaxInfo(); TaxSP spTax = new TaxSP(); TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo(); TaxDetailsSP spTaxDetails = new TaxDetailsSP(); infoTax.TaxName = txtTaxName.Text.Trim(); infoTax.Rate = Convert.ToDecimal(txtRate.Text.ToString()); infoTax.ApplicableOn = cmbApplicableFor.SelectedItem.ToString(); if (cmbCalculationMode.Enabled != true) { infoTax.CalculatingMode = string.Empty; } else { infoTax.CalculatingMode = cmbCalculationMode.SelectedItem.ToString(); } infoTax.Narration = txtNarration.Text.Trim(); if (cbxActive.Checked) { infoTax.IsActive = true; } else { infoTax.IsActive = false; } infoTax.Extra1 = string.Empty; infoTax.Extra2 = string.Empty; if (spTax.TaxCheckExistence(0, txtTaxName.Text.Trim()) == false) { decTaxId = spTax.TaxAddWithIdentity(infoTax); decIdForOtherForms = decTaxId; if (dgvTaxSelection.RowCount > 0) { bool isOk = false; foreach (DataGridViewRow dgvRow in dgvTaxSelection.Rows) { isOk = Convert.ToBoolean(dgvRow.Cells["dgvcbxSelect"].Value); if (isOk) { infoTaxDetails.TaxId = decTaxId; infoTaxDetails.SelectedtaxId = Convert.ToDecimal(dgvRow.Cells["dgvtxtTaxId"].Value.ToString());//dgvRow.Cells[0].Value.ToString(); infoTaxDetails.ExtraDate = DateTime.Now; infoTaxDetails.Extra1 = string.Empty; infoTaxDetails.Extra2 = string.Empty; spTaxDetails.TaxDetailsAddWithoutId(infoTaxDetails); } } } CreateLedger(); Messages.SavedMessage(); Clear(); SearchClear(); } else { Messages.InformationMessage(" Tax or ledger already exist"); txtTaxName.Focus(); } if (frmProductCreationObj != null) { this.Close(); } } catch (Exception ex) { MessageBox.Show("TC4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }