修改BUG:后台消息通知栏没有倒序排序

This commit is contained in:
Argo-Lenovo 2016-12-16 10:52:13 +08:00
parent 6b672d3a69
commit 2998a282bb
5 changed files with 8 additions and 8 deletions

View File

@ -18,7 +18,7 @@ namespace Bootstrap.Admin.Controllers
var ret = new Notifications();
// New Users
var user = UserHelper.RetrieveNewUsers();
ret.Users = user.Take(6).OrderByDescending(u => u.RegisterTime).ToList();
ret.Users = user.Take(6).ToList();
ret.Users.AsParallel().ForAll(n =>
{
var ts = DateTime.Now - n.RegisterTime;
@ -31,7 +31,7 @@ namespace Bootstrap.Admin.Controllers
// Tasks
var task = TaskHelper.RetrieveTasks();
ret.Tasks = task.Take(6).OrderByDescending(u => u.AssignTime).ToList();
ret.Tasks = task.Take(6).ToList();
ret.TasksCount = task.Count();
//Message
@ -42,7 +42,7 @@ namespace Bootstrap.Admin.Controllers
//Apps
var apps = ExceptionHelper.RetrieveExceptions().Where(n => n.ExceptionType != "Longbow.Data.DBAccessException");
ret.Apps = apps.Take(6).OrderByDescending(a => a.LogTime).ToList();
ret.Apps = apps.Take(6).ToList();
ret.Apps.AsParallel().ForAll(n =>
{
n.ExceptionType = n.ExceptionType.Split('.').Last();
@ -56,7 +56,7 @@ namespace Bootstrap.Admin.Controllers
//Dbs
var dbs = ExceptionHelper.RetrieveExceptions().Where(n => n.ExceptionType == "Longbow.Data.DBAccessException");
ret.Dbs = dbs.Take(6).OrderByDescending(d => d.LogTime).ToList();
ret.Dbs = dbs.Take(6).ToList();
ret.Dbs.AsParallel().ForAll(n =>
{
var ts = DateTime.Now - n.LogTime;

View File

@ -47,7 +47,7 @@ namespace Bootstrap.DataAccess
{
return CacheManager.GetOrAdd(RetrieveExceptionsDataKey, CacheSection.RetrieveIntervalByKey(RetrieveExceptionsDataKey), key =>
{
string sql = "select top 1000 * from Exceptions";
string sql = "select top 1000 * from Exceptions order by LogTime desc";
List<Exceptions> Exceptions = new List<Exceptions>();
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
try

View File

@ -26,7 +26,7 @@ namespace Bootstrap.DataAccess
{
var messageRet = CacheManager.GetOrAdd(RetrieveMessageDataKey, CacheSection.RetrieveIntervalByKey(RetrieveMessageDataKey), key =>
{
string sql = "select m.*, d.Name, isnull(i.Code + u.Icon, '~/Content/images/uploader/default.jpg'), u.DisplayName from[Messages] m left join Dicts d on m.Label = d.Code and d.Category = N'消息标签' and d.Define = 0 left join Dicts i on i.Category = N'头像地址' and i.Name = N'头像路径' and i.Define = 0 inner join Users u on m.[From] = u.UserName where [To] = @UserName or [From] = @UserName";
string sql = "select m.*, d.Name, isnull(i.Code + u.Icon, '~/Content/images/uploader/default.jpg'), u.DisplayName from [Messages] m left join Dicts d on m.Label = d.Code and d.Category = N'消息标签' and d.Define = 0 left join Dicts i on i.Category = N'头像地址' and i.Name = N'头像路径' and i.Define = 0 inner join Users u on m.[From] = u.UserName where [To] = @UserName or [From] = @UserName order by m.SendTime desc";
List<Message> messages = new List<Message>();
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
try

View File

@ -19,7 +19,7 @@ namespace Bootstrap.DataAccess
{
return CacheManager.GetOrAdd(RetrieveTasksDataKey, CacheSection.RetrieveIntervalByKey(RetrieveTasksDataKey), key =>
{
string sql = "select t.*, u.DisplayName from Tasks t inner join Users u on t.UserName = u.UserName";
string sql = "select top 1000 t.*, u.DisplayName from Tasks t inner join Users u on t.UserName = u.UserName order by AssignTime desc";
List<Task> tasks = new List<Task>();
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
try

View File

@ -105,7 +105,7 @@ namespace Bootstrap.DataAccess
{
return CacheManager.GetOrAdd(RetrieveNewUsersDataKey, CacheSection.RetrieveIntervalByKey(RetrieveNewUsersDataKey), key =>
{
string sql = "select ID, UserName, DisplayName, RegisterTime, [Description] from Users Where ApprovedTime is null and RejectedTime is null";
string sql = "select ID, UserName, DisplayName, RegisterTime, [Description] from Users Where ApprovedTime is null and RejectedTime is null order by RegisterTime desc";
List<User> Users = new List<User>();
DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql);
try