This commit is contained in:
@@ -70,20 +70,24 @@ namespace AyaNova.Api.Controllers
|
||||
if (format != "csv" && format != "json")
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, null, "format not valid, must be 'csv' or 'json'"));
|
||||
|
||||
|
||||
|
||||
var UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||
var UserRoles = UserRolesFromContext.Roles(HttpContext.Items);
|
||||
var UserTranslationId = UserTranslationIdFromContext.Id(HttpContext.Items);
|
||||
|
||||
//Rehydrate id list if necessary
|
||||
if (selectedRequest.SelectedRowIds.Length == 0)
|
||||
selectedRequest.SelectedRowIds = await DataListSelectedProcessingOptions.RehydrateIdList(
|
||||
selectedRequest,
|
||||
ct,
|
||||
UserRolesFromContext.Roles(HttpContext.Items),
|
||||
UserRoles,
|
||||
log,
|
||||
UserIdFromContext.Id(HttpContext.Items),
|
||||
UserTranslationIdFromContext.Id(HttpContext.Items));
|
||||
UserId,
|
||||
UserTranslationId);
|
||||
|
||||
|
||||
log.LogDebug($"Instantiating biz object handler for {selectedRequest.ObjectType}");
|
||||
var biz = BizObjectFactory.GetBizObject(selectedRequest.ObjectType, ct);
|
||||
var biz = BizObjectFactory.GetBizObject(selectedRequest.ObjectType, ct, UserId, UserRoles, UserTranslationId);
|
||||
log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.ObjectType} items");
|
||||
// var TheData = await ((IExportAbleObject)biz).GetJSONExportData(dataListSelection.SelectedRowIds);
|
||||
|
||||
|
||||
@@ -12,8 +12,10 @@ namespace AyaNova.Biz
|
||||
|
||||
//Returns the biz object class that corresponds to the type presented
|
||||
//Used by SEARCH, REPORTING and objects with JOBS
|
||||
internal static BizObject GetBizObject(AyaType ayaType, AyContext ct, long userId = 1, AuthorizationRoles roles = AuthorizationRoles.All)
|
||||
internal static BizObject GetBizObject(AyaType ayaType, AyContext ct, long userId = 1, AuthorizationRoles roles = AuthorizationRoles.All, long translationId = 0)
|
||||
{
|
||||
if (translationId == 0)
|
||||
translationId = ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID;
|
||||
|
||||
switch (ayaType)
|
||||
{
|
||||
@@ -23,60 +25,60 @@ namespace AyaNova.Biz
|
||||
case AyaType.TrialSeeder:
|
||||
return new TrialBiz(ct, userId, roles);
|
||||
case AyaType.Translation:
|
||||
return new TranslationBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new TranslationBiz(ct, userId, translationId, roles);
|
||||
case AyaType.DataListSavedFilter:
|
||||
return new DataListSavedFilterBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new DataListSavedFilterBiz(ct, userId, translationId, roles);
|
||||
case AyaType.FormCustom:
|
||||
return new FormCustomBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new FormCustomBiz(ct, userId, translationId, roles);
|
||||
case AyaType.Widget:
|
||||
return new WidgetBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new WidgetBiz(ct, userId, translationId, roles);
|
||||
case AyaType.FileAttachment:
|
||||
return new AttachmentBiz(ct, userId, roles);
|
||||
case AyaType.Customer:
|
||||
return new CustomerBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new CustomerBiz(ct, userId, translationId, roles);
|
||||
case AyaType.CustomerNote:
|
||||
return new CustomerNoteBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new CustomerNoteBiz(ct, userId, translationId, roles);
|
||||
case AyaType.User:
|
||||
return new UserBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new UserBiz(ct, userId, translationId, roles);
|
||||
case AyaType.Memo:
|
||||
return new MemoBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new MemoBiz(ct, userId, translationId, roles);
|
||||
|
||||
case AyaType.Contract:
|
||||
return new ContractBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new ContractBiz(ct, userId, translationId, roles);
|
||||
case AyaType.HeadOffice:
|
||||
return new HeadOfficeBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new HeadOfficeBiz(ct, userId, translationId, roles);
|
||||
case AyaType.LoanUnit:
|
||||
return new LoanUnitBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new LoanUnitBiz(ct, userId, translationId, roles);
|
||||
case AyaType.Part:
|
||||
return new PartBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new PartBiz(ct, userId, translationId, roles);
|
||||
case AyaType.PartWarehouse:
|
||||
return new PartWarehouseBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new PartWarehouseBiz(ct, userId, translationId, roles);
|
||||
case AyaType.PartAssembly:
|
||||
return new PartAssemblyBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new PartAssemblyBiz(ct, userId, translationId, roles);
|
||||
case AyaType.PartInventory:
|
||||
return new PartInventoryBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new PartInventoryBiz(ct, userId, translationId, roles);
|
||||
|
||||
case AyaType.PM:
|
||||
return new PMBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new PMBiz(ct, userId, translationId, roles);
|
||||
case AyaType.PMTemplate:
|
||||
return new PMTemplateBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new PMTemplateBiz(ct, userId, translationId, roles);
|
||||
|
||||
case AyaType.Project:
|
||||
return new ProjectBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new ProjectBiz(ct, userId, translationId, roles);
|
||||
case AyaType.PurchaseOrder:
|
||||
return new PurchaseOrderBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new PurchaseOrderBiz(ct, userId, translationId, roles);
|
||||
case AyaType.Quote:
|
||||
return new QuoteBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new QuoteBiz(ct, userId, translationId, roles);
|
||||
|
||||
case AyaType.QuoteTemplate:
|
||||
return new QuoteTemplateBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new QuoteTemplateBiz(ct, userId, translationId, roles);
|
||||
|
||||
case AyaType.Unit:
|
||||
return new UnitBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new UnitBiz(ct, userId, translationId, roles);
|
||||
case AyaType.UnitModel:
|
||||
return new UnitModelBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new UnitModelBiz(ct, userId, translationId, roles);
|
||||
case AyaType.Vendor:
|
||||
return new VendorBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new VendorBiz(ct, userId, translationId, roles);
|
||||
//--- WorkOrder
|
||||
case AyaType.WorkOrder:
|
||||
case AyaType.WorkOrderItem:
|
||||
@@ -89,25 +91,25 @@ namespace AyaNova.Biz
|
||||
case AyaType.WorkOrderItemTask:
|
||||
case AyaType.WorkOrderItemTravel:
|
||||
case AyaType.WorkOrderItemUnit:
|
||||
return new WorkOrderBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new WorkOrderBiz(ct, userId, translationId, roles);
|
||||
//---
|
||||
case AyaType.WorkOrderTemplate:
|
||||
return new WorkOrderTemplateBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new WorkOrderTemplateBiz(ct, userId, translationId, roles);
|
||||
|
||||
case AyaType.Reminder:
|
||||
return new ReminderBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new ReminderBiz(ct, userId, translationId, roles);
|
||||
case AyaType.Review:
|
||||
return new ReviewBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new ReviewBiz(ct, userId, translationId, roles);
|
||||
case AyaType.ServiceRate:
|
||||
return new ServiceRateBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new ServiceRateBiz(ct, userId, translationId, roles);
|
||||
case AyaType.TravelRate:
|
||||
return new TravelRateBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new TravelRateBiz(ct, userId, translationId, roles);
|
||||
case AyaType.TaxCode:
|
||||
return new TaxCodeBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new TaxCodeBiz(ct, userId, translationId, roles);
|
||||
case AyaType.ServiceBank:
|
||||
return new ServiceBankBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new ServiceBankBiz(ct, userId, translationId, roles);
|
||||
case AyaType.CustomerServiceRequest:
|
||||
return new CustomerServiceRequestBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
|
||||
return new CustomerServiceRequestBiz(ct, userId, translationId, roles);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
log.LogDebug($"Instantiating biz object handler for {selectedRequest.ObjectType}");
|
||||
var biz = BizObjectFactory.GetBizObject(selectedRequest.ObjectType, ct);
|
||||
var biz = BizObjectFactory.GetBizObject(selectedRequest.ObjectType, ct, UserId, CurrentUserRoles, UserTranslationId);
|
||||
log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.ObjectType} items");
|
||||
return await ((IReportAbleObject)biz).GetReportData(selectedRequest.SelectedRowIds);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace AyaNova.Biz
|
||||
PhraseItems.ToArray();
|
||||
|
||||
//get text
|
||||
ISearchAbleObject o = (ISearchAbleObject)BizObjectFactory.GetBizObject(ayaType, ct, userId, currentUserRoles);
|
||||
ISearchAbleObject o = (ISearchAbleObject)BizObjectFactory.GetBizObject(ayaType, ct, userId, currentUserRoles, translationId);
|
||||
|
||||
//get extract
|
||||
var searchParams = await o.GetSearchResultSummary(id);
|
||||
|
||||
Reference in New Issue
Block a user