Skip to content

Commit f7e7787

Browse files
committed
Adding code to cleanup broken workorder cases.
This can be removed once it has been used.
1 parent 15fcb58 commit f7e7787

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

eFormAPI/Plugins/BackendConfiguration.Pn/BackendConfiguration.Pn/EformBackendConfigurationPlugin.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,19 @@ await WorkOrderHelper
550550
{
551551
await newArea.Create(backendConfigurationPnDbContext).ConfigureAwait(false);
552552
}
553+
554+
var brokenWorkorderCases = await backendConfigurationPnDbContext.WorkorderCases
555+
.Where(x => x.CaseStatusesEnum == CaseStatusesEnum.NewTask)
556+
.Where(x => x.WorkflowState !=
557+
Microting.eForm.Infrastructure.Constants.Constants.WorkflowStates.Removed)
558+
.Where(x => x.ParentWorkorderCaseId != null)
559+
.ToListAsync();
560+
561+
foreach (var brokenWorkorderCase in brokenWorkorderCases)
562+
{
563+
brokenWorkorderCase.CaseStatusesEnum = CaseStatusesEnum.Awaiting;
564+
await brokenWorkorderCase.Update(backendConfigurationPnDbContext);
565+
}
553566
}
554567

555568
public void ConfigureDbContext(IServiceCollection services, string connectionString)

0 commit comments

Comments
 (0)