/// <summary> /// on combobox account group text changing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbAccountGroup_TextChanged(object sender, EventArgs e) { try { if (isLoad) { int index = cmbAccountGroup.SelectedIndex; string strinr = cmbAccountGroup.Text.ToString(); int dec = cmbAccountGroup.SelectedIndex; int inRowcount = dgvMultipleAccountLedger.RowCount; AccountGroupBll bllAccountGroup = new AccountGroupBll(); string strNature; strNature = bllAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text); for (int i = 0; i < inRowcount; i++) { if (strNature == "Assets" || strNature == "Income") { dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Cr"; } else if (strNature == "Expenses" || strNature == "Liabilities") { dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value = "Dr"; } } } } catch (Exception ex) { MessageBox.Show("MAL12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// on grid opening balance textbox keypress /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvtxtOpeningBalance_KeyPress(object sender, KeyPressEventArgs e) { AccountGroupBll bllAccountGroup = new AccountGroupBll(); try { if (dgvMultipleAccountLedger.CurrentCell != null) { if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtOpeningBalance") { Common.DecimalValidation(sender, e, false); } if (dgvMultipleAccountLedger.Columns[dgvMultipleAccountLedger.CurrentCell.ColumnIndex].Name == "dgvtxtLedgerName") { if (dgvMultipleAccountLedger.Columns["dgvtxtLedgerName"].Index == 1) { string strNature; strNature = bllAccountGroup.MultipleAccountLedgerCrOrDr(cmbAccountGroup.Text); if (strNature == "Assets" || strNature == "Income") { dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Cr"; } else if (strNature == "Expenses" || strNature == "Liabilities") { dgvMultipleAccountLedger.Rows[dgvMultipleAccountLedger.CurrentRow.Index].Cells["dgvcmbDebitOrCredit"].Value = "Dr"; } } } } } catch (Exception ex) { MessageBox.Show("MAL17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }