public Core.Business.AccountFollower Select(CY.UME.Core.Business.Account account, CY.UME.Core.Business.Account Followed) { SqlServerUtility sql = new SqlServerUtility(connectionString); string sqlstr = "SELECT * FROM [dbo].[AccountFollower] where AccountId=" + Followed.Id + "and FollowerId=" + account.Id; SqlDataReader reader = sql.ExecuteSqlReader(sqlstr); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.AccountFollower accountFollower = new Core.Business.AccountFollower(); if (!reader.IsDBNull(0)) accountFollower.Id = reader.GetGuid(0); if (!reader.IsDBNull(3)) accountFollower.DataCreated = reader.GetDateTime(3); if (!reader.IsDBNull(1)) accountFollower.AccountId = reader.GetInt64(1); if (!reader.IsDBNull(2)) accountFollower.FollowerId = reader.GetInt64(2); reader.Close(); return accountFollower; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public Core.Business.AccountFollower Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("USP_AccountFollower_Select_By_Id"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.AccountFollower accountFollower = new Core.Business.AccountFollower(); if (!reader.IsDBNull(0)) accountFollower.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) accountFollower.DataCreated = reader.GetDateTime(1); if (!reader.IsDBNull(2)) accountFollower.AccountId = reader.GetInt64(2); if (!reader.IsDBNull(3)) accountFollower.FollowerId = reader.GetInt64(3); reader.Close(); return accountFollower; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }