/// <summary> /// Function to check wheteher cash or bank is selected /// </summary> public void CheckWhetherBankOrCash() { try { //----- To make readonly txtChequeNo and txtChequeDate if selected ledger group is cash-----// if (cmbCashOrBank.SelectedValue != null && cmbCashOrBank.SelectedValue.ToString() != string.Empty) { decimal decLedger = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString()); bool isBankAcocunt = false; AccountGroupSP SpGroup = new AccountGroupSP(); DataTable dtbl = new DataTable(); dtbl = SpGroup.CheckWheatherLedgerUnderCash(); //-------- Checking whether the selected legder is under bank----------// foreach (DataRow dr in dtbl.Rows) { string str = dr.ItemArray[0].ToString(); if (decLedger == Convert.ToDecimal(dr.ItemArray[0].ToString())) { isBankAcocunt = true; } } if (isBankAcocunt) { txtCheckNo.Enabled = false; txtChequeDate.Enabled = false; dtpCheckDate.Enabled = false; txtCheckNo.Clear(); } else { txtCheckNo.Enabled = true; txtChequeDate.Enabled = true; dtpCheckDate.Enabled = true; } } } catch (Exception ex) { MessageBox.Show("AP17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }