public Core.Business.ExternalAppAccount Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("USP_ExternalAppAccount_Select_By_Id"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.ExternalAppAccount externalAppAccount = new Core.Business.ExternalAppAccount(); if (!reader.IsDBNull(0)) externalAppAccount.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) externalAppAccount.DateCreated = reader.GetDateTime(1); if (!reader.IsDBNull(2)) externalAppAccount.AppId = reader.GetInt64(2); if (!reader.IsDBNull(3)) externalAppAccount.AccountId = reader.GetInt64(3); reader.Close(); return externalAppAccount; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Core.Business.ExternalAppAccount> GetAllExternalAppAccount() { IList<Core.Business.ExternalAppAccount> externalAppAccountlist = new List<Core.Business.ExternalAppAccount>(); SqlServerUtility sql = new SqlServerUtility(connectionString); SqlDataReader reader = sql.ExecuteSPReader("USP_ExternalAppAccount_SelectAll"); if (reader != null) { while (reader.Read()) { Core.Business.ExternalAppAccount externalAppAccount = new Core.Business.ExternalAppAccount(); if (!reader.IsDBNull(0)) externalAppAccount.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) externalAppAccount.DateCreated = reader.GetDateTime(1); if (!reader.IsDBNull(2)) externalAppAccount.AppId = reader.GetInt64(2); if (!reader.IsDBNull(3)) externalAppAccount.AccountId = reader.GetInt64(3); externalAppAccount.MarkOld(); externalAppAccountlist.Add(externalAppAccount); } reader.Close(); } return externalAppAccountlist; }