This commit is contained in:
2020-03-04 22:37:25 +00:00
parent bd9b8d63a2
commit 62c845a43d
5 changed files with 23 additions and 11 deletions

View File

@@ -640,7 +640,13 @@ namespace AyaNova.Biz
i.UserOptions.EmailAddress = j["EmailAddress"].Value<string>();
//UI colour
i.UserOptions.UiColor = j["ScheduleBackColor"].Value<int>();
//TODO: this needs to be switched to a web friendly value
/*
Hexadecimal notation: #RGB[A]
R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (09, AF). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
*/
throw new ArgumentOutOfRangeException("UserBiz::ImportV7Async - UI color needs to be pre-converted in DataDump to RGB values");
//i.UserOptions.UiColor = j["ScheduleBackColor"].Value<int>();
//Set unusable random login credentials

View File

@@ -101,6 +101,11 @@ namespace AyaNova.Biz
if (inObj.UserId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "UserId");
if (inObj.UiColor.Length > 12)
{
AddError(ApiErrorCode.VALIDATION_LENGTH_EXCEEDED, "UiColor", "UiColor must be HEX color value");
}
//LOOKAT:Validate email address is legitimate (I put the EMailAddress attribute on the field in the model so I think it might validate)
return;

View File

@@ -12,14 +12,13 @@ namespace AyaNova.Models
//-------------
[EmailAddress]
public string EmailAddress { get; set; }
/// <summary>
/// As of today Dec 10 2018 all time zones in the world are either on the hour, half hour or 45 minute mark from utc so
/// keeping this value as decimal hours for back compatibility with v7 and easier for user to enter
/// 8.5 for 8:30 time difference or 12.75 for 12:45 time differnce for example
/// </summary>
/// <value></value>
public int UiColor { get; set; }
/*
Hexadecimal notation: #RGB[A]
R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (09, AF). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
*/
[MaxLength(12)]
public string UiColor { get; set; }
//browser forced overrides
public string LanguageOverride { get; set; }
@@ -40,7 +39,7 @@ namespace AyaNova.Models
{
CurrencyName = "USD";
Hour12 = true;
UiColor = 0;
UiColor = "#000000";//black is the default
}
}

View File

@@ -177,7 +177,7 @@ namespace AyaNova.Util
//Add user options table
await ExecQueryAsync("CREATE TABLE auseroptions (id BIGSERIAL PRIMARY KEY, " +
"userid bigint not null, languageoverride text, timezoneoverride text, currencyname text, hour12 bool not null, emailaddress text, uicolor int not null default 0)");
"userid bigint not null, languageoverride text, timezoneoverride text, currencyname text, hour12 bool not null, emailaddress text, uicolor varchar(12) not null default '#000000')");
//Prime the db with the default MANAGER account

View File

@@ -593,6 +593,7 @@ namespace AyaNova.Util
u.UserOptions.EmailAddress = p.Email.Replace("gmail.com", "helloayanova.com").Replace("hotmail.com", "helloayanova.com").Replace("yahoo.com", "helloayanova.com");
u.UserOptions.Hour12 = true;
u.UserOptions.CurrencyName = "USD";
u.UserOptions.UiColor= Fake.Internet.Color();
@@ -624,6 +625,7 @@ namespace AyaNova.Util
// WidgetBiz biz = WidgetBiz.GetBiz(ServiceProviderProvider.DBContext);
var f = new Bogus.Faker();
//RANDOM ROLES
Array values = Enum.GetValues(typeof(UserType));