public static CustomList <Gen_Bank> GetAllGen_Bank() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <Gen_Bank> Gen_BankCollection = new CustomList <Gen_Bank>(); IDataReader reader = null; const String sql = "select *from Gen_Bank"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { Gen_Bank newGen_Bank = new Gen_Bank(); newGen_Bank.SetData(reader); Gen_BankCollection.Add(newGen_Bank); } Gen_BankCollection.InsertSpName = "spInsertGen_Bank"; Gen_BankCollection.UpdateSpName = "spUpdateGen_Bank"; Gen_BankCollection.DeleteSpName = "spDeleteGen_Bank"; return(Gen_BankCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
private void PopulateBankInformation(Gen_Bank bank) { try { txtBankName.Text = bank.BnakName; txtBankSName.Text = bank.BankSName; txtAddress.Text = bank.Address; txtContactPerson.Text = bank.ContactPerson; BankBranchList = manager.GetAllBank_Branch(bank.BankKey); } catch (Exception ex) { throw (ex); } }
public static CustomList<Gen_Bank> GetAllGen_Bank() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList<Gen_Bank> Gen_BankCollection = new CustomList<Gen_Bank>(); IDataReader reader = null; const String sql = "select *from Gen_Bank"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { Gen_Bank newGen_Bank = new Gen_Bank(); newGen_Bank.SetData(reader); Gen_BankCollection.Add(newGen_Bank); } Gen_BankCollection.InsertSpName = "spInsertGen_Bank"; Gen_BankCollection.UpdateSpName = "spUpdateGen_Bank"; Gen_BankCollection.DeleteSpName = "spDeleteGen_Bank"; return Gen_BankCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
protected void btnSave_Click(object sender, EventArgs e) { try { CustomList<Gen_Bank> lstBank = BankMasterList; if (lstBank.Count == 0) { Gen_Bank newBank = new Gen_Bank(); lstBank.Add(newBank); } SetDataFromControlToObj(ref lstBank); CustomList<Bank_Branch> lstBankBranch = (CustomList<Bank_Branch>)BankBranchList; if (!CheckUserAuthentication(lstBank, lstBankBranch)) return; manager.SaveBank(ref lstBank, ref lstBankBranch); ((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)); } }