558 lines
37 KiB
C#
558 lines
37 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 AyaNova.Models;
|
|
using AyaNova.Api.ControllerHelpers;
|
|
using AyaNova.Biz;
|
|
using AyaNova.Util;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace AyaNova.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 AyaNova 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)
|
|
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 AyaNova 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()), "AyaNova user account types"));
|
|
ret.Add(new KeyValuePair<string, string>("insideusertype", "AyaNova user account types for staff / contractors"));
|
|
ret.Add(new KeyValuePair<string, string>("outsideusertype", "AyaNova user account types for customer / headoffice users"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(AuthorizationRoles).ToString()), "AyaNova user account role types"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(AyaType).ToString()), "All AyaNova object types"));
|
|
ret.Add(new KeyValuePair<string, string>("coreall", "All Core AyaNova business object types"));
|
|
ret.Add(new KeyValuePair<string, string>("coreview", "All Core AyaNova business object types current user is allowed to view"));
|
|
ret.Add(new KeyValuePair<string, string>("coreedit", "All Core AyaNova business object types current user is allowed to edit"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(UiFieldDataType).ToString()), "Types of data used in AyaNova 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(AyaEvent).ToString()), "Event log object change types"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(LoanUnitRateUnit).ToString()), "Loan unit rate unit types"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(CustomerServiceRequestPriority).ToString()), "csr priorities"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(CustomerServiceRequestStatus).ToString()), "csr status"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(PurchaseOrderStatus).ToString()), "PO Status"));
|
|
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(ContractOverrideType).ToString()), "Contract price adjustment type"));
|
|
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(AyaType));
|
|
foreach (AyaType t in values)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (AyaType 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 == "coreview")//all core objects user can read
|
|
{
|
|
|
|
//core biz objects for UI facing purposes such as search form limit to object type etc
|
|
var rawvalues = Enum.GetValues(typeof(AyaType));
|
|
|
|
List<AyaType> allowedValues = new List<AyaType>();
|
|
foreach (AyaType t in rawvalues)
|
|
{
|
|
if (Authorized.HasReadFullRole(userRoles, t))
|
|
allowedValues.Add(t);
|
|
}
|
|
|
|
foreach (AyaType t in allowedValues)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (AyaType 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 such as search form limit to object type etc
|
|
var rawvalues = Enum.GetValues(typeof(AyaType));
|
|
|
|
List<AyaType> allowedValues = new List<AyaType>();
|
|
foreach (AyaType t in rawvalues)
|
|
{
|
|
if (Authorized.HasModifyRole(userRoles, t))
|
|
allowedValues.Add(t);
|
|
}
|
|
|
|
foreach (AyaType t in allowedValues)
|
|
{
|
|
if (t.HasAttribute(typeof(CoreBizObjectAttribute)))
|
|
{
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
}
|
|
}
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (AyaType 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 == StringUtil.TrimTypeName(typeof(AyaType).ToString()).ToLowerInvariant())
|
|
{
|
|
//this is intended primarily for developers, not for UI facing so no need to localize or pretty it up
|
|
//bullshit, it's just extra work not translated and developers only need the number, not the enumeration name which is for here only
|
|
|
|
var values = Enum.GetValues(typeof(AyaType));
|
|
|
|
foreach (AyaType t in values)
|
|
TranslationKeysToFetch.Add(t.ToString());
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
foreach (AyaType 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(AyaEvent).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");
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventDeleted"], Id = (long)AyaEvent.Deleted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventCreated"], Id = (long)AyaEvent.Created });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventRetrieved"], Id = (long)AyaEvent.Retrieved });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventModified"], Id = (long)AyaEvent.Modified });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentCreate"], Id = (long)AyaEvent.AttachmentCreate });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentDelete"], Id = (long)AyaEvent.AttachmentDelete });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentDownload"], Id = (long)AyaEvent.AttachmentDownload });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventLicenseFetch"], Id = (long)AyaEvent.LicenseFetch });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventLicenseTrialRequest"], Id = (long)AyaEvent.LicenseTrialRequest });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventServerStateChange"], Id = (long)AyaEvent.ServerStateChange });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventSeedDatabase"], Id = (long)AyaEvent.SeedDatabase });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventAttachmentModified"], Id = (long)AyaEvent.AttachmentModified });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AdminEraseDatabase"], Id = (long)AyaEvent.EraseAllData });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventResetSerial"], Id = (long)AyaEvent.ResetSerial });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["EventUtilityFileDownload"], Id = (long)AyaEvent.UtilityFileDownload });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(AuthorizationRoles).ToString()).ToLowerInvariant())
|
|
{
|
|
|
|
// TranslationKeysToFetch.Add("AuthorizationRoleNoRole");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleBizAdminLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleBizAdminFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleDispatchLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleDispatchFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleInventoryLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleInventoryFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleAccountingFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleTechLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleTechFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSubContractorLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSubContractorFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleCustomerLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleCustomerFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleOpsAdminLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleOpsAdminFull");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSalesLimited");
|
|
TranslationKeysToFetch.Add("AuthorizationRoleSalesFull");
|
|
// 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["AuthorizationRoleBizAdminLimited"], Id = (long)AuthorizationRoles.BizAdminLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleBizAdminFull"], Id = (long)AuthorizationRoles.BizAdminFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleDispatchLimited"], Id = (long)AuthorizationRoles.DispatchLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleDispatchFull"], Id = (long)AuthorizationRoles.DispatchFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleInventoryLimited"], Id = (long)AuthorizationRoles.InventoryLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleInventoryFull"], Id = (long)AuthorizationRoles.InventoryFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleAccountingFull"], Id = (long)AuthorizationRoles.AccountingFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleTechLimited"], Id = (long)AuthorizationRoles.TechLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleTechFull"], Id = (long)AuthorizationRoles.TechFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSubContractorLimited"], Id = (long)AuthorizationRoles.SubContractorLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSubContractorFull"], Id = (long)AuthorizationRoles.SubContractorFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleCustomerLimited"], Id = (long)AuthorizationRoles.CustomerLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleCustomerFull"], Id = (long)AuthorizationRoles.CustomerFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleOpsAdminLimited"], Id = (long)AuthorizationRoles.OpsAdminLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleOpsAdminFull"], Id = (long)AuthorizationRoles.OpsAdminFull });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSalesLimited"], Id = (long)AuthorizationRoles.SalesLimited });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["AuthorizationRoleSalesFull"], Id = (long)AuthorizationRoles.SalesFull });
|
|
// 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("NotifyEventWorkorderFinished");
|
|
TranslationKeysToFetch.Add("NotifyEventQuoteStatusChange");
|
|
TranslationKeysToFetch.Add("NotifyEventQuoteStatusAge");
|
|
TranslationKeysToFetch.Add("NotifyEventObjectAge");
|
|
TranslationKeysToFetch.Add("NotifyEventServiceBankDepleted");
|
|
TranslationKeysToFetch.Add("NotifyEventReminderImminent");
|
|
TranslationKeysToFetch.Add("NotifyEventScheduledOnWorkorder");
|
|
TranslationKeysToFetch.Add("NotifyEventScheduledOnWorkorderImminent");
|
|
TranslationKeysToFetch.Add("NotifyEventWorkorderFinishStatusOverdue");
|
|
TranslationKeysToFetch.Add("NotifyEventOutsideServiceOverdue");
|
|
TranslationKeysToFetch.Add("NotifyEventOutsideServiceReceived");
|
|
TranslationKeysToFetch.Add("NotifyEventPartRequestReceived");
|
|
TranslationKeysToFetch.Add("NotifyEventNotifyHealthCheck");
|
|
TranslationKeysToFetch.Add("NotifyEventBackupStatus");
|
|
TranslationKeysToFetch.Add("NotifyEventCustomerServiceImminent");
|
|
TranslationKeysToFetch.Add("NotifyEventPartRequested");
|
|
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("NotifyEventWorkorderFinishedFollowUp");
|
|
|
|
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["NotifyEventWorkorderStatusChange"], Id = (long)NotifyEventType.WorkorderStatusChange });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventContractExpiring"], Id = (long)NotifyEventType.ContractExpiring });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventCSRAccepted"], Id = (long)NotifyEventType.CSRAccepted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventCSRRejected"], Id = (long)NotifyEventType.CSRRejected });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventWorkorderFinished"], Id = (long)NotifyEventType.WorkorderFinished });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventQuoteStatusChange"], Id = (long)NotifyEventType.QuoteStatusChange });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventQuoteStatusAge"], Id = (long)NotifyEventType.QuoteStatusAge });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventObjectAge"], Id = (long)NotifyEventType.ObjectAge });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventServiceBankDepleted"], Id = (long)NotifyEventType.ServiceBankDepleted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventReminderImminent"], Id = (long)NotifyEventType.ReminderImminent });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventScheduledOnWorkorder"], Id = (long)NotifyEventType.ScheduledOnWorkorder });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventScheduledOnWorkorderImminent"], Id = (long)NotifyEventType.ScheduledOnWorkorderImminent });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventWorkorderFinishStatusOverdue"], Id = (long)NotifyEventType.WorkorderFinishStatusOverdue });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventOutsideServiceOverdue"], Id = (long)NotifyEventType.OutsideServiceOverdue });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventOutsideServiceReceived"], Id = (long)NotifyEventType.OutsideServiceReceived });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventPartRequestReceived"], Id = (long)NotifyEventType.PartRequestReceived });
|
|
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["NotifyEventCustomerServiceImminent"], Id = (long)NotifyEventType.CustomerServiceImminent });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventPartRequested"], Id = (long)NotifyEventType.PartRequested });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventWorkorderTotalExceedsThreshold"], Id = (long)NotifyEventType.WorkorderTotalExceedsThreshold });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventWorkorderStatusAge"], Id = (long)NotifyEventType.WorkorderStatusAge });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventUnitWarrantyExpiry"], Id = (long)NotifyEventType.UnitWarrantyExpiry });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventUnitMeterReadingMultipleExceeded"], Id = (long)NotifyEventType.UnitMeterReadingMultipleExceeded });
|
|
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["NotifyEventCopyOfCustomerNotification"], Id = (long)NotifyEventType.CopyOfCustomerNotification });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventWorkorderCreatedForCustomer"], Id = (long)NotifyEventType.WorkorderCreatedForCustomer });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventWorkorderFinishedFollowUp"], Id = (long)NotifyEventType.WorkorderFinishedFollowUp });
|
|
|
|
}
|
|
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(LoanUnitRateUnit).ToString()).ToLowerInvariant())
|
|
{
|
|
|
|
TranslationKeysToFetch.Add("LoanUnitRateDay");
|
|
TranslationKeysToFetch.Add("LoanUnitRateHalfDay");
|
|
TranslationKeysToFetch.Add("LoanUnitRateHour");
|
|
TranslationKeysToFetch.Add("LoanUnitRateMonth");
|
|
TranslationKeysToFetch.Add("LoanUnitRateNone");
|
|
TranslationKeysToFetch.Add("LoanUnitRateWeek");
|
|
TranslationKeysToFetch.Add("LoanUnitRateYear");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["LoanUnitRateNone"], Id = (long)LoanUnitRateUnit.None });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["LoanUnitRateHour"], Id = (long)LoanUnitRateUnit.Hours });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["LoanUnitRateHalfDay"], Id = (long)LoanUnitRateUnit.HalfDays });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["LoanUnitRateDay"], Id = (long)LoanUnitRateUnit.Days });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["LoanUnitRateWeek"], Id = (long)LoanUnitRateUnit.Weeks });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["LoanUnitRateMonth"], Id = (long)LoanUnitRateUnit.Months });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["LoanUnitRateYear"], Id = (long)LoanUnitRateUnit.Years });
|
|
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(CustomerServiceRequestPriority).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("CustomerServiceRequestPriorityASAP");
|
|
TranslationKeysToFetch.Add("CustomerServiceRequestPriorityNotUrgent");
|
|
TranslationKeysToFetch.Add("CustomerServiceRequestPriorityEmergency");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["CustomerServiceRequestPriorityNotUrgent"], Id = (long)CustomerServiceRequestPriority.NotUrgent });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["CustomerServiceRequestPriorityASAP"], Id = (long)CustomerServiceRequestPriority.ASAP });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["CustomerServiceRequestPriorityEmergency"], Id = (long)CustomerServiceRequestPriority.Emergency });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(CustomerServiceRequestStatus).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("CustomerServiceRequestStatusOpen");
|
|
TranslationKeysToFetch.Add("CustomerServiceRequestStatusAccepted");
|
|
TranslationKeysToFetch.Add("CustomerServiceRequestStatusDeclined");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["CustomerServiceRequestStatusOpen"], Id = (long)CustomerServiceRequestStatus.Open });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["CustomerServiceRequestStatusAccepted"], Id = (long)CustomerServiceRequestStatus.Accepted });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["CustomerServiceRequestStatusDeclined"], Id = (long)CustomerServiceRequestStatus.Declined });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(PurchaseOrderStatus).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("PurchaseOrderStatusOpenNotYetOrdered");
|
|
TranslationKeysToFetch.Add("PurchaseOrderStatusOpenOrdered");
|
|
TranslationKeysToFetch.Add("PurchaseOrderStatusOpenPartialReceived");
|
|
TranslationKeysToFetch.Add("PurchaseOrderStatusClosedFullReceived");
|
|
TranslationKeysToFetch.Add("PurchaseOrderStatusClosedNoneReceived");
|
|
TranslationKeysToFetch.Add("PurchaseOrderStatusClosedPartialReceived");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusOpenNotYetOrdered"], Id = (long)PurchaseOrderStatus.OpenNotYetOrdered });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusOpenOrdered"], Id = (long)PurchaseOrderStatus.OpenOrdered });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusOpenPartialReceived"], Id = (long)PurchaseOrderStatus.OpenPartialReceived });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusClosedFullReceived"], Id = (long)PurchaseOrderStatus.ClosedFullReceived });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusClosedNoneReceived"], Id = (long)PurchaseOrderStatus.ClosedNoneReceived });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["PurchaseOrderStatusClosedPartialReceived"], Id = (long)PurchaseOrderStatus.ClosedPartialReceived });
|
|
}
|
|
else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(ContractOverrideType).ToString()).ToLowerInvariant())
|
|
{
|
|
TranslationKeysToFetch.Add("ContractOverrideTypePriceDiscount");
|
|
TranslationKeysToFetch.Add("ContractOverrideTypeMarkup");
|
|
|
|
var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId);
|
|
|
|
ReturnList.Add(new NameIdItem() { Name = LT["ContractOverrideTypePriceDiscount"], Id = (long)ContractOverrideType.PriceDiscount });
|
|
ReturnList.Add(new NameIdItem() { Name = LT["ContractOverrideTypeMarkup"], Id = (long)ContractOverrideType.CostMarkup });
|
|
//this is not a valid setting, not sure why it's there
|
|
// ReturnList.Add(new NameIdItem() { Name = "-", Id = (long)ContractOverrideType.NotSet });
|
|
|
|
}
|
|
//#################################################################################################################
|
|
//################### 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 |