This commit is contained in:
2021-07-28 20:18:45 +00:00
parent 3927ea1b49
commit f240b2030e
4 changed files with 28 additions and 3 deletions

View File

@@ -0,0 +1,25 @@
using System;
namespace AyaNova.Biz
{
/// <summary>
/// Days of week
/// </summary>
[Flags]
public enum DaysOfWeek : int
{
//https://stackoverflow.com/questions/8447/what-does-the-flags-enum-attribute-mean-in-c
//MAX 31 (2147483647)!!! or will overflow int and needs to be turned into a long
//Must be a power of two: https://en.wikipedia.org/wiki/Power_of_two
//bitwise selection of days of week
//https://stackoverflow.com/a/24174625/8939
Monday = 1,
Tuesday = 2,
Wednesday = 4,
Thursday = 8,
Friday = 16,
Saturday = 32,
Sunday = 64
}
}

View File

@@ -23,7 +23,7 @@ namespace AyaNova.Models
//----
public DateTime? StopGeneratingDate { get; set; }
public bool[] ExcludeDaysOfWeek { get; set; }//Monday to Sunday (0-6 index)
public DaysOfWeek ExcludeDaysOfWeek { get; set; }//bit field flags set
public bool Active { get; set; }
public DateTime NextServiceDate { get; set; }
public PMTimeUnit RepeatUnit { get; set; }

View File

@@ -1016,7 +1016,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
+ "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, customerid BIGINT NOT NULL REFERENCES acustomer (id), "
+ "projectid BIGINT REFERENCES aproject, contractid BIGINT NULL, internalreferencenumber text, "
+ "customerreferencenumber text, customercontactname text, createddate TIMESTAMP NOT NULL, onsite BOOL NOT NULL, "
+ "stopgeneratingdate TIMESTAMP, nextservicedate TIMESTAMP NOT NULL, generatedate TIMESTAMP, excludedaysofweek BOOL ARRAY NOT NULL, active BOOL NOT NULL, "
+ "stopgeneratingdate TIMESTAMP, nextservicedate TIMESTAMP NOT NULL, generatedate TIMESTAMP, excludedaysofweek INTEGER NOT NULL, active BOOL NOT NULL, "
+ "repeatunit INTEGER NOT NULL, generatebeforeunit INTEGER NOT NULL, repeatinterval INTEGER NOT NULL, generatebeforeinterval INTEGER NOT NULL, "
+ "postaddress TEXT, postcity TEXT, postregion TEXT, postcountry TEXT, postcode TEXT, address TEXT, city TEXT, region TEXT, country TEXT, latitude DECIMAL(9,6), longitude DECIMAL(9,6) "
+ ")");

View File

@@ -3703,7 +3703,7 @@ namespace AyaNova.Util
//------
o.StopGeneratingDate = woDate.AddYears(1);
o.ExcludeDaysOfWeek = new bool[] { true, true, true, true, true, false, false };//Monday to Sunday (0-6 index)
o.ExcludeDaysOfWeek = DaysOfWeek.Saturday | DaysOfWeek.Sunday;
o.Active = true;
o.NextServiceDate = woDate.AddDays(1);
o.RepeatInterval = 1;