/// <summary> /// get all role /// </summary> /// <returns></returns> public IList<RoleEntity> GetRoleAll() { var sql = @"SELECT * FROM SysRole ORDER BY RoleName"; var list = QuickRepository.Query<RoleEntity>(sql).ToList(); return list; }
/// <summary> /// get user all data /// </summary> /// <returns></returns> public IList<UserAccountEntity> GetUserAll() { var sql = @"SELECT * FROM SysUser WHERE AccountType <> -1 ORDER BY ID DESC"; var list = QuickRepository.Query<UserAccountEntity>(sql).ToList(); return list; }
/// <summary> /// get user log record 100 /// </summary> /// <returns></returns> public List <UserLogEntity> GetPaged100() { try { var sql = "SELECT TOP 100 * FROM SysUserLog ORDER BY ID DESC"; var list = QuickRepository.Query <UserLogEntity>(sql).ToList <UserLogEntity>(); return(list); } catch (System.Exception ex) { throw; } }
/// <summary> /// get role user data /// </summary> /// <returns></returns> public IList<RoleUserView> GetRoleUserAll() { var strSQL = @"SELECT ID, RoleID, RoleName, RoleCode, UserID, UserName FROM vw_SysRoleUserView ORDER BY RoleID, UserID"; var list = QuickRepository.Query<RoleUserView>(strSQL).ToList(); return list; }
/// <summary> /// query user of role /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<RoleUserView> QueryUserByRole(RoleEntity query) { var strSQL = @"SELECT ID, RoleID, RoleName, RoleCode, UserID, UserName FROM vw_SysRoleUserView WHERE RoleID=@roleID ORDER BY RoleID"; var list = QuickRepository.Query<RoleUserView>(strSQL, new { roleID = query.ID }).ToList(); return list; }
/// <summary> /// insert logout record /// </summary> /// <param name="log"></param> /// <returns></returns> public void Logout(UserLogEntity log) { try { var sql = "SELECT * FROM SysUserLog WHERE SessionGUID = @sessionGUID"; var entity = QuickRepository.Query <UserLogEntity>(sql, new { sessionGUID = log.SessionGUID }).ToList <UserLogEntity>()[0]; if (entity != null) { entity.LogoutTime = System.DateTime.Now; QuickRepository.Update <UserLogEntity>(entity); } } catch (System.Exception ex) { throw; } }