public IList<Core.Business.AccountFriendGroup> GetAllGroupByAccountId(long accountId) { IList<Core.Business.AccountFriendGroup> accountFriendGrouplist = new List<Core.Business.AccountFriendGroup>(); SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@AccountId", SqlDbType.BigInt, accountId); SqlDataReader reader = sql.ExecuteSPReader("USP_AccountFriendGroup_Select_By_AccountId"); if (reader != null) { while (reader.Read()) { Core.Business.AccountFriendGroup accountFriendGroup = new Core.Business.AccountFriendGroup(); if (!reader.IsDBNull(0)) accountFriendGroup.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) accountFriendGroup.AccountId = reader.GetInt64(1); if (!reader.IsDBNull(2)) accountFriendGroup.DateCreated = reader.GetDateTime(2); if (!reader.IsDBNull(3)) accountFriendGroup.Name = reader.GetString(3); accountFriendGroup.MarkOld(); accountFriendGrouplist.Add(accountFriendGroup); } reader.Close(); } return accountFriendGrouplist; }
public Core.Business.AccountFriendGroup Select(long id) { SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@Id", SqlDbType.BigInt, id); SqlDataReader reader = sql.ExecuteSPReader("USP_AccountFriendGroup_Select_By_Id"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.AccountFriendGroup accountFriendGroup = new Core.Business.AccountFriendGroup(); if (!reader.IsDBNull(0)) accountFriendGroup.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) accountFriendGroup.AccountId = reader.GetInt64(1); if (!reader.IsDBNull(2)) accountFriendGroup.DateCreated = reader.GetDateTime(2); if (!reader.IsDBNull(3)) accountFriendGroup.Name = reader.GetString(3); reader.Close(); return accountFriendGroup; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }