This commit is contained in:
@@ -99,7 +99,7 @@ Response:
|
||||
"dt": 8
|
||||
},
|
||||
{
|
||||
"cm": "WidgetRoles",
|
||||
"cm": "WidgetUserType",
|
||||
"dt": 10
|
||||
},
|
||||
{
|
||||
|
||||
@@ -56,11 +56,11 @@ namespace AyaNova.DataList
|
||||
});
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
LtKey = "WidgetRoles",
|
||||
FieldKey = "widgetroles",
|
||||
LtKey = "WidgetUserType",
|
||||
FieldKey = "widgetusertype",
|
||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
EnumType = typeof(AuthorizationRoles).ToString(),
|
||||
SqlValueColumnName = "awidget.roles"
|
||||
SqlValueColumnName = "awidget.usertype"
|
||||
});
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace AyaNova.Biz
|
||||
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetSerial", FieldKey = "Serial" });
|
||||
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetDollarAmount", FieldKey = "DollarAmount" });
|
||||
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 = "WidgetEndDate", FieldKey = "EndDate" });
|
||||
l.Add(new AyaFormFieldDefinition { LtKey = "WidgetNotes", FieldKey = "Notes" });
|
||||
|
||||
@@ -265,12 +265,10 @@ namespace AyaNova.Biz
|
||||
if (proposedObj.StartDate > proposedObj.EndDate)
|
||||
AddError(ApiErrorCode.VALIDATION_STARTDATE_AFTER_ENDDATE, "StartDate");
|
||||
|
||||
//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
|
||||
//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())
|
||||
//Enum is valid value
|
||||
if (!proposedObj.UserType.IsValid())
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Roles");
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UserType");
|
||||
}
|
||||
|
||||
//Any form customizations to validate?
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace AyaNova.Models
|
||||
public uint Serial { get; set; }
|
||||
public decimal? DollarAmount { get; set; }
|
||||
public bool? Active { get; set; }
|
||||
public AuthorizationRoles Roles { get; set; }
|
||||
public UserType UserType { get; set; }
|
||||
public DateTime? StartDate { get; set; }
|
||||
public DateTime? EndDate { get; set; }
|
||||
public string Notes { get; set; }
|
||||
|
||||
@@ -1521,7 +1521,7 @@
|
||||
"WidgetSerial":"Seriennummer",
|
||||
"WidgetDollarAmount":"Betrag",
|
||||
"WidgetCount":"Anzahl",
|
||||
"WidgetRoles":"Rollen",
|
||||
"WidgetUserType":"Benutzertyp",
|
||||
"WidgetStartDate":"Startdatum",
|
||||
"WidgetEndDate":"Enddatum",
|
||||
"WidgetNotes":"Notizen",
|
||||
|
||||
@@ -1520,7 +1520,7 @@
|
||||
"WidgetSerial":"Serial #",
|
||||
"WidgetDollarAmount":"Price",
|
||||
"WidgetCount":"Count",
|
||||
"WidgetRoles":"Roles",
|
||||
"WidgetUserType":"User type",
|
||||
"WidgetStartDate":"Start",
|
||||
"WidgetEndDate":"End",
|
||||
"WidgetNotes":"Notes",
|
||||
|
||||
@@ -1521,7 +1521,7 @@
|
||||
"WidgetSerial":"Número de serie",
|
||||
"WidgetDollarAmount":"Importe",
|
||||
"WidgetCount":"Recuento",
|
||||
"WidgetRoles":"Funciones",
|
||||
"WidgetUserType":"Tipo de usuario",
|
||||
"WidgetStartDate":"Fecha de comienzo",
|
||||
"WidgetEndDate":"Fecha de fin",
|
||||
"WidgetNotes":"Notas",
|
||||
|
||||
@@ -1520,7 +1520,7 @@
|
||||
"WidgetSerial": "Numéro de série",
|
||||
"WidgetDollarAmount": "Montant",
|
||||
"WidgetCount": "Nombre",
|
||||
"WidgetRoles": "Rôles",
|
||||
"WidgetUserType": "Type d'utilisateur",
|
||||
"WidgetStartDate": "Date de début",
|
||||
"WidgetEndDate": "Date de fin",
|
||||
"WidgetNotes": "Notes",
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace AyaNova.Util
|
||||
//Add widget table
|
||||
//id, text, longtext, boolean, currency,
|
||||
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)");
|
||||
|
||||
//TEST TEST TEST ONLY FOR DEVELOPMENT TESTING TO ENSURE UNIQUENESS
|
||||
|
||||
@@ -585,7 +585,7 @@ namespace AyaNova.Util
|
||||
var f = new Bogus.Faker();
|
||||
|
||||
//RANDOM ROLES
|
||||
Array values = Enum.GetValues(typeof(AuthorizationRoles));
|
||||
Array values = Enum.GetValues(typeof(UserType));
|
||||
Random random = new Random();
|
||||
|
||||
|
||||
@@ -600,8 +600,8 @@ namespace AyaNova.Util
|
||||
o.EndDate = DateTime.Now.AddMinutes(60).ToUniversalTime();
|
||||
o.DollarAmount = Convert.ToDecimal(f.Commerce.Price());
|
||||
//Random but valid enum
|
||||
AuthorizationRoles randomRole = (AuthorizationRoles)values.GetValue(random.Next(values.Length));
|
||||
o.Roles = randomRole;
|
||||
UserType randomUserType = (UserType)values.GetValue(random.Next(values.Length));
|
||||
o.UserType = randomUserType;
|
||||
|
||||
o.Notes = f.Lorem.Sentence();
|
||||
o.Tags = RandomTags(f);
|
||||
|
||||
Reference in New Issue
Block a user