Skip to content

Commit

Permalink
Merge tag 'release-1.1.3' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
peggy-quartech committed Oct 31, 2024
2 parents 52e0c45 + 62e65ec commit bb5543d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,39 @@ public async Task ProcessAppWithSharableClearanceAsync(ApplicationCreateCmd crea
if (!createApplicationCmd.SharedClearanceId.HasValue)
throw new ArgumentException("SharedClearanceId cannot be null");
account? org = await _context.GetOrgById(createApplicationCmd.OrgId, ct);
spd_clearance? clearance = await _context.GetClearanceById((Guid)createApplicationCmd.SharedClearanceId, ct);
contact? contact = await _context.contacts.Where(c => c.contactid == createApplicationCmd.ContactId).FirstOrDefaultAsync(ct);
_mapper.Map<ApplicationCreateCmd, contact>(createApplicationCmd, contact);
_context.UpdateObject(contact);

Guid teamGuid = Guid.Parse(DynamicsConstants.Screening_Risk_Assessment_Coordinator_Team_Guid);
team? team = await _context.teams.Where(t => t.teamid == teamGuid).FirstOrDefaultAsync(ct);
//spdbt-3220
spd_clearance? clearance = await _context.spd_clearances
.Expand(c => c.spd_CaseID)
.Where(c => c.spd_clearanceid == (Guid)createApplicationCmd.SharedClearanceId)
.FirstOrDefaultAsync(ct);
if (clearance == null)
throw new ApiException(HttpStatusCode.BadRequest, "Cannot find specified clearance.");
team? team = null;
int state;
int status;
if (clearance.spd_CaseID.spd_risklevel == (int)CaseRiskLevelOptionSet.L2 || clearance.spd_CaseID.spd_risklevel == (int)CaseRiskLevelOptionSet.L3)
{
Guid teamGuid = Guid.Parse(DynamicsConstants.Screening_Risk_Assessment_Coordinator_Team_Guid);
team = await _context.teams.Where(t => t.teamid == teamGuid).FirstOrDefaultAsync(ct);
status = (int)ClearanceAccessStatusOptionSet.Draft;
state = DynamicsConstants.StateCode_Active;
}
else
{
Guid teamGuid = Guid.Parse(DynamicsConstants.Client_Service_Team_Guid);
team = await _context.teams.Where(t => t.teamid == teamGuid).FirstOrDefaultAsync(ct);
status = (int)ClearanceAccessStatusOptionSet.Approved;
state = DynamicsConstants.StateCode_Active;
}

spd_clearanceaccess clearanceaccess = new() { spd_clearanceaccessid = Guid.NewGuid() };
clearanceaccess.statecode = DynamicsConstants.StateCode_Active;
clearanceaccess.statuscode = (int)ClearanceAccessStatusOptionSet.Draft;
clearanceaccess.statecode = state;
clearanceaccess.statuscode = status;
clearanceaccess.spd_issystemgenerated = true;
_context.AddTospd_clearanceaccesses(clearanceaccess);
_context.SetLink(clearanceaccess, nameof(clearanceaccess.spd_OrganizationId), org);
_context.SetLink(clearanceaccess, nameof(clearanceaccess.spd_ClearanceId), clearance);
Expand Down
7 changes: 7 additions & 0 deletions src/Spd.Utilities.Dynamics/OptionSets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,11 @@ public enum EventStatusReasonOptionSet
Success = 100000002, //Inactive State status reason
Fail = 100000003 //Inactive State status reason
}

public enum CaseRiskLevelOptionSet
{
L1 = 100000000,
L2 = 100000001,
L3 = 100000002
}
}

0 comments on commit bb5543d

Please sign in to comment.