public PatUser(IIdentity user, IPatService patService) { try { #if DEBUG var stopwatch = new Stopwatch(); stopwatch.Start(); #endif LoginName = user.Name.RemoveDomain(); var ldapPath = ConfigurationManager.AppSettings[CommonConstants.LdapUserQueryPath]; var query = string.Format(ldapPath, LoginName); var directoryUser = new DirectoryEntry(query); SetUserUp(directoryUser); #if DEBUG var elapsed = AppHelper.StopTheWatch(stopwatch); patService.SaveActivity(string.Format("User Id {1} construction took {0}", elapsed, user.Name), "PATUSER"); #endif } catch (Exception ex) { Elmah.ErrorLog.GetDefault(null).Log(new Elmah.Error(ex)); throw; } }
public ControllerDependencies(IVirtualPathService virtualPathService, IPatService patService ) { VirtualPathService = virtualPathService; PatService = patService; }
private static void ClearOutAllBulletins(IPatService sut) { var isAdmin = true; var results = sut.GetBulletins(DataConstants.StandardBulletinType, isAdmin); foreach (var bulletin in results) { sut.DeleteBulletin(bulletin.BulletinId); } }
/// <summary> /// Construct a PAT user given just the user ID eg SC0779 /// </summary> /// <param name="userId"></param> /// <param name="patService">dependancy for debugging</param> public PatUser(string userId, IPatService patService) { #if DEBUG var stopwatch = new Stopwatch(); stopwatch.Start(); #endif // formulate the query var query = string.Format( ConfigurationManager.AppSettings[CommonConstants.LdapUserQueryPath], userId); // get the directory entry var directoryUser = new DirectoryEntry(query); SetUserUp(directoryUser); #if DEBUG var elapsed = AppHelper.StopTheWatch(stopwatch); patService.SaveActivity(string.Format("User Id {1} construction took {0}", elapsed, userId), "PATUSER"); #endif }
private static void SampleCleanup(IPatService patService) { var deleteCount = 0; var sessionList = patService.GetDistinctSessionKeys(); foreach (var session in from session in sessionList let list = patService.GetSample(sessionKey: session) let rec1 = list.FirstOrDefault() where rec1 != null where rec1.IsExpired() select session) { patService.DeleteSession(session, BatchUser); deleteCount++; } var msg = string.Format("{0} sessions deleted", deleteCount); patService.SaveActivity(msg, BatchUser); }
/// <summary> /// Perform a Health check on the system. /// </summary> /// <param name="patService">The pat service.</param> /// <param name="lastBatchRun">The last batch run date and time.</param> /// <param name="how">How the job was invoked.</param> public static void HealthCheck(IPatService patService, DateTime lastBatchRun, string how) { var auditService = patService.GetAuditService(); string why; if (!ReadyToGenerateAgain(lastBatchRun, how, out why)) { auditService.AuditActivity(string.Format("Health Check skipped ({1}) for now: last Run {0}", lastBatchRun, why), DiskDiagnostics); return; } var stopwatch = new Stopwatch(); stopwatch.Start(); CheckDiskSpace(auditService); CheckAppSettings(auditService); var timeElapsed = AppHelper.StopTheWatch(stopwatch); auditService.AuditActivity(string.Format("Health Check complete: in {0}", timeElapsed), DiskDiagnostics); }
private static void BatchUpdateReviewOutcomes(IPatService patService , string how , PatControl control) { var lastBatchRun = control.LastBatchRun; string auditMsg; string why; if (ReadyToGenerateAgain(lastBatchRun, how, out why)) { var stopwatch = new Stopwatch(); stopwatch.Start(); var vm = new BuroViewModel(); var buro = new BuroProcess(); vm = buro.Execute(vm , patService.GetUploadRepository() , patService.GetQuestionaireRepository() , patService.GetAuditService() , patService.GetReviewRepository() ); control.LastBatchRun = DateTime.Now; control.UpdatedBy = BatchUser; var timeElapsed = AppHelper.StopTheWatch(stopwatch); auditMsg = string.Format("BURO complete: {0} Reviews checked; {1} updated {3} errors in {2}", vm.ReviewsRead, vm.ReviewsUpdated, timeElapsed, vm.ValidationErrors); } else { auditMsg = string.Format("BURO skipped for now ({1}): last Run {0}", lastBatchRun, why); } patService.SaveActivity(CreateAuditRecord(auditMsg, "BURO")); }
private static void UpdateComplianceIndicators(IPatService patService, string how, PatControl control) { var lastComplianceRun = control.LastComplianceRun; string auditMsg; string why; if (ReadyToGenerateAgain(lastComplianceRun, how, out why)) { var stopwatch = new Stopwatch(); stopwatch.Start(); var ciViewModel = new ComplianceIndicatorsViewModel(); // Options currently required by PAM var cigen = new ComplianceIndicators(); ciViewModel = cigen.Generate(ciViewModel); control.LastComplianceRun = DateTime.Now; control.UpdatedBy = BatchUser; control.ReviewCount = ciViewModel.ReviewsRead; control.ProjectCount = ciViewModel.ProjectsRead; control.ProjectCompletion = AppHelper.Percent(ciViewModel.CompletedProjects, ciViewModel.ProjectsRead); control.SampleCount = ciViewModel.SamplesRead; control.TotalComplianceIndicator = AppHelper.Average(ciViewModel.TotalCompliancePoints, ciViewModel.ReviewsRead); var timeElapsed = AppHelper.StopTheWatch(stopwatch); auditMsg = string.Format("CI Generation complete: {0} indicators generated in {1}", ciViewModel.IndicatorsGenerated, timeElapsed); } else { auditMsg = string.Format("CI Generation skipped ({1}) for now: last Run {0}", lastComplianceRun, why); } patService.SaveActivity(CreateAuditRecord(auditMsg, "CIGEN")); }
/// <summary> /// Initializes a new instance of the <see cref="InfrastructureController" /> class. /// </summary> /// <param name="controllerDependencies">Dependencies holder.</param> protected InfrastructureController(IControllerDependencies controllerDependencies) { VirtualPathService = controllerDependencies.VirtualPathService; PatService = controllerDependencies.PatService; }
public string ExportReviews(List <Review> reviewList, IPatService patService) { var sw = new StringWriter(); // First row is the Column Headers, now standardised WriteColumnHeaders(sw); foreach (var review in reviewList) { var sb = new StringBuilder(); WriteCell(sb, review.ReviewId.ToString(CultureInfo.InvariantCulture)); WriteCell(sb, review.UploadId.ToString(CultureInfo.InvariantCulture)); WriteCell(sb, review.ProjectId.ToString(CultureInfo.InvariantCulture)); WriteCell(sb, review.OrgCode); WriteCell(sb, patService.GetOrgName(review.OrgCode)); WriteCell(sb, review.ESACode); WriteCell(sb, patService.GetEsaDescription(review.ESACode)); WriteCell(sb, review.SiteCode); WriteCell(sb, patService.GetSiteDescription(review.SiteCode)); WriteCell(sb, review.StateCode); WriteCell(sb, review.ManagedBy); WriteCell(sb, review.ClaimId.ToString(CultureInfo.InvariantCulture)); WriteCell(sb, review.ClaimType); WriteCell(sb, patService.GetClaimTypeDescription(review.ClaimType)); WriteCell(sb, AppHelper.ShortDate(review.ClaimCreationDate)); WriteCell(sb, review.ContractType); WriteCell(sb, patService.GetContractTypeDescription(review.ContractType)); WriteCell(sb, AppHelper.NullableDollarAmount(review.ClaimAmount)); WriteCell(sb, AppHelper.FlagOut(review.AutoSpecialClaim)); WriteCell(sb, AppHelper.FlagOut(review.ManualSpecialClaim)); WriteCell(sb, review.JobseekerId.ToString(CultureInfo.InvariantCulture)); WriteCell(sb, review.JobSeekerGivenName); WriteCell(sb, review.JobSeekerSurname); WriteCell(sb, review.ActivityId.ToString(CultureInfo.InvariantCulture)); WriteCell(sb, review.AssessmentCode); WriteCell(sb, patService.GetAssessmentDescription(review.AssessmentCode)); WriteCell(sb, review.RecoveryReason); WriteCell(sb, patService.GetRecoveryReasonDescription(review.RecoveryReason)); WriteCell(sb, review.AssessmentAction); WriteCell(sb, patService.GetAssessmentActionDescription(review.AssessmentAction)); WriteCell(sb, review.OutcomeCode); WriteCell(sb, patService.GetFinalOutcomeDescription(review.OutcomeCode)); WriteCell(sb, AppHelper.FlagOut(review.IsOutOfScope)); WriteCell(sb, AppHelper.FlagOut(review.IsAdditionalReview)); WriteCell(sb, review.Comments); sw.WriteLine(sb.ToString()); } return(sw.ToString()); }