private MaintenceVueModel GetIgnoredVueModel(List <MessageMachineModel> data, MachineInfoModel machine) { var result = new MaintenceVueModel(); var messages = data.Select(a => new ManteinanceDataModel { id = a.Id, code = a.Code, type = ((enTypeAlarm)a.Type).GetDescription(), time = CommonViewService.getTimeViewModel(a.ElapsedTime), timestamp = DateTime.SpecifyKind(a.IgnoreDate ?? DateTime.MinValue, DateTimeKind.Utc), utc = machine.UTC, expiredSpan = CommonViewService.getTimeViewModel(_messageService.GetExpiredSpan(a)), description = a.Description, user = _userManagerViewService.GetUser(a.UserId) }).ToList(); result.messages = messages.OrderByDescending(o => o.time.elapsed).ToList(); var sorting = new SortingViewModel(); sorting.duration = enSorting.Descending.GetDescription(); sorting.user = enSorting.Descending.GetDescription(); sorting.timestamp = enSorting.Descending.GetDescription(); result.sorting = sorting; return(result); }
private MaintenceVueModel GetKpiVueModel(List <MessageMachineModel> data, MachineInfoModel machine) { var result = new MaintenceVueModel(); var messages = data.Select(a => new ManteinanceDataModel { id = a.Id, day = (DateTime)a.Day?.Date, ignoreDate = (DateTime)a.IgnoreDate?.Date, dateDiff = ((TimeSpan)(a.IgnoreDate?.Date - a.Day?.Date)).TotalDays, utc = machine.UTC, description = a.Description, user = _userManagerViewService.GetUser(a.UserId) }).ToList(); result.messages = messages.OrderByDescending(o => o.day).ToList(); var sorting = new SortingViewModel(); sorting.user = enSorting.Descending.GetDescription(); sorting.dateDiff = enSorting.Descending.GetDescription(); result.sorting = sorting; return(result); }
private MaintenceVueModel GetVueModel(MachineInfoModel machine, PeriodModel period) { var result = new MaintenceVueModel(); var data = _messageService.GetMaintenanceMessages(machine, period); if (data.Count == 0) { return(result); } var messages = data.Select(a => new ManteinanceDataModel() { id = a.Id, code = a.Code, type = ((enTypeAlarm)a.Type).GetDescription(), time = CommonViewService.getTimeViewModel(a.ElapsedTime), timestamp = DateTime.SpecifyKind(a.Day ?? DateTime.MinValue, DateTimeKind.Utc), utc = machine.UTC, expiredSpan = CommonViewService.getTimeViewModel(_messageService.GetExpiredSpan(a)), description = a.Description, icon = GetIcon(a) }).ToList(); messages = messages.OrderByDescending(o => o.time.elapsed).ToList(); var sorting = new SortingViewModel(); sorting.duration = enSorting.Descending.GetDescription(); result.messages = messages; result.sorting = sorting; return(result); }