protected void LoadChartOfAccountsBankHeadList() { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsBankHeadList(); bankAccountHeadDropDownList.DataSource = dt; bankAccountHeadDropDownList.DataValueField = "AccountId"; bankAccountHeadDropDownList.DataTextField = "AccountHead"; bankAccountHeadDropDownList.DataBind(); bankAccountHeadDropDownList.Items.Insert(0, ""); bankAccountHeadDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Bank Account Head Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { chartOfAccount = null; } }
protected void paymentModeDropDownList_SelectedIndexChanged(object sender, EventArgs e) { try { accountHeadDropDownList.Items.Clear(); ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); if (paymentModeDropDownList.SelectedItem.Text == "Cash") { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsCashHeadList(); accountHeadDropDownList.DataSource = dt; accountHeadDropDownList.DataValueField = "AccountId"; accountHeadDropDownList.DataTextField = "AccountHead"; accountHeadDropDownList.DataBind(); accountHeadDropDownList.Items.Insert(0, ""); accountHeadDropDownList.SelectedIndex = 0; } else if (paymentModeDropDownList.SelectedItem.Text == "Cheque") { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsBankHeadList(); accountHeadDropDownList.DataSource = dt; accountHeadDropDownList.DataValueField = "AccountId"; accountHeadDropDownList.DataTextField = "AccountHead"; accountHeadDropDownList.DataBind(); accountHeadDropDownList.Items.Insert(0, ""); accountHeadDropDownList.SelectedIndex = 0; } } catch (Exception) { throw; } }
protected void LoadChartOfAccountsBankHeadList() { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsBankHeadList(); for (int i = 0; i < dt.Rows.Count; i++) { ListItem item1 = new ListItem(dt.Rows[i]["AccountHead"].ToString(), dt.Rows[i]["AccountId"].ToString()); if (dt.Rows[i]["AccountId"].ToString().Contains("A")) { item1.Attributes["OptionGroup"] = "Asset"; } else if (dt.Rows[i]["AccountId"].ToString().Contains("E")) { item1.Attributes["OptionGroup"] = "Expense"; } else if (dt.Rows[i]["AccountId"].ToString().Contains("I")) { item1.Attributes["OptionGroup"] = "Income"; } else if (dt.Rows[i]["AccountId"].ToString().Contains("L")) { item1.Attributes["OptionGroup"] = "Liability"; } accountHeadDropDownList.Items.Add(item1); } bankAccountHeadDropDownList.DataSource = dt; bankAccountHeadDropDownList.DataValueField = "AccountId"; bankAccountHeadDropDownList.DataTextField = "AccountHead"; bankAccountHeadDropDownList.DataBind(); bankAccountHeadDropDownList.Items.Insert(0, ""); bankAccountHeadDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Bank Account Head Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { chartOfAccount = null; } }