608 lines
35 KiB
C#
608 lines
35 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Routing;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Sockeye.Models;
|
|
using Sockeye.Api.ControllerHelpers;
|
|
using Sockeye.Biz;
|
|
using Sockeye.Util;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace Sockeye.Api.Controllers
|
|
{
|
|
|
|
/// <summary>
|
|
/// Enum list controller
|
|
/// </summary>
|
|
[ApiController]
|
|
[ApiVersion("8.0")]
|
|
[Route("api/v{version:apiVersion}/enum-list")]
|
|
[Produces("application/json")]
|
|
[Authorize]
|
|
public class EnumListController : ControllerBase
|
|
{
|
|
private readonly AyContext ct;
|
|
private readonly ILogger<EnumListController> log;
|
|
private readonly ApiServerState serverState;
|
|
|
|
|
|
/// <summary>
|
|
/// ctor
|
|
/// </summary>
|
|
/// <param name="dbcontext"></param>
|
|
/// <param name="logger"></param>
|
|
/// <param name="apiServerState"></param>
|
|
public EnumListController(AyContext dbcontext, ILogger<EnumListController> logger, ApiServerState apiServerState)
|
|
{
|
|
ct = dbcontext;
|
|
log = logger;
|
|
serverState = apiServerState;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Get name value Translated display value list of Sockeye enumerated types for list specified
|
|
/// </summary>
|
|
/// <param name="enumkey">The key name of the enumerated type</param>
|
|
/// <returns>List</returns>
|
|
[HttpGet("list/{enumkey}")]
|
|
public async Task<IActionResult> GetList([FromRoute] string enumkey)
|
|
{
|
|
if (serverState.IsClosed && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
|
var ret = await GetEnumList(enumkey, UserTranslationIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
|
|
return Ok(ApiOkResponse.Response(ret));
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Get all possible enumerated values list key names
|
|
/// </summary>
|
|
/// <returns>List of Sockeye enumerated type list key names that can be fetched from the GetList Route</returns>
|
|
[HttpGet("listkeys")]
|
|
public ActionResult GetTypesList()
|
|
{
|
|
if (!serverState.IsOpen)
|
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
|
List<KeyValuePair<string, string>> ret = new List<KeyValuePair<string, string>>();
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(UserType).ToString()), "Sockeye user account types"));
|
|
ret.Add(new KeyValuePair<string, string>("insideusertype", "Sockeye user account types for staff / contractors"));
|
|
ret.Add(new KeyValuePair<string, string>("outsideusertype", "Sockeye user account types for customer / headoffice users"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(AuthorizationRoles).ToString()), "Sockeye user account role types"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(SockType).ToString()), "All Sockeye object types untranslated"));
|
|
ret.Add(new KeyValuePair<string, string>("alltranslated", "All Sockeye object types translated"));
|
|
ret.Add(new KeyValuePair<string, string>("coreall", "All Core Sockeye business object types"));
|
|
ret.Add(new KeyValuePair<string, string>("coreview", "All Core Sockeye business object types current user is allowed to view"));
|
|
ret.Add(new KeyValuePair<string, string>("coreedit", "All Core Sockeye business object types current user is allowed to edit"));
|
|
ret.Add(new KeyValuePair<string, string>("reportable", "All Sockeye business object types that are reportable"));
|
|
ret.Add(new KeyValuePair<string, string>("importable", "All Sockeye business object types that are importable"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(UiFieldDataType).ToString()), "Types of data used in Sockeye for display and formatting UI purposes"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(NotifyEventType).ToString()), "Notification event types"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString()), "Notification delivery methods"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(NotifyMailSecurity).ToString()), "Notification SMTP mail server security method"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(SockEvent).ToString()), "Event log object change types"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(SockDaysOfWeek).ToString()), "Days of the week"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(TrialRequestStatus).ToString()), "Trial license request status"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(ProductGroup).ToString()), "Product group"));
|
|
|
|
return Ok(ApiOkResponse.Response(ret));
|
|
}
|
|
|
|
|
|
|
|
public static async Task<List<NameIdItem>> GetEnumList(string enumKey, long translationId, AuthorizationRoles userRoles)
|
|
{
|
|
|
|
List<string> TranslationKeysToFetch = new List<string>();
|
|
|
|
List<NameIdItem> ReturnList = new List<NameIdItem>();
|
|
|
|
var keyNameInLowerCase = enumKey.ToLowerInvariant();
|
|
|
|
|
|
if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(UiFieldDataType).ToString()).ToLowerInvariant())
|
|
{
|
|
//Iterate the enum and get the values
|
|
Type t = typeof(UiFieldDataType);
|
|
Enum.GetName(t, UiFieldDataType.NoType);
|
|
foreach (var dt in Enum.GetValues(t))
|
|
{
|
|
ReturnList.Add(new NameIdItem() { Name = Enum.GetName(t, dt), Id = (int)dt });
|
|
}
|
|
|
|
}
|
|
else if (keyNameInLowerCase == "coreall")
|
|
{
|
|
//core biz objects for UI facing purposes such as search form limit to object type etc
|
|
var values = Enum.GetValues(typeof(SockType));
|
|
foreach (SockType t in values)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (SockType t in values)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
var tName = t.ToString();
|
|
string name = string.Empty;
|
|
if (LT.ContainsKey(tName))
|
|
{
|
|
name = LT[tName];
|
|
}
|
|
else
|
|
{
|
|
name = tName;
|
|
}
|
|
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
|
}
|
|
}
|
|
}
|
|
else if (keyNameInLowerCase == "reportable")
|
|
{
|
|
//reportable biz objects for report designer selection
|
|
var values = Enum.GetValues(typeof(SockType));
|
|
foreach (SockType t in values)
|
|
{
|
|
if (t.HasAttribute(typeof(ReportableBizObjectAttribute)))
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (SockType t in values)
|
|
{
|
|
if (t.HasAttribute(typeof(ReportableBizObjectAttribute)))
|
|
{
|
|
var tName = t.ToString();
|
|
string name = string.Empty;
|
|
if (LT.ContainsKey(tName))
|
|
{
|
|
name = LT[tName];
|
|
}
|
|
else
|
|
{
|
|
name = tName;
|
|
}
|
|
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
|
}
|
|
}
|
|
}
|
|
else if (keyNameInLowerCase == "importable")
|
|
{
|
|
//importable biz objects for administration -> import selection
|
|
var values = Enum.GetValues(typeof(SockType));
|
|
foreach (SockType t in values)
|
|
{
|
|
if (t.HasAttribute(typeof(ImportableBizObjectAttribute)))
|
|
{
|
|
|
|
var nameToFetch = t.ToString();
|
|
|
|
TranslationKeysToFetch.Add(nameToFetch);
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (SockType t in values)
|
|
{
|
|
if (t.HasAttribute(typeof(ImportableBizObjectAttribute)))
|
|
{
|
|
var tName = t.ToString();
|
|
|
|
string name = string.Empty;
|
|
if (LT.ContainsKey(tName))
|
|
{
|
|
name = LT[tName];
|
|
}
|
|
else
|
|
{
|
|
name = tName;
|
|
}
|
|
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
|
}
|
|
}
|
|
}
|
|
else if (keyNameInLowerCase == "coreview")//all core objects user can read
|
|
{
|
|
|
|
//core biz objects for UI facing purposes
|
|
var rawvalues = Enum.GetValues(typeof(SockType));
|
|
|
|
List<SockType> allowedValues = new List<SockType>();
|
|
foreach (SockType t in rawvalues)
|
|
{
|
|
if (Authorized.HasReadFullRole(userRoles, t))
|
|
allowedValues.Add(t);
|
|
}
|
|
|
|
foreach (SockType t in allowedValues)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (SockType t in allowedValues)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
var tName = t.ToString();
|
|
string name = string.Empty;
|
|
if (LT.ContainsKey(tName))
|
|
{
|
|
name = LT[tName];
|
|
}
|
|
else
|
|
{
|
|
name = tName;
|
|
}
|
|
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
|
}
|
|
}
|
|
}
|
|
else if (keyNameInLowerCase == "coreedit")//all core objects current user can edit
|
|
{
|
|
//core biz objects for UI facing purposes
|
|
var rawvalues = Enum.GetValues(typeof(SockType));
|
|
|
|
List<SockType> allowedValues = new List<SockType>();
|
|
foreach (SockType t in rawvalues)
|
|
{
|
|
if (Authorized.HasModifyRole(userRoles, t))
|
|
allowedValues.Add(t);
|
|
}
|
|
|
|
foreach (SockType t in allowedValues)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (SockType t in allowedValues)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
var tName = t.ToString();
|
|
string name = string.Empty;
|
|
if (LT.ContainsKey(tName))
|
|
{
|
|
name = LT[tName];
|
|
}
|
|
else
|
|
{
|
|
name = tName;
|
|
}
|
|
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
|
}
|
|
}
|
|
}
|
|
else if (keyNameInLowerCase == "alltranslated")//all socktype objects with translations
|
|
{
|
|
//all types for search results and history UI
|
|
var rawvalues = Enum.GetValues(typeof(SockType));
|
|
foreach (SockType t in rawvalues)
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (SockType t in rawvalues)
|
|
{
|
|
var tName = t.ToString();
|
|
string name = string.Empty;
|
|
if (LT.ContainsKey(tName))
|
|
{
|
|
name = LT[tName];
|
|
}
|
|
else
|
|
{
|
|
name = tName;
|
|
}
|
|
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
|
|
|
}
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(SockType).ToString()).ToLowerInvariant())
|
|
{
|
|
//All types, used by search form and possibly others
|
|
|
|
var values = Enum.GetValues(typeof(SockType));
|
|
|
|
foreach (SockType t in values)
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (SockType t in values)
|
|
{
|
|
string tName = t.ToString();
|
|
string name = string.Empty;
|
|
if (LT.ContainsKey(tName))
|
|
{
|
|
name = LT[tName];
|
|
}
|
|
else
|
|
{
|
|
name = tName;
|
|
}
|
|
ReturnList.Add(new NameIdItem() { Name = name, Id = (long)t });
|
|
}
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(UserType).ToString()).ToLowerInvariant())
|
|
{
|
|
|
|
TranslationKeysToFetch.Add("UserTypeService");
|
|
TranslationKeysToFetch.Add("UserTypeNotService");
|
|
TranslationKeysToFetch.Add("UserTypeCustomer");
|
|
TranslationKeysToFetch.Add("UserTypeHeadOffice");
|
|
TranslationKeysToFetch.Add("UserTypeServiceContractor");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeService"], Id = (long)UserType.Service });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeNotService"], Id = (long)UserType.NotService });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeCustomer"], Id = (long)UserType.Customer });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeHeadOffice"], Id = (long)UserType.HeadOffice });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeServiceContractor"], Id = (long)UserType.ServiceContractor });
|
|
}
|
|
else if (keyNameInLowerCase == "insideusertype")
|
|
{
|
|
|
|
TranslationKeysToFetch.Add("UserTypeService");
|
|
TranslationKeysToFetch.Add("UserTypeNotService");
|
|
TranslationKeysToFetch.Add("UserTypeServiceContractor");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeService"], Id = (long)UserType.Service });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeNotService"], Id = (long)UserType.NotService });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeServiceContractor"], Id = (long)UserType.ServiceContractor });
|
|
}
|
|
else if (keyNameInLowerCase == "outsideusertype")
|
|
{
|
|
|
|
|
|
TranslationKeysToFetch.Add("UserTypeCustomer");
|
|
TranslationKeysToFetch.Add("UserTypeHeadOffice");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeCustomer"], Id = (long)UserType.Customer });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["UserTypeHeadOffice"], Id = (long)UserType.HeadOffice });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(SockEvent).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("EventDeleted");
|
|
TranslationKeysToFetch.Add("EventCreated");
|
|
TranslationKeysToFetch.Add("EventRetrieved");
|
|
TranslationKeysToFetch.Add("EventModified");
|
|
TranslationKeysToFetch.Add("EventAttachmentCreate");
|
|
TranslationKeysToFetch.Add("EventAttachmentDelete");
|
|
TranslationKeysToFetch.Add("EventAttachmentDownload");
|
|
TranslationKeysToFetch.Add("EventLicenseFetch");
|
|
TranslationKeysToFetch.Add("EventLicenseTrialRequest");
|
|
TranslationKeysToFetch.Add("EventServerStateChange");
|
|
TranslationKeysToFetch.Add("EventSeedDatabase");
|
|
TranslationKeysToFetch.Add("EventAttachmentModified");
|
|
TranslationKeysToFetch.Add("AdminEraseDatabase");
|
|
TranslationKeysToFetch.Add("EventResetSerial");
|
|
TranslationKeysToFetch.Add("EventUtilityFileDownload");
|
|
TranslationKeysToFetch.Add("NotifyEventDirectSMTPMessage");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventDeleted"], Id = (long)SockEvent.Deleted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventCreated"], Id = (long)SockEvent.Created });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventRetrieved"], Id = (long)SockEvent.Retrieved });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventModified"], Id = (long)SockEvent.Modified });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentCreate"], Id = (long)SockEvent.AttachmentCreate });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentDelete"], Id = (long)SockEvent.AttachmentDelete });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentDownload"], Id = (long)SockEvent.AttachmentDownload });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventLicenseFetch"], Id = (long)SockEvent.LicenseFetch });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventLicenseTrialRequest"], Id = (long)SockEvent.LicenseTrialRequest });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventServerStateChange"], Id = (long)SockEvent.ServerStateChange });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventSeedDatabase"], Id = (long)SockEvent.SeedDatabase });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentModified"], Id = (long)SockEvent.AttachmentModified });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AdminEraseDatabase"], Id = (long)SockEvent.EraseAllData });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventResetSerial"], Id = (long)SockEvent.ResetSerial });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventUtilityFileDownload"], Id = (long)SockEvent.UtilityFileDownload });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventDirectSMTPMessage"], Id = (long)SockEvent.DirectSMTP });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(AuthorizationRoles).ToString()).ToLowerInvariant())
|
|
{
|
|
|
|
// TranslationKeysToFetch.Add("AuthorizationRoleNoRole");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleBizAdminRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleBizAdmin");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleServiceRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleService");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleInventoryRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleInventory");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleAccounting");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleTechRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleTech");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSubContractorRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSubContractor");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleCustomerRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleCustomer");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleOpsAdminRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleOpsAdmin");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSalesRestricted");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSales");
|
|
// TranslationKeysToFetch.Add("AuthorizationRoleAll");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
// ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleNoRole"], Id = (long)AuthorizationRoles.NoRole });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleBizAdminRestricted"], Id = (long)AuthorizationRoles.BizAdminRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleBizAdmin"], Id = (long)AuthorizationRoles.BizAdmin });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleServiceRestricted"], Id = (long)AuthorizationRoles.ServiceRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleService"], Id = (long)AuthorizationRoles.Service });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleInventoryRestricted"], Id = (long)AuthorizationRoles.InventoryRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleInventory"], Id = (long)AuthorizationRoles.Inventory });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleAccounting"], Id = (long)AuthorizationRoles.Accounting });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleTechRestricted"], Id = (long)AuthorizationRoles.TechRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleTech"], Id = (long)AuthorizationRoles.Tech });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSubContractorRestricted"], Id = (long)AuthorizationRoles.SubContractorRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSubContractor"], Id = (long)AuthorizationRoles.SubContractor });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleCustomerRestricted"], Id = (long)AuthorizationRoles.CustomerRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleCustomer"], Id = (long)AuthorizationRoles.Customer });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleOpsAdminRestricted"], Id = (long)AuthorizationRoles.OpsAdminRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleOpsAdmin"], Id = (long)AuthorizationRoles.OpsAdmin });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSalesRestricted"], Id = (long)AuthorizationRoles.SalesRestricted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSales"], Id = (long)AuthorizationRoles.Sales });
|
|
// ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleAll"], Id = (long)AuthorizationRoles.All });
|
|
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(NotifyEventType).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("NotifyEventObjectDeleted");
|
|
TranslationKeysToFetch.Add("NotifyEventObjectCreated");
|
|
TranslationKeysToFetch.Add("NotifyEventObjectModified");
|
|
TranslationKeysToFetch.Add("NotifyEventWorkorderStatusChange");
|
|
TranslationKeysToFetch.Add("NotifyEventContractExpiring");
|
|
TranslationKeysToFetch.Add("NotifyEventCSRAccepted");
|
|
TranslationKeysToFetch.Add("NotifyEventCSRRejected");
|
|
TranslationKeysToFetch.Add("NotifyEventWorkorderCompleted");
|
|
TranslationKeysToFetch.Add("NotifyEventQuoteStatusChange");
|
|
TranslationKeysToFetch.Add("NotifyEventQuoteStatusAge");
|
|
TranslationKeysToFetch.Add("NotifyEventObjectAge");
|
|
TranslationKeysToFetch.Add("NotifyEventServiceBankDepleted");
|
|
TranslationKeysToFetch.Add("NotifyEventReminderImminent");
|
|
TranslationKeysToFetch.Add("NotifyEventScheduledOnWorkorder");
|
|
TranslationKeysToFetch.Add("NotifyEventScheduledOnWorkorderImminent");
|
|
TranslationKeysToFetch.Add("NotifyEventWorkorderCompletedStatusOverdue");
|
|
TranslationKeysToFetch.Add("NotifyEventOutsideServiceOverdue");
|
|
TranslationKeysToFetch.Add("NotifyEventOutsideServiceReceived");
|
|
TranslationKeysToFetch.Add("NotifyEventPartRequestReceived");
|
|
TranslationKeysToFetch.Add("NotifyEventNotifyHealthCheck");
|
|
TranslationKeysToFetch.Add("NotifyEventBackupStatus");
|
|
TranslationKeysToFetch.Add("NotifyEventCustomerServiceImminent");
|
|
TranslationKeysToFetch.Add("NotifyEventPMStopGeneratingDateReached");
|
|
TranslationKeysToFetch.Add("NotifyEventWorkorderTotalExceedsThreshold");
|
|
TranslationKeysToFetch.Add("NotifyEventWorkorderStatusAge");
|
|
TranslationKeysToFetch.Add("NotifyEventUnitWarrantyExpiry");
|
|
TranslationKeysToFetch.Add("NotifyEventUnitMeterReadingMultipleExceeded");
|
|
TranslationKeysToFetch.Add("NotifyEventServerOperationsProblem");
|
|
TranslationKeysToFetch.Add("NotifyEventGeneralNotification");
|
|
//TranslationKeysToFetch.Add("NotifyEventCopyOfCustomerNotification");
|
|
TranslationKeysToFetch.Add("NotifyEventWorkorderCreatedForCustomer");
|
|
TranslationKeysToFetch.Add("NotifyEventPMGenerationFailed");
|
|
TranslationKeysToFetch.Add("NotifyEventPMInsufficientInventory");
|
|
TranslationKeysToFetch.Add("NotifyEventReviewImminent");
|
|
TranslationKeysToFetch.Add("NotifyEventDirectSMTPMessage");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventObjectDeleted"], Id = (long)NotifyEventType.ObjectDeleted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventObjectCreated"], Id = (long)NotifyEventType.ObjectCreated });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventObjectModified"], Id = (long)NotifyEventType.ObjectModified });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventObjectAge"], Id = (long)NotifyEventType.ObjectAge });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventReminderImminent"], Id = (long)NotifyEventType.ReminderImminent });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventReviewImminent"], Id = (long)NotifyEventType.ReviewImminent });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventNotifyHealthCheck"], Id = (long)NotifyEventType.NotifyHealthCheck });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventBackupStatus"], Id = (long)NotifyEventType.BackupStatus });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventServerOperationsProblem"], Id = (long)NotifyEventType.ServerOperationsProblem });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventGeneralNotification"], Id = (long)NotifyEventType.GeneralNotification });
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventDirectSMTPMessage"], Id = (long)NotifyEventType.DirectSMTPMessage });
|
|
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("NotifyDeliveryMethodApp");
|
|
TranslationKeysToFetch.Add("NotifyDeliveryMethodSMTP");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyDeliveryMethodApp"], Id = (long)NotifyDeliveryMethod.App });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyDeliveryMethodSMTP"], Id = (long)NotifyDeliveryMethod.SMTP });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(NotifyMailSecurity).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("NotifyMailSecurityNone");
|
|
TranslationKeysToFetch.Add("NotifyMailSecuritySSLTLS");
|
|
TranslationKeysToFetch.Add("NotifyMailSecurityStartTls");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyMailSecurityNone"], Id = (long)NotifyMailSecurity.None });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyMailSecuritySSLTLS"], Id = (long)NotifyMailSecurity.SSLTLS });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyMailSecurityStartTls"], Id = (long)NotifyMailSecurity.StartTls });
|
|
}
|
|
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(SockDaysOfWeek).ToString()).ToLowerInvariant())
|
|
{
|
|
|
|
TranslationKeysToFetch.Add("DayMonday");
|
|
TranslationKeysToFetch.Add("DayTuesday");
|
|
TranslationKeysToFetch.Add("DayWednesday");
|
|
TranslationKeysToFetch.Add("DayThursday");
|
|
TranslationKeysToFetch.Add("DayFriday");
|
|
TranslationKeysToFetch.Add("DaySaturday");
|
|
TranslationKeysToFetch.Add("DaySunday");
|
|
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["DayMonday"], Id = (long)SockDaysOfWeek.Monday });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["DayTuesday"], Id = (long)SockDaysOfWeek.Tuesday });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["DayWednesday"], Id = (long)SockDaysOfWeek.Wednesday });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["DayThursday"], Id = (long)SockDaysOfWeek.Thursday });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["DayFriday"], Id = (long)SockDaysOfWeek.Friday });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["DaySaturday"], Id = (long)SockDaysOfWeek.Saturday });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["DaySunday"], Id = (long)SockDaysOfWeek.Sunday });
|
|
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(TrialRequestStatus).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("TrialRequestStatusNew");
|
|
TranslationKeysToFetch.Add("TrialRequestStatusApproved");
|
|
TranslationKeysToFetch.Add("TrialRequestStatusRejected");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
ReturnList.Add(new NameIdItem() { Name = LT["TrialRequestStatusNew"], Id = (long)TrialRequestStatus.New });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["TrialRequestStatusApproved"], Id = (long)TrialRequestStatus.Approved });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["TrialRequestStatusRejected"], Id = (long)TrialRequestStatus.Rejected });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(ProductGroup).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("ProductGroupMisc");
|
|
TranslationKeysToFetch.Add("ProductGroupAyaNova7");
|
|
TranslationKeysToFetch.Add("ProductGroupRavenPerpetual");
|
|
TranslationKeysToFetch.Add("ProductGroupRavenSubscription");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
ReturnList.Add(new NameIdItem() { Name = LT["ProductGroupMisc"], Id = (long)ProductGroup.Misc });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["ProductGroupAyaNova7"], Id = (long)ProductGroup.AyaNova7 });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["ProductGroupRavenPerpetual"], Id = (long)ProductGroup.RavenPerpetual });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["ProductGroupRavenSubscription"], Id = (long)ProductGroup.RavenSubscription });
|
|
}
|
|
|
|
|
|
|
|
|
|
//#################################################################################################################
|
|
//################### NEW HERE DO NOT FORGET TO ADD TO LISTS AVAILABLE ABOVE AS WELL ##############################
|
|
//#################################################################################################################
|
|
else
|
|
{
|
|
ReturnList.Add(new NameIdItem() { Name = $"Unknown enum type list key value {enumKey}", Id = 0 });
|
|
}
|
|
|
|
return ReturnList;
|
|
|
|
}
|
|
|
|
|
|
}//eoc
|
|
}//ens |