applied logic in employee integretion for app role type
This commit is contained in:
parent
b094c7ca75
commit
376af6828e
|
|
@ -150,6 +150,7 @@ public class IntegrationService : IIntegrationService
|
||||||
response.IsUpdated = false;
|
response.IsUpdated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int roleTypeId = GetRegionAreaTerritoryLevel(request);
|
||||||
bool isUserExist = await IsUserExistByEmployeeNumberAsync(tc, request.EmployeeVendorCode);
|
bool isUserExist = await IsUserExistByEmployeeNumberAsync(tc, request.EmployeeVendorCode);
|
||||||
|
|
||||||
if (!isUserExist)
|
if (!isUserExist)
|
||||||
|
|
@ -164,7 +165,7 @@ public class IntegrationService : IIntegrationService
|
||||||
EmailAddress = request.Mail,
|
EmailAddress = request.Mail,
|
||||||
IsLocked = 0,
|
IsLocked = 0,
|
||||||
Password ="12345",
|
Password ="12345",
|
||||||
UserRoleType = request.Designation == "01"? (int)UserRoleTypeEnum.OrderCollector : null,
|
UserRoleType = roleTypeId,
|
||||||
UserPlatformId = (int)UserPlatFormType.AppUser,
|
UserPlatformId = (int)UserPlatFormType.AppUser,
|
||||||
EmployeeNumber = request.EmployeeVendorCode
|
EmployeeNumber = request.EmployeeVendorCode
|
||||||
};
|
};
|
||||||
|
|
@ -191,9 +192,28 @@ public class IntegrationService : IIntegrationService
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int DecideEmployeeAppRole(IntegrationEmployeeRequest request)
|
private int GetRegionAreaTerritoryLevel(IntegrationEmployeeRequest request)
|
||||||
{
|
{
|
||||||
|
bool hasRegion = !string.IsNullOrWhiteSpace(request.RegionAreaCode);
|
||||||
|
bool hasArea = !string.IsNullOrWhiteSpace(request.AreaAVSalesUnitCode);
|
||||||
|
bool hasTerritory = !string.IsNullOrWhiteSpace(request.Territory);
|
||||||
|
|
||||||
|
if (hasRegion && hasArea && hasTerritory)
|
||||||
|
{
|
||||||
|
return (int)UserRoleTypeEnum.OrderCollector;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasRegion && hasArea && !hasTerritory)
|
||||||
|
{
|
||||||
|
return (int)UserRoleTypeEnum.OrderValidator;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasRegion && !hasArea && !hasTerritory)
|
||||||
|
{
|
||||||
|
return (int)UserRoleTypeEnum.OrderApprover;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<MaterialIntegrationReqResponse> UpsertMaterialAsync(IntegrationMaterialRequest request)
|
public async Task<MaterialIntegrationReqResponse> UpsertMaterialAsync(IntegrationMaterialRequest request)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user