This commit is contained in:
2020-02-11 18:08:29 +00:00
parent 4984a6a5ee
commit 4b078d0002
11 changed files with 17 additions and 19 deletions

View File

@@ -99,7 +99,7 @@ Response:
"dt": 8 "dt": 8
}, },
{ {
"cm": "WidgetRoles", "cm": "WidgetUserType",
"dt": 10 "dt": 10
}, },
{ {

View File

@@ -56,11 +56,11 @@ namespace AyaNova.DataList
}); });
FieldDefinitions.Add(new AyaDataListFieldDefinition FieldDefinitions.Add(new AyaDataListFieldDefinition
{ {
LtKey = "WidgetRoles", LtKey = "WidgetUserType",
FieldKey = "widgetroles", FieldKey = "widgetusertype",
UiFieldDataType = (int)UiFieldDataType.Enum, UiFieldDataType = (int)UiFieldDataType.Enum,
EnumType = typeof(AuthorizationRoles).ToString(), EnumType = typeof(AuthorizationRoles).ToString(),
SqlValueColumnName = "awidget.roles" SqlValueColumnName = "awidget.usertype"
}); });
FieldDefinitions.Add(new AyaDataListFieldDefinition FieldDefinitions.Add(new AyaDataListFieldDefinition
{ {

View File

@@ -51,7 +51,7 @@ namespace AyaNova.Biz
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetSerial", FieldKey = "Serial" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetSerial", FieldKey = "Serial" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetDollarAmount", FieldKey = "DollarAmount" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetDollarAmount", FieldKey = "DollarAmount" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetCount", FieldKey = "Count" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetCount", FieldKey = "Count" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetRoles", FieldKey = "Roles" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetUserType", FieldKey = "UserType" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetStartDate", FieldKey = "StartDate" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetStartDate", FieldKey = "StartDate" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetEndDate", FieldKey = "EndDate" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetEndDate", FieldKey = "EndDate" });
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetNotes", FieldKey = "Notes" }); l.Add(new AyaFormFieldDefinition { LtKey = "WidgetNotes", FieldKey = "Notes" });

View File

@@ -266,11 +266,9 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_STARTDATE_AFTER_ENDDATE, "StartDate"); AddError(ApiErrorCode.VALIDATION_STARTDATE_AFTER_ENDDATE, "StartDate");
//Enum is valid value //Enum is valid value
//Note: because of the way the flags work as powers of 2 and with the 1 being the first flag value, basically any value up to the "All" value will be valid if (!proposedObj.UserType.IsValid())
//because you can make any number from 0 to all using any combination of the flags so the only thing that will fail is less than zero or greater than All
if (!proposedObj.Roles.IsValid())
{ {
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Roles"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UserType");
} }
//Any form customizations to validate? //Any form customizations to validate?

View File

@@ -19,7 +19,7 @@ namespace AyaNova.Models
public uint Serial { get; set; } public uint Serial { get; set; }
public decimal? DollarAmount { get; set; } public decimal? DollarAmount { get; set; }
public bool? Active { get; set; } public bool? Active { get; set; }
public AuthorizationRoles Roles { get; set; } public UserType UserType { get; set; }
public DateTime? StartDate { get; set; } public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; } public DateTime? EndDate { get; set; }
public string Notes { get; set; } public string Notes { get; set; }

View File

@@ -1521,7 +1521,7 @@
"WidgetSerial":"Seriennummer", "WidgetSerial":"Seriennummer",
"WidgetDollarAmount":"Betrag", "WidgetDollarAmount":"Betrag",
"WidgetCount":"Anzahl", "WidgetCount":"Anzahl",
"WidgetRoles":"Rollen", "WidgetUserType":"Benutzertyp",
"WidgetStartDate":"Startdatum", "WidgetStartDate":"Startdatum",
"WidgetEndDate":"Enddatum", "WidgetEndDate":"Enddatum",
"WidgetNotes":"Notizen", "WidgetNotes":"Notizen",

View File

@@ -1520,7 +1520,7 @@
"WidgetSerial":"Serial #", "WidgetSerial":"Serial #",
"WidgetDollarAmount":"Price", "WidgetDollarAmount":"Price",
"WidgetCount":"Count", "WidgetCount":"Count",
"WidgetRoles":"Roles", "WidgetUserType":"User type",
"WidgetStartDate":"Start", "WidgetStartDate":"Start",
"WidgetEndDate":"End", "WidgetEndDate":"End",
"WidgetNotes":"Notes", "WidgetNotes":"Notes",

View File

@@ -1521,7 +1521,7 @@
"WidgetSerial":"Número de serie", "WidgetSerial":"Número de serie",
"WidgetDollarAmount":"Importe", "WidgetDollarAmount":"Importe",
"WidgetCount":"Recuento", "WidgetCount":"Recuento",
"WidgetRoles":"Funciones", "WidgetUserType":"Tipo de usuario",
"WidgetStartDate":"Fecha de comienzo", "WidgetStartDate":"Fecha de comienzo",
"WidgetEndDate":"Fecha de fin", "WidgetEndDate":"Fecha de fin",
"WidgetNotes":"Notas", "WidgetNotes":"Notas",

View File

@@ -1520,7 +1520,7 @@
"WidgetSerial": "Numéro de série", "WidgetSerial": "Numéro de série",
"WidgetDollarAmount": "Montant", "WidgetDollarAmount": "Montant",
"WidgetCount": "Nombre", "WidgetCount": "Nombre",
"WidgetRoles": "Rôles", "WidgetUserType": "Type d'utilisateur",
"WidgetStartDate": "Date de début", "WidgetStartDate": "Date de début",
"WidgetEndDate": "Date de fin", "WidgetEndDate": "Date de fin",
"WidgetNotes": "Notes", "WidgetNotes": "Notes",

View File

@@ -209,7 +209,7 @@ namespace AyaNova.Util
//Add widget table //Add widget table
//id, text, longtext, boolean, currency, //id, text, longtext, boolean, currency,
await ExecQueryAsync("CREATE TABLE awidget (id BIGSERIAL PRIMARY KEY, name varchar(255) not null, serial bigint not null," + await ExecQueryAsync("CREATE TABLE awidget (id BIGSERIAL PRIMARY KEY, name varchar(255) not null, serial bigint not null," +
"startdate timestamp, enddate timestamp, dollaramount decimal(19,5), active bool, roles int4, count integer," + "startdate timestamp, enddate timestamp, dollaramount decimal(19,5), active bool, usertype int4, count integer," +
"notes text, userid bigint null, customfields text, tags varchar(255) ARRAY)"); "notes text, userid bigint null, customfields text, tags varchar(255) ARRAY)");
//TEST TEST TEST ONLY FOR DEVELOPMENT TESTING TO ENSURE UNIQUENESS //TEST TEST TEST ONLY FOR DEVELOPMENT TESTING TO ENSURE UNIQUENESS

View File

@@ -585,7 +585,7 @@ namespace AyaNova.Util
var f = new Bogus.Faker(); var f = new Bogus.Faker();
//RANDOM ROLES //RANDOM ROLES
Array values = Enum.GetValues(typeof(AuthorizationRoles)); Array values = Enum.GetValues(typeof(UserType));
Random random = new Random(); Random random = new Random();
@@ -600,8 +600,8 @@ namespace AyaNova.Util
o.EndDate = DateTime.Now.AddMinutes(60).ToUniversalTime(); o.EndDate = DateTime.Now.AddMinutes(60).ToUniversalTime();
o.DollarAmount = Convert.ToDecimal(f.Commerce.Price()); o.DollarAmount = Convert.ToDecimal(f.Commerce.Price());
//Random but valid enum //Random but valid enum
AuthorizationRoles randomRole = (AuthorizationRoles)values.GetValue(random.Next(values.Length)); UserType randomUserType = (UserType)values.GetValue(random.Next(values.Length));
o.Roles = randomRole; o.UserType = randomUserType;
o.Notes = f.Lorem.Sentence(); o.Notes = f.Lorem.Sentence();
o.Tags = RandomTags(f); o.Tags = RandomTags(f);