Fix cms client primary screen

Removed shanks from Siemens library
Fix "isInUse" param
etc
This commit is contained in:
Lucio Maranta
2018-10-31 17:29:25 +01:00
parent 23ac28caeb
commit 76d617d633
13 changed files with 687 additions and 702 deletions
+4 -26
View File
@@ -4,7 +4,6 @@ using Step.Model.DTOModels.AlarmModels;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics;
using System.IO;
using System.Linq;
using static Step.Model.Constants;
@@ -27,41 +26,20 @@ namespace Step.Database.Controllers
dbCtx.Dispose();
}
public List<AlarmOccurrencesModel> GetPaginated(int page, int pageSize)
{
Stopwatch st = new Stopwatch();
st.Start();
DateTime l = DateTime.Parse("2013/01/01");
var paginated = dbCtx.AlarmOccurrences.Include("AlarmDescription").OrderBy(x => x.AlarmOccurrenceId)
.Where(x => x.TimeStamp < DateTime.Today && x.TimeStamp > l)
.Skip(page * pageSize)
.Take(pageSize)
.ToList();
Console.WriteLine(st.ElapsedMilliseconds);
st.Stop();
return paginated;
}
public List<DTOAlarmHistoricModel> GetPaginatedWithFilter(string message, ALARM_TYPE type, int page, int pageSize, DateTime startDate, DateTime endDate, List<int> userIds)
{
var occurrences = dbCtx
.AlarmOccurrences
.OrderBy(x => x.AlarmOccurrenceId)
.Where(x =>
x.TimeStamp >= startDate && x.TimeStamp <= endDate
x.TimeStamp >= startDate && x.TimeStamp <= endDate && x.Type == type
// && userIds.Any(y => x.Users.Select(z => z.UserId).Any(z => z == y))
)
.Skip(page * pageSize)
.Take(pageSize)
.Include("AlarmDescription")
.ToList();
//var ids = occurrences.Select(x => x.Id).ToList();
//var users = dbCtx.AlarmUsers.Where(x => ids.Contains(x.AlarmOccurrenceId) && userIds.Contains(x.UserId)).ToList();
return occurrences
.Select(x => (DTOAlarmHistoricModel)x)
.ToList();
@@ -191,7 +169,7 @@ namespace Step.Database.Controllers
#endregion NOTES
#region Attachment
#region ATTACHMENT
public List<AlarmFileModel> FindAttachmentByAlarmDescId(int alarmDescId)
{
@@ -253,6 +231,6 @@ namespace Step.Database.Controllers
File.Delete(ALARM_ATTACHMENT_PATH + attachment.LocalFileName);
}
#endregion Attachment
#endregion ATTACHMENT
}
}