public IList<Core.Business.UserRole> GetAllUserRole() { IList<Core.Business.UserRole> userRolelist = new List<Core.Business.UserRole>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllUserRole); if(reader != null) { while(reader.Read()) { Core.Business.UserRole userRole = new Core.Business.UserRole(); if (!reader.IsDBNull(0)) userRole.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) userRole.RoleID = reader.GetInt32(1); if (!reader.IsDBNull(2)) userRole.UserID = reader.GetInt32(2); if (!reader.IsDBNull(3)) userRole.UserType = reader.GetInt32(3); userRole.MarkOld(); userRolelist.Add(userRole); } reader.Close(); } return userRolelist; }
public IList<CY.Common.Core.Business.UserRole> GetListByRoleID(int RoleID) { IList<CY.Common.Core.Business.UserRole> userRolelist = new List<CY.Common.Core.Business.UserRole>(); SqlServerUtility db = new SqlServerUtility(); db.AddParameter("@RoleID",SqlDbType.Int,RoleID); SqlDataReader reader = db.ExecuteSqlReader(SqlGetByRoleId); if (reader != null) { while (reader.Read()) { Core.Business.UserRole userRole = new Core.Business.UserRole(); if (!reader.IsDBNull(0)) userRole.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) userRole.RoleID = reader.GetInt32(1); if (!reader.IsDBNull(2)) userRole.UserID = reader.GetInt32(2); if (!reader.IsDBNull(3)) userRole.UserType = reader.GetInt32(3); userRole.MarkOld(); userRolelist.Add(userRole); } reader.Close(); } return userRolelist; }
public Core.Business.UserRole Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectUserRole); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.UserRole userRole = new Core.Business.UserRole(); if (!reader.IsDBNull(0)) userRole.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) userRole.RoleID = reader.GetInt32(1); if (!reader.IsDBNull(2)) userRole.UserID = reader.GetInt32(2); if (!reader.IsDBNull(3)) userRole.UserType = reader.GetInt32(3); return userRole; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }