Added fields to maintenances model and config

This commit is contained in:
Lucio Maranta
2018-06-05 16:26:08 +02:00
parent 801e422345
commit 83cf50ecab
18 changed files with 163 additions and 29 deletions
@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using static Step.Config.ServerConfig;
using static Step.Model.Constants;
namespace Step.Database.Controllers
{
@@ -56,7 +57,7 @@ namespace Step.Database.Controllers
.Maintenances
.ToList();
// Find database rows that
// Find database rows that has to be deleted
List<MaintenanceModel> toDeleteMaint = dbMaintenances.Where(x =>
!MaintenancesConfig.Select(y => y.Id).Contains(x.MaintenanceId)
).ToList();
@@ -87,6 +88,8 @@ namespace Step.Database.Controllers
old.Interval = x.Intervall.TotalMinutes;
old.Type = x.Type;
old.CounterId = x.CouterId;
old.Description = x.Description;
old.UnitOfMeasure = (MAINTENANCE_UNIT_OF_MEASURE)Enum.Parse(typeof(MAINTENANCE_UNIT_OF_MEASURE), x.UnitOfMeasure);
return old;
}).FirstOrDefault();
}
@@ -104,6 +107,9 @@ namespace Step.Database.Controllers
Type = x.Type,
CounterId = x.CouterId,
CreationDate = DateTime.Now,
Description = x.Description,
UnitOfMeasure = (MAINTENANCE_UNIT_OF_MEASURE) Enum.Parse(typeof(MAINTENANCE_UNIT_OF_MEASURE),x.UnitOfMeasure),
UserId = null,
LastExpirationDate = null
})
.ToList();