From ab00b7ec694ffcb8ddfae842380c6b3abda2747f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 29 Jul 2021 23:49:16 +0000 Subject: [PATCH] --- server/AyaNova/DataList/PMDataList.cs | 2 +- server/AyaNova/biz/PMBiz.cs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/server/AyaNova/DataList/PMDataList.cs b/server/AyaNova/DataList/PMDataList.cs index b5f0e2d6..7f927e70 100644 --- a/server/AyaNova/DataList/PMDataList.cs +++ b/server/AyaNova/DataList/PMDataList.cs @@ -18,7 +18,7 @@ namespace AyaNova.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PMSerialNumber", "Customer", "PMNextServiceDate", "PMNextWoGenerateDate", "pmactive", "PMStopGeneratingDate" }; - DefaultSortBy = new Dictionary() { { "PMNextWoGenerateDate", "-" } }; + DefaultSortBy = new Dictionary() { { "PMSerialNumber", "-" } }; FieldDefinitions = new List(); FieldDefinitions.Add(new DataListFieldDefinition diff --git a/server/AyaNova/biz/PMBiz.cs b/server/AyaNova/biz/PMBiz.cs index 735badb9..6e85d2a6 100644 --- a/server/AyaNova/biz/PMBiz.cs +++ b/server/AyaNova/biz/PMBiz.cs @@ -704,6 +704,28 @@ namespace AyaNova.Biz } + //Did they exclude *all* days of the week (int value 127) + if ((int)proposedObj.ExcludeDaysOfWeek == 127) + { + AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ExcludeDaysOfWeek"); + } + + //GenerateBefore MUST be less than Repeat Interval or bad things happen + //normalizing to dates makes this easier + var dtNow = DateTime.UtcNow; + var dtGenBefore = CalculateNewDateFromSpanAndUnit(dtNow, proposedObj.GenerateBeforeUnit, proposedObj.GenerateBeforeInterval); + var dtRepeat = CalculateNewDateFromSpanAndUnit(dtNow, proposedObj.RepeatUnit, proposedObj.RepeatInterval); + if (!(dtGenBefore < dtRepeat)) + { + AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "GenerateBeforeInterval", "message here??"); + } + + + + + + + /* todo: quote status list first, it's a table of created items, keep properties from v7 but add the following properties: