Added new alarm filter
This commit is contained in:
@@ -30,7 +30,7 @@ namespace Step.Config
|
||||
ReadToolManagerConfig();
|
||||
ReadMacros();
|
||||
}
|
||||
catch (System.Xml.XmlException ex)
|
||||
catch (XmlException ex)
|
||||
{
|
||||
ExceptionManager.Manage(ERROR_LEVEL.FATAL,
|
||||
"Error while reading file: " + ex.SourceUri +
|
||||
@@ -61,7 +61,7 @@ namespace Step.Config
|
||||
// Open file reader
|
||||
XDocument xmlConfigFile = XDocument.Load(BASE_PATH + "\\" + configFilePath);
|
||||
// Validate file
|
||||
xmlConfigFile.Validate(readerSettings, ValidationHandler);
|
||||
xmlConfigFile.Validate(readerSettings, ValidationHandler, true);
|
||||
|
||||
return xmlConfigFile;
|
||||
}
|
||||
@@ -125,7 +125,10 @@ namespace Step.Config
|
||||
}
|
||||
else if (e.Severity == XmlSeverityType.Error)
|
||||
{
|
||||
ExceptionManager.Manage(ERROR_LEVEL.FATAL, e.Message);
|
||||
ExceptionManager.Manage(ERROR_LEVEL.FATAL,
|
||||
"Error while reading file: " + e.Exception.SourceUri +
|
||||
"\n Error: " + e.Message
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,13 +45,13 @@ namespace Step.Database.Controllers
|
||||
return paginated;
|
||||
}
|
||||
|
||||
public List<DTOAlarmHistoricModel> GetPaginatedWithFilter(int page, int pageSize, DateTime startDate, DateTime endDate, List<int> userIds)
|
||||
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
|
||||
// && userIds.Any(y => x.Users.Select(z => z.UserId).Any(z => z == y))
|
||||
)
|
||||
.Skip(page * pageSize)
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace Step.Model.DTOModels.AlarmModels
|
||||
{
|
||||
public int Page;
|
||||
public int PageSize;
|
||||
public string Title;
|
||||
public ALARM_TYPE Type;
|
||||
public DateTime StartDate;
|
||||
public DateTime EndDate;
|
||||
public List<int> UserIds;
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Step.NC
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// If the program is a job
|
||||
// JOB CASE
|
||||
if (program == PROGRAM_TYPE_ENUM.JOB)
|
||||
{
|
||||
// Get selected process
|
||||
@@ -121,6 +121,7 @@ namespace Step.NC
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
// PART PROGRAM CASE
|
||||
else
|
||||
{
|
||||
if (File.Exists(path))
|
||||
|
||||
@@ -26,6 +26,5 @@ namespace Step.App_Start
|
||||
|
||||
return _camelCaseContractResolver.ResolveContract(type);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,23 +18,23 @@ namespace Step.Controllers.WebApi
|
||||
[RoutePrefix("api/alarm")]
|
||||
public class ApiAlarmController : ApiController
|
||||
{
|
||||
[Route(""), HttpGet]
|
||||
public IHttpActionResult GetAll(int page, int pageSize)
|
||||
{
|
||||
using (AlarmsController alarm = new AlarmsController())
|
||||
{
|
||||
var a = alarm.GetPaginated(page, pageSize);
|
||||
//[Route(""), HttpGet]
|
||||
//public IHttpActionResult GetAll(int page, int pageSize)
|
||||
//{
|
||||
// using (AlarmsController alarm = new AlarmsController())
|
||||
// {
|
||||
// var a = alarm.GetPaginated(page, pageSize);
|
||||
|
||||
return Ok(a);
|
||||
}
|
||||
}
|
||||
// return Ok(a);
|
||||
// }
|
||||
//}
|
||||
|
||||
[Route("paginated"), HttpPost]
|
||||
public IHttpActionResult GetFiltered([FromBody]DTOAlarmsFilterModel data)
|
||||
{
|
||||
using (AlarmsController alarm = new AlarmsController())
|
||||
{
|
||||
var alarms = alarm.GetPaginatedWithFilter(data.Page - 1, data.PageSize, data.StartDate, data.EndDate, data.UserIds);
|
||||
var alarms = alarm.GetPaginatedWithFilter(data.Title, data.Type, data.Page - 1, data.PageSize, data.StartDate, data.EndDate, data.UserIds);
|
||||
|
||||
return Ok(alarms);
|
||||
}
|
||||
|
||||
@@ -138,14 +138,12 @@ namespace Step.Controllers.WebApi
|
||||
public IHttpActionResult GetSharedFolderFileList(string sharedPath)
|
||||
{
|
||||
List<object> filelist = new List<object>();
|
||||
|
||||
// NC - PC shared folder path
|
||||
string sharedFullPath = NcConfig.SharedPath + sharedPath;
|
||||
|
||||
if (!Directory.Exists(sharedFullPath))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// Create list of directories
|
||||
foreach (string item in Directory.GetDirectories(sharedFullPath))
|
||||
{
|
||||
filelist.Add(new
|
||||
@@ -158,7 +156,7 @@ namespace Step.Controllers.WebApi
|
||||
}
|
||||
|
||||
string sharedNcPath = NcConfig.SharedName + sharedPath.Replace('\\', '/');
|
||||
|
||||
// Add files to list
|
||||
foreach (string item in Directory.GetFiles(sharedFullPath))
|
||||
{
|
||||
if (VALID_FILE_EXTENSIONS.Contains(Path.GetExtension(item).ToLower()))
|
||||
@@ -191,6 +189,7 @@ namespace Step.Controllers.WebApi
|
||||
{
|
||||
if (item.IsAFile)
|
||||
{
|
||||
// Get part program under "file" key
|
||||
if (item.ParameterName == "file")
|
||||
{
|
||||
using (NcHandler ncHandler = new NcHandler())
|
||||
@@ -204,7 +203,7 @@ namespace Step.Controllers.WebApi
|
||||
// Check if reps parameter is null or isn't a valid int
|
||||
if (repsParam == null || !Int32.TryParse(repsParam.Value, out int reps))
|
||||
return BadRequest();
|
||||
|
||||
// Upload
|
||||
CmsError cmsError = ncHandler.UploadPartProgramAndAddToQueue(QUEUE_TMP_FOLDER, item.FileName, reps, out queueItem);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
+2
-2
@@ -91,10 +91,10 @@ namespace Step
|
||||
ServerControlWindow.Stop();
|
||||
}
|
||||
|
||||
private static bool ValidateAddress(String Addr)
|
||||
private static bool ValidateAddress(string Addr)
|
||||
{
|
||||
//If is an asterisk is OK
|
||||
if (String.IsNullOrWhiteSpace(Addr) || Addr == "*")
|
||||
if (string.IsNullOrWhiteSpace(Addr) || Addr == "*")
|
||||
return true;
|
||||
|
||||
//Find an IP Address
|
||||
|
||||
Reference in New Issue
Block a user