public static CustomList <CmnBankAccount> GetAllCmnBankAccount() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <CmnBankAccount> CmnBankAccountCollection = new CustomList <CmnBankAccount>(); IDataReader reader = null; String sql = "spFindBankAccount"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { CmnBankAccount newCmnBankAccount = new CmnBankAccount(); newCmnBankAccount.SetData(reader); CmnBankAccountCollection.Add(newCmnBankAccount); } return(CmnBankAccountCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
public static CustomList<CmnBankAccount> GetAllCmnBankAccount() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList<CmnBankAccount> CmnBankAccountCollection = new CustomList<CmnBankAccount>(); IDataReader reader = null; String sql = "spFindBankAccount"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { CmnBankAccount newCmnBankAccount = new CmnBankAccount(); newCmnBankAccount.SetData(reader); CmnBankAccountCollection.Add(newCmnBankAccount); } return CmnBankAccountCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
private void PopulateBankAccountInformation(CmnBankAccount bankAccount) { try { if (bankAccount.CostCenterID != 0) ddlCostCenter.SelectedValue = bankAccount.CostCenterID.ToString(); if (bankAccount.BranchOrUnitID != 0) ddlBranchOrUnit.SelectedValue = bankAccount.BranchOrUnitID.ToString(); txtAccountNo.Text = bankAccount.AccountNo; txtAccountName.Text = bankAccount.AccountName; if (bankAccount.AccountTypeID != 0) ddlAccountType.SelectedValue = bankAccount.AccountTypeID.ToString(); if (bankAccount.BankBranchID != 0) ddlBankBranch.SelectedValue = bankAccount.BankBranchID.ToString(); if (bankAccount.UserID != 0) ddlUserName.SelectedValue = bankAccount.UserID.ToString(); if (bankAccount.COAID != 0) ddlCOA.SelectedValue = bankAccount.COAID.ToString(); chkIsCompanyAccount.Checked = bankAccount.IsCompany; } catch (Exception ex) { throw (ex); } }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList<CmnBankAccount> lstCmnBankAccount = BankAccountList; if (lstCmnBankAccount.Count == 0) { CmnBankAccount newBankAccount = new CmnBankAccount(); lstCmnBankAccount.Add(newBankAccount); } SetDataFromControlToObj(ref lstCmnBankAccount); if (!CheckUserAuthentication(lstCmnBankAccount)) return; manager.SaveBankAccount(ref lstCmnBankAccount); ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg); } catch (SqlException ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }