Ejemplo n.º 1
0
 public void UpdateOrganization(APIOrganizationDTO apiOrganizationDTO)
 {
     try
     {
         if (isUpdating)
         {
             _logger.LogError("UpdateOrganization cancelled because it is already updating");
         }
         else
         {
             var stopwatch = new Stopwatch();
             stopwatch.Start();
             isUpdating = true;
             _logger.LogInformation("Updating OrgUnits");
             UpdateOrgUnits(apiOrganizationDTO.OrgUnits);
             _logger.LogInformation("Updating Persons");
             UpdatePersons(apiOrganizationDTO.Persons);
             _logger.LogInformation("Updating leaders on expired or activated substitutes");
             UpdateLeadersOnExpiredOrActivatedSubstitutes();
             _logger.LogInformation("Adding leaders to reports that have none");
             AddLeadersToReportsThatHaveNone();
             _logger.LogInformation("Update completed in {0} seconds", stopwatch.Elapsed.TotalSeconds);
         }
     }
     catch (Exception e)
     {
         _logger.LogError(e, "Failed to update Organization");
     }
     finally
     {
         isUpdating = false;
     }
 }
 public void UpdateOrganization([FromBody] APIOrganizationDTO apiOrganizationDTO)
 {
     _apiService.UpdateOrganization(apiOrganizationDTO);
 }