This commit is contained in:
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
using AyaNova.Util;
|
||||
|
||||
|
||||
namespace AyaNova.Api.Controllers
|
||||
@@ -59,9 +60,10 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
List<NameIdItem> ReturnList = new List<NameIdItem>();
|
||||
|
||||
switch (enumkey.ToLowerInvariant())
|
||||
{
|
||||
case "datatypes":
|
||||
var keyNameInLowerCase = enumkey.ToLowerInvariant();
|
||||
|
||||
|
||||
if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(UiFieldDataType).ToString()).ToLowerInvariant())
|
||||
{
|
||||
//Iterate the enum and get the values
|
||||
Type t = typeof(UiFieldDataType);
|
||||
@@ -72,9 +74,7 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "ayatype":
|
||||
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(AyaType).ToString()).ToLowerInvariant())
|
||||
{
|
||||
|
||||
var values = Enum.GetValues(typeof(AyaType));
|
||||
@@ -88,9 +88,7 @@ namespace AyaNova.Api.Controllers
|
||||
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "usertypes":
|
||||
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(UserType).ToString()).ToLowerInvariant())
|
||||
{
|
||||
LocaleKeysToFetch.Add("UserTypesAdministrator");
|
||||
LocaleKeysToFetch.Add("UserTypesSchedulable");
|
||||
@@ -98,6 +96,7 @@ namespace AyaNova.Api.Controllers
|
||||
LocaleKeysToFetch.Add("UserTypesClient");
|
||||
LocaleKeysToFetch.Add("UserTypesHeadOffice");
|
||||
LocaleKeysToFetch.Add("UserTypesSubContractor");
|
||||
LocaleKeysToFetch.Add("UserTypesUtility");
|
||||
var LT = LocaleBiz.GetSubsetStaticAsync(LocaleKeysToFetch, LocaleId).Result;
|
||||
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesAdministrator"], Id = (long)UserType.Administrator });
|
||||
@@ -105,11 +104,10 @@ namespace AyaNova.Api.Controllers
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesNonSchedulable"], Id = (long)UserType.NonSchedulable });
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesClient"], Id = (long)UserType.Customer });
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesHeadOffice"], Id = (long)UserType.HeadOffice });
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesUtility"], Id = (long)UserType.Utility });
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["UserTypesSubContractor"], Id = (long)UserType.Subcontractor });
|
||||
}
|
||||
break;
|
||||
|
||||
case "authorizationroles":
|
||||
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(AuthorizationRoles).ToString()).ToLowerInvariant())
|
||||
{
|
||||
|
||||
LocaleKeysToFetch.Add("AuthorizationRoleNoRole");
|
||||
@@ -154,15 +152,13 @@ namespace AyaNova.Api.Controllers
|
||||
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleAll"], Id = (long)AuthorizationRoles.All });
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
else
|
||||
{
|
||||
ReturnList.Add(new NameIdItem() { Name = $"Unknown enum type list key value {enumkey}", Id = (long)UserType.Administrator });
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Ok(ApiOkResponse.Response(ReturnList, true));
|
||||
}
|
||||
|
||||
@@ -182,10 +178,10 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
List<KeyValuePair<string, string>> ret = new List<KeyValuePair<string, string>>();
|
||||
ret.Add(new KeyValuePair<string, string>("UserTypes", "AyaNova user account types"));
|
||||
ret.Add(new KeyValuePair<string, string>("AuthorizationRoles", "AyaNova user account role types"));
|
||||
ret.Add(new KeyValuePair<string, string>("AyaType", "All AyaNova object types"));
|
||||
ret.Add(new KeyValuePair<string, string>("DataTypes", "Types of data used in AyaNova for display and formatting UI purposes"));
|
||||
ret.Add(new KeyValuePair<string, string>(typeof(UserType).ToString(), "AyaNova user account types"));
|
||||
ret.Add(new KeyValuePair<string, string>(typeof(AuthorizationRoles).ToString(), "AyaNova user account role types"));
|
||||
ret.Add(new KeyValuePair<string, string>(typeof(AyaType).ToString(), "All AyaNova object types"));
|
||||
ret.Add(new KeyValuePair<string, string>(typeof(UiFieldDataType).ToString(), "Types of data used in AyaNova for display and formatting UI purposes"));
|
||||
|
||||
return Ok(ApiOkResponse.Response(ret, true));
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace AyaNova.DataList
|
||||
|
||||
//Has a Enumtype?
|
||||
if (!string.IsNullOrEmpty(o.EnumType))
|
||||
sb.Append($",\"et\":\"{TrimTypeName(o.EnumType)}\"");
|
||||
sb.Append($",\"et\":\"{AyaNova.Util.StringUtil.TrimTypeName(o.EnumType)}\"");
|
||||
|
||||
sb.Append("}");
|
||||
|
||||
@@ -85,16 +85,6 @@ namespace AyaNova.DataList
|
||||
}
|
||||
|
||||
|
||||
//used to trim an enum type down to only it's most relevant (rightmost) portion
|
||||
private string TrimTypeName(string str)
|
||||
{
|
||||
if (str.Contains('.'))
|
||||
{
|
||||
return str.Substring(str.LastIndexOf('.') + 1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
//make sure the template parses and all the fields specified are really existant
|
||||
//this is more for dev errors or api users becuase the client shouldn't generate bad templates
|
||||
public bool ValidateTemplate(string template)
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace AyaNova.DataList
|
||||
LtKey = "WidgetUserType",
|
||||
FieldKey = "widgetusertype",
|
||||
UiFieldDataType = (int)UiFieldDataType.Enum,
|
||||
EnumType = typeof(AuthorizationRoles).ToString(),
|
||||
EnumType = typeof(UserType).ToString(),
|
||||
SqlValueColumnName = "awidget.usertype"
|
||||
});
|
||||
FieldDefinitions.Add(new AyaDataListFieldDefinition
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace AyaNova.Biz
|
||||
//Misc
|
||||
s = s.Replace("FormFieldDataType", "UiFieldDataType", StringComparison.InvariantCultureIgnoreCase);
|
||||
s = s.Replace("UserUserType", "UserType", StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
s = s.Replace("UserTypesUtilityNotification", "UserTypesUtility", StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
// s = s.Replace("WASXXX", "NOWXXXX", StringComparison.InvariantCultureIgnoreCase);
|
||||
// s = s.Replace("WASXXX", "NOWXXXX", StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
@@ -1213,7 +1213,7 @@
|
||||
"UserTypesHeadOffice": "Benutzer am Hauptsitz des Kunden",
|
||||
"UserTypesNonSchedulable": "Nicht planbarer Benutzer",
|
||||
"UserTypesSchedulable": "Planbarer Benutzer",
|
||||
"UserTypesUtilityNotification": "Benachrichtigungsserverkonto",
|
||||
"UserTypesUtility": "Dienstprogrammkonto",
|
||||
"VendorAccountNumber": "Kontonummer",
|
||||
"VendorContact": "Contact",
|
||||
"VendorContactNotes": "Other contacts",
|
||||
|
||||
@@ -1213,7 +1213,7 @@
|
||||
"UserTypesHeadOffice": "Head office user",
|
||||
"UserTypesNonSchedulable": "Non-schedulable user",
|
||||
"UserTypesSchedulable": "Schedulable user",
|
||||
"UserTypesUtilityNotification": "Notification server account",
|
||||
"UserTypesUtility": "Utility account",
|
||||
"VendorAccountNumber": "Account Number",
|
||||
"VendorContact": "Contact",
|
||||
"VendorContactNotes": "Other contacts",
|
||||
|
||||
@@ -1213,7 +1213,7 @@
|
||||
"UserTypesHeadOffice": "Usuario cliente de sede",
|
||||
"UserTypesNonSchedulable": "Usuario no programable",
|
||||
"UserTypesSchedulable": "Usuario programable",
|
||||
"UserTypesUtilityNotification": "Cuenta servidor de notificación",
|
||||
"UserTypesUtility": "Cuenta de utilidad",
|
||||
"VendorAccountNumber": "Número de cuenta",
|
||||
"VendorContact": "Contact",
|
||||
"VendorContactNotes": "Other contacts",
|
||||
|
||||
@@ -1213,7 +1213,7 @@
|
||||
"UserTypesHeadOffice": "Utilisateur client de siège social",
|
||||
"UserTypesNonSchedulable": "Utilisateur non programmable",
|
||||
"UserTypesSchedulable": "Utilisateur programmable",
|
||||
"UserTypesUtilityNotification": "Compte de serveur de notifications",
|
||||
"UserTypesUtility": "Compte utilitaire",
|
||||
"VendorAccountNumber": "Numéro de compte",
|
||||
"VendorContact": "Contact",
|
||||
"VendorContactNotes": "Other contacts",
|
||||
|
||||
@@ -115,6 +115,16 @@ namespace AyaNova.Util
|
||||
return ret;
|
||||
}
|
||||
|
||||
//used to trim an enum type down to only it's most relevant (rightmost) portion
|
||||
public static string TrimTypeName(string str)
|
||||
{
|
||||
if (str.Contains('.'))
|
||||
{
|
||||
return str.Substring(str.LastIndexOf('.') + 1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user