protected void GetBankById(string bankId) { BankBLL bank = new BankBLL(); try { DataTable dt = bank.GetBankById(bankId); if (dt.Rows.Count > 0) { bankNameLabel.Text = dt.Rows[0]["BankName"].ToString(); descriptionLabel.Text = dt.Rows[0]["Description"].ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Bank Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = "Somethings goes wrong in Get Bank"; if (ex.InnerException != null) { message += " --> Somethings goes wrong in Page Load "; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { bank = null; } }
protected void GetBankList() { BankBLL bank = new BankBLL(); try { DataTable dt = bank.GetBankList(); bankListGridView.DataSource = dt; bankListGridView.DataBind(); if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Bank List Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = "Somethings goes wrong in Get Bank"; if (ex.InnerException != null) { message += " --> Somethings goes wrong in Get Bank"; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { bank = null; } }
protected void LoadBanks() { BankBLL bank = new BankBLL(); try { DataTable dt = bank.GetActiveBankList(); bankDropDownList.DataSource = dt; bankDropDownList.DataValueField = "BankId"; bankDropDownList.DataTextField = "BankName"; bankDropDownList.DataBind(); bankDropDownList.Items.Insert(0, ""); bankDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Bank Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = "Somethings goes wrong in Load Bank"; if (ex.InnerException != null) { message += " --> Somethings goes wrong in Page Load"; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { bank = null; } }
protected void saveButton_Click(object sender, EventArgs e) { BankBLL bank = new BankBLL(); try { if (bankNameTextBox.Text.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Bank Name field is required."; } else if (descriptionTextBox.Text.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Description field is required."; } else { bank.BankName = bankNameTextBox.Text.Trim(); bank.Description = descriptionTextBox.Text.Trim(); if (!bank.CheckDuplicateBank(bank.BankName.Trim())) { DataTable dt = bank.SaveBank(); if (dt.Rows.Count > 0) { string message = "Bank <span class='actionTopic'>Created</span> Successfully with Bank ID: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/AccUI/Bank/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "<span class='actionTopic'>Failed</span> to Create Bank."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } else { string message = "This Bank Name <span class='actionTopic'>already exist</span>, try another one."; MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");"); } } } catch (Exception ex) { string message = "Somethings goes wrong in Save"; if (ex.InnerException != null) { message += " --> Somethings goes wrong in save Bank "; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { bank = null; } }
protected void deletedListButton_Click(object sender, EventArgs e) { BankBLL bank = new BankBLL(); 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 = bank.GetDeletedBankListByDateRangeAll(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 Bank List Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-info"); } } } catch (Exception ex) { string message = "Somethings goes wrong in Delete"; if (ex.InnerException != null) { message += " -->Somethings goes wrong in Deleted List "; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { bank = null; MyAlertBox("MyOverlayStop();"); } }
public DataTable SaveBank(BankBLL bank, LumexDBPlayer db) { try { db.AddParameters("@BankName", bank.BankName.Trim()); db.AddParameters("@Description", bank.Description.Trim()); db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal()); DataTable dt = db.ExecuteDataTable("INSERT_BANK", true); return dt; } catch (Exception) { throw; } finally { bank = null; } }
protected void updateButton_Click(object sender, EventArgs e) { BankBLL bank = new BankBLL(); try { if (bankIdForUpdateHiddenField.Value.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Bank not found to update."; } else if (bankNameTextBox.Text.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Bank Name field is required."; } else if (descriptionTextBox.Text.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Description field is required."; } else { bank.BankId = bankIdForUpdateHiddenField.Value.Trim(); bank.BankName = bankNameTextBox.Text.Trim(); bank.Description = descriptionTextBox.Text.Trim(); if (!bank.CheckDuplicateBank(bankNameTextBox.Text.Trim())) { bank.UpdateBank(); bankNameForUpdateHiddenField.Value = ""; bankIdForUpdateHiddenField.Value = ""; string message = "Bank <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/AccUI/Bank/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { if (bankNameForUpdateHiddenField.Value == bankNameTextBox.Text.Trim()) { bank.BankName = "WithOut"; bank.UpdateBank(); bankNameForUpdateHiddenField.Value = ""; bankIdForUpdateHiddenField.Value = ""; string message = "Bank <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/AccUI/Bank/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "This Bank Name <span class='actionTopic'>already exist</span>, try another one."; MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");"); } } } } catch (Exception ex) { string message = "Somethings goes wrong in Update"; if (ex.InnerException != null) { message += " --> Somethings goes wrong in Page Load "; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { bank = null; } }
protected void activateLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; BankBLL bank = new BankBLL(); bank.UpdateBankActivation(bankListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "True"); bankListGridView.Rows[row.RowIndex].Cells[3].Text = "True"; string message = "Bank <span class='actionTopic'>Activated</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } catch (Exception ex) { string message = "Somethings goes wrong in Activate"; if (ex.InnerException != null) { message += " --> Somethings goes wrong in Activate"; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
public void UpdateBank(BankBLL bank, LumexDBPlayer db) { try { db.AddParameters("@BankId", bank.BankId.Trim()); db.AddParameters("@BankName", bank.BankName.Trim()); db.AddParameters("@Description", bank.Description.Trim()); db.AddParameters("@ModifiedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@ModifiedFrom", LumexLibraryManager.GetTerminal()); db.ExecuteNonQuery("UPDATE_BANK_BY_ID", true); } catch (Exception) { throw; } finally { bank = null; } }