protected void GetChartOfAccountListByAccountType(string accountType) { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetChartOfAccountListByAccountType(accountType); chartOfAccountListGridView.DataSource = dt; chartOfAccountListGridView.DataBind(); if (chartOfAccountListGridView.Rows.Count > 0) { chartOfAccountListGridView.UseAccessibleHeader = true; chartOfAccountListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Chart Of Account List 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 LoadChartOfAccountsCashAndBankHeadList() { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsCashAndBankHeadList(); accountHeadDropDownList.DataSource = dt; accountHeadDropDownList.DataValueField = "AccountId"; accountHeadDropDownList.DataTextField = "AccountHead"; accountHeadDropDownList.DataBind(); accountHeadDropDownList.Items.Insert(0, ""); accountHeadDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Cash & 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 PopulateChartOfAccountTreeViewByAccountType(string accountType) { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetChartOfAccountListByAccountType(accountType); if (dt.Rows.Count > 0) { chartOfAccountTreeView.Nodes.Clear(); AddTopTreeViewNodes(dt); } else { msgbox.Visible = true; msgTitleLabel.Text = "Chart Of Account List 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; } }
public DataTable SaveChartOfAccount(ChartOfAccountBLL chartOfAccount, LumexDBPlayer db) { try { db.AddParameters("@AccountName", chartOfAccount.AccountName.Trim()); db.AddParameters("@AccountType", chartOfAccount.AccountType.Trim()); db.AddParameters("@TotallingAccountNumber", chartOfAccount.TotallingAccountNumber.Trim()); db.AddParameters("@IsPosted", chartOfAccount.IsPosted.Trim()); db.AddParameters("@UseAs", chartOfAccount.UseAs.Trim()); db.AddParameters("@BankAccountNumber", chartOfAccount.BankAccountNumber.Trim()); db.AddParameters("@Description", chartOfAccount.Description.Trim()); db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal()); db.AddParameters("@OfficeBranchId", ""); DataTable dt = db.ExecuteDataTable("INSERT_CHART_OF_ACCOUNT", true); return dt; } catch (Exception) { throw; } finally { chartOfAccount = null; } }
public bool CheckDuplicateChartOfAccount(ChartOfAccountBLL chartOfAccount, LumexDBPlayer db) { bool status = false; try { db.AddParameters("@AccountType", chartOfAccount.AccountType.Trim()); db.AddParameters("@AccountName", chartOfAccount.AccountName.Trim()); db.AddParameters("@TotallingAccountNumber", chartOfAccount.TotallingAccountNumber.Trim()); DataTable dt = db.ExecuteDataTable("CHECK_DUPLICATE_CHART_OF_ACCOUNT", true); if (dt.Rows.Count > 0) { status = true; } } catch (Exception) { throw; } finally { chartOfAccount = null; } return status; }
protected void GetChartOfAccountById(string accountId) { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetChartOfAccountById(accountId); if (dt.Rows.Count > 0) { chartOfAccountNameForUpdateHiddenField.Value = accountNameTextBox.Text = dt.Rows[0]["AccountName"].ToString(); accountTypeDropDownList.SelectedValue = dt.Rows[0]["AccountType"].ToString(); postedDropDownList.SelectedValue = dt.Rows[0]["IsPosted"].ToString(); totallingAccountNumberTextBox.Text = dt.Rows[0]["TotallingAccountNumber"].ToString(); useAsDropDownList.SelectedValue = dt.Rows[0]["UseAs"].ToString(); bankAccountNumberTextBox.Text = dt.Rows[0]["BankAccountNumber"].ToString(); descriptionTextBox.Text = dt.Rows[0]["Description"].ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Chart Of Account 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 LoadChartOfAccountsHeadList() { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsHeadList(); 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); } //accountHeadDropDownList.DataSource = dt; //accountHeadDropDownList.DataValueField = "AccountId"; //accountHeadDropDownList.DataTextField = "AccountHead"; //accountHeadDropDownList.DataBind(); // accountHeadDropDownList.Items.Insert(0, ""); //accountHeadDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "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 saveButton_Click(object sender, EventArgs e) { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { if (accountNameTextBox.Text.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Account Name field is required."; } else if (totallingAccountNumberTextBox.Text.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Totalling Account Number field is required."; } else { chartOfAccount.AccountName = accountNameTextBox.Text.Trim(); chartOfAccount.AccountType = accountTypeDropDownList.SelectedValue.Trim(); chartOfAccount.TotallingAccountNumber = totallingAccountNumberTextBox.Text.Trim(); chartOfAccount.IsPosted = postedDropDownList.SelectedValue.Trim(); chartOfAccount.UseAs = useAsDropDownList.SelectedValue.Trim(); chartOfAccount.BankAccountNumber = bankAccountNumberTextBox.Text.Trim(); chartOfAccount.Description = descriptionTextBox.Text.Trim(); if (!chartOfAccount.CheckDuplicateChartOfAccount()) { DataTable dt = chartOfAccount.SaveChartOfAccount(); if (dt.Rows.Count > 0) { string message = "Chart Of Account <span class='actionTopic'>Created</span> Successfully with Account ID: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/AccUI/ChartOfAccount/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "<span class='actionTopic'>Failed</span> to Create Create Chart Of Account."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } else { string message = "This Chart Of Account <span class='actionTopic'>already exist</span>, try another one."; MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");"); } } } 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 deletedListButton_Click(object sender, EventArgs e) { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required."; } else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required."; } else { string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()); string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()); DataTable dt = chartOfAccount.GetDeletedChartOfAccountListByDateRangeAll(fromDate, toDate, ""); deletedListGridView.DataSource = dt; deletedListGridView.DataBind(); if (deletedListGridView.Rows.Count > 0) { deletedListGridView.UseAccessibleHeader = true; deletedListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Deleted Chart Of Account List Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-info"); } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { chartOfAccount = null; MyAlertBox("MyOverlayStop();"); } }
protected void GetChartOfAccountById(string accountId) { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetChartOfAccountById(accountId); if (dt.Rows.Count > 0) { accountNameLabel.Text = dt.Rows[0]["AccountName"].ToString(); accountTypeLabel.Text = dt.Rows[0]["AccountTypeName"].ToString(); accountNumberLabel.Text = dt.Rows[0]["AccountNumber"].ToString(); totallingAccountNumberLabel.Text = dt.Rows[0]["TotallingAccountNumber"].ToString(); totallingAccountNameLabel.Text = dt.Rows[0]["TotallingAccountName"].ToString(); postedLabel.Text = dt.Rows[0]["IsPosted"].ToString(); accountLevelLabel.Text = dt.Rows[0]["AccountLevel"].ToString(); useAsLabel.Text = dt.Rows[0]["UseAs"].ToString(); bankAccountNumberLabel.Text = dt.Rows[0]["BankAccountNumber"].ToString(); descriptionLabel.Text = dt.Rows[0]["Description"].ToString(); group1Label.Text = dt.Rows[0]["Group1"].ToString(); group2Label.Text = dt.Rows[0]["Group2"].ToString(); group3Label.Text = dt.Rows[0]["Group3"].ToString(); group4Label.Text = dt.Rows[0]["Group4"].ToString(); group5Label.Text = dt.Rows[0]["Group5"].ToString(); group1NameLabel.Text = dt.Rows[0]["Group1Name"].ToString(); group2NameLabel.Text = dt.Rows[0]["Group2Name"].ToString(); group3NameLabel.Text = dt.Rows[0]["Group3Name"].ToString(); group4NameLabel.Text = dt.Rows[0]["Group4Name"].ToString(); group5NameLabel.Text = dt.Rows[0]["Group5Name"].ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Chart Of Account 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 deleteLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); string status = chartOfAccount.DeleteChartOfAccountById(chartOfAccountListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), chartOfAccountListGridView.Rows[row.RowIndex].Cells[2].Text.ToString(), "False"); if (status == "Deleted") { GetChartOfAccountListByAccountType(accountTypeDropDownList.SelectedValue.Trim()); string message = "Chart Of Account <span class='actionTopic'>Deleted</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } else { GetChartOfAccountListByAccountType(accountTypeDropDownList.SelectedValue.Trim()); string message = "This Chart Of Account contains " + status + " child(s). You can't delete this Chart Of Account. You must delete the child(s) first."; MyAlertBox("WarningAlert(\"" + "Data Dependency" + "\", \"" + message + "\", \"\");"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
protected void deactivateLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); chartOfAccount.UpdateChartOfAccountActivation(chartOfAccountListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False"); chartOfAccountListGridView.Rows[row.RowIndex].Cells[6].Text = "False"; string message = "Chart Of Account <span class='actionTopic'>Deactivated</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
public static string AccountListView(string AccountId) { try { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); string json = JsonConvert.SerializeObject(chartOfAccount.GetChartOfAccountById(AccountId)); json = json.Substring(1, json.Length - 2); return json; } catch (Exception) { throw; } }
public void UpdateChartOfAccount(ChartOfAccountBLL chartOfAccount, LumexDBPlayer db) { try { db.AddParameters("@AccountId", chartOfAccount.AccountId.Trim()); db.AddParameters("@AccountName", chartOfAccount.AccountName.Trim()); db.AddParameters("@UseAs", chartOfAccount.UseAs.Trim()); db.AddParameters("@BankAccountNumber", chartOfAccount.BankAccountNumber.Trim()); db.AddParameters("@Description", chartOfAccount.Description.Trim()); db.AddParameters("@ModifiedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@ModifiedFrom", LumexLibraryManager.GetTerminal()); db.ExecuteNonQuery("UPDATE_CHART_OF_ACCOUNT_BY_ID", true); } catch (Exception) { throw; } finally { chartOfAccount = null; } }