/// <summary> /// when cell double click for update function /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvVoucherType_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { isEditMode = true; btnSave.Text = "Update"; txtVoucherNameSearch.Focus(); btnDelete.Enabled = true; int inRowCount = dgvApplicableTaxes.RowCount; for (int i = 0; i < inRowCount; i++) { dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value = false; } VoucherTypeSP spVoucherType = new VoucherTypeSP(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); decVoucherTypeId = Convert.ToDecimal(dgvVoucherType.CurrentRow.Cells["dgvtxtvoucherTypeId"].Value.ToString()); infoVoucherType = spVoucherType.VoucherTypeView(decVoucherTypeId); txtVoucherName.Text = infoVoucherType.VoucherTypeName; cmbTypeOfVoucher.Text = infoVoucherType.TypeOfVoucher; cmbMethodOfvoucherNumbering.Text = infoVoucherType.MethodOfVoucherNumbering; txtNarration.Text = infoVoucherType.Narration; txtDeclaration.Text = infoVoucherType.Declarartion; cmbDotMatrix.SelectedValue = infoVoucherType.MasterId; txtHeading1.Text = infoVoucherType.Heading1; txtHeading2.Text = infoVoucherType.Heading2; txtHeading3.Text = infoVoucherType.Heading3; txtHeading4.Text = infoVoucherType.Heading4; if (infoVoucherType.IsActive) { cbxActive.Checked = true; } else { cbxActive.Checked = false; } DataTable dtbl = new DataTable(); dtbl = spVoucherType.GetTaxIdForTaxSelection(decVoucherTypeId); foreach (DataRow dr in dtbl.Rows) { string strTaxId = dr["taxId"].ToString(); for (int i = 0; i < inRowCount; i++) { if (dgvApplicableTaxes.Rows[i].Cells["dgvtxtTaxId"].Value.ToString() == strTaxId) { dgvApplicableTaxes.Rows[i].Cells["dgvcbxSelect"].Value = true; } } } if (spVoucherType.CheckForDefaultVoucherType(decVoucherTypeId) == false) { txtVoucherName.Enabled = true; cmbTypeOfVoucher.Enabled = true; } else { txtVoucherName.Enabled = false; cmbTypeOfVoucher.Enabled = false; } if (cmbTypeOfVoucher.Text == "Sales Return" || cmbTypeOfVoucher.Text == "Sales Invoice" || cmbTypeOfVoucher.Text == "Purchase Return" || cmbTypeOfVoucher.Text == "Purchase Invoice") { dgvApplicableTaxes.Enabled = true; } else { dgvApplicableTaxes.Enabled = false; } } } catch (Exception ex) { MessageBox.Show("VT17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }