public static CustomList<ApplicationUser> GetAllApplicationUser() { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); CustomList<ApplicationUser> ApplicationUserCollection = new CustomList<ApplicationUser>(); IDataReader reader = null; const String sql = "Select * from ApplicationUser"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { ApplicationUser newApplicationUser = new ApplicationUser(); newApplicationUser.SetData(reader); ApplicationUserCollection.Add(newApplicationUser); } ApplicationUserCollection.InsertSpName = "spInsertApplicationUser"; ApplicationUserCollection.UpdateSpName = "spUpdateApplicationUser"; ApplicationUserCollection.DeleteSpName = "spDeleteApplicationUser"; return ApplicationUserCollection; } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } }
public static ApplicationUser GetDefaultApplicationByUserCode(string userCode) { ConnectionManager conManager = new ConnectionManager(ConnectionName.SysMan); IDataReader reader = null; conManager.OpenDataReader(out reader, "spWebGetDefaultApplicationByUserCode", userCode); ApplicationUser newApplication = new ApplicationUser(); try { while (reader.Read()) { newApplication.SetData(reader); } return newApplication; } catch (Exception ex) { throw (ex); } finally { if (conManager != null) { conManager.CloseConnection(); conManager.Dispose(); } if (reader != null && !reader.IsClosed) reader.Close(); } }