Skip to content

Commit 87a5a36

Browse files
committed
Fixing problems with emailing.
Code cleanup to use var instead of full class names.
1 parent a22caf3 commit 87a5a36

File tree

5 files changed

+77
-101
lines changed

5 files changed

+77
-101
lines changed

eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/Controllers/WorkflowCasesController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ public async Task DownloadEFormPdf(int id, string fileType)
9090
{
9191
var result = await _workflowPnSettingsService.DownloadEFormPdf(id, fileType);
9292
const int bufferSize = 4086;
93-
byte[] buffer = new byte[bufferSize];
93+
var buffer = new byte[bufferSize];
9494
Response.OnStarting(async () =>
9595
{
9696
if (!result.Success)
9797
{
9898
Response.ContentLength = result.Message.Length;
9999
Response.ContentType = "text/plain";
100100
Response.StatusCode = 400;
101-
byte[] bytes = Encoding.UTF8.GetBytes(result.Message);
101+
var bytes = Encoding.UTF8.GetBytes(result.Message);
102102
await Response.Body.WriteAsync(bytes, 0, result.Message.Length);
103103
await Response.Body.FlushAsync();
104104
}

eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/EformWorkflowPlugin.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ public void ConfigureDbContext(IServiceCollection services, string connectionStr
123123
options.IsGlobalModeEnabled = true;
124124
});
125125

126-
string pattern = @"Database=(\d+)_eform-angular-workflow-plugin;";
127-
Match match = Regex.Match(connectionString!, pattern);
126+
var pattern = @"Database=(\d+)_eform-angular-workflow-plugin;";
127+
var match = Regex.Match(connectionString!, pattern);
128128

129129
if (match.Success)
130130
{
131-
string numberString = match.Groups[1].Value;
132-
int number = int.Parse(numberString);
131+
var numberString = match.Groups[1].Value;
132+
var number = int.Parse(numberString);
133133
SentrySdk.ConfigureScope(scope =>
134134
{
135135
scope.SetTag("customerNo", number.ToString());
@@ -327,31 +327,31 @@ public PluginPermissionsManager GetPermissionsManager(string connectionString)
327327

328328
private async void SeedWorkOrderForms(IServiceCollection serviceCollection)
329329
{
330-
ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();
331-
IPluginDbOptions<WorkflowBaseSettings> pluginDbOptions =
330+
var serviceProvider = serviceCollection.BuildServiceProvider();
331+
var pluginDbOptions =
332332
serviceProvider.GetRequiredService<IPluginDbOptions<WorkflowBaseSettings>>();
333333

334-
Core core = await serviceProvider.GetRequiredService<IEFormCoreService>().GetCore();
335-
WorkflowPnDbContext context = serviceProvider.GetRequiredService<WorkflowPnDbContext>();
334+
var core = await serviceProvider.GetRequiredService<IEFormCoreService>().GetCore();
335+
var context = serviceProvider.GetRequiredService<WorkflowPnDbContext>();
336336
var sdkDbContext = core.DbContextHelper.GetDbContext();
337337

338338
// CheckUploadedDataIntegrity(sdkDbContext, core);
339339

340340
if (pluginDbOptions.Value.IncidentPlaceListId == 0)
341341
{
342-
int incidentPlaceListId = await SeedHelper.CreateAccidentLocationList(core);
342+
var incidentPlaceListId = await SeedHelper.CreateAccidentLocationList(core);
343343
await pluginDbOptions.UpdateDb(settings => settings.IncidentPlaceListId = incidentPlaceListId, context, 1);
344344
}
345345

346346
if (pluginDbOptions.Value.IncidentTypeListId == 0)
347347
{
348-
int incidentPlaceListId = await SeedHelper.CreateAccidentTypesList(core);
348+
var incidentPlaceListId = await SeedHelper.CreateAccidentTypesList(core);
349349
await pluginDbOptions.UpdateDb(settings => settings.IncidentTypeListId = incidentPlaceListId, context, 1);
350350
}
351351

352352
if (pluginDbOptions.Value.FirstEformId == 0)
353353
{
354-
int newTaskId = await SeedHelper.CreateNewTaskEform(core);
354+
var newTaskId = await SeedHelper.CreateNewTaskEform(core);
355355
await pluginDbOptions.UpdateDb(settings => settings.FirstEformId = newTaskId, context, 1);
356356
}
357357
else
@@ -365,7 +365,7 @@ private async void SeedWorkOrderForms(IServiceCollection serviceCollection)
365365

366366
if (pluginDbOptions.Value.SecondEformId == 0)
367367
{
368-
int taskListId = await SeedHelper.CreateTaskListEform(core);
368+
var taskListId = await SeedHelper.CreateTaskListEform(core);
369369
await pluginDbOptions.UpdateDb(settings => settings.SecondEformId = taskListId, context, 1);
370370
}
371371
else
@@ -379,7 +379,7 @@ private async void SeedWorkOrderForms(IServiceCollection serviceCollection)
379379

380380
if (pluginDbOptions.Value.InstructionseFormId == 0)
381381
{
382-
int formId = await SeedHelper.CreateInstructioneForm(core);
382+
var formId = await SeedHelper.CreateInstructioneForm(core);
383383
await pluginDbOptions.UpdateDb(settings => settings.InstructionseFormId = formId, context, 1);
384384
}
385385
else
@@ -395,11 +395,11 @@ private async void SeedWorkOrderForms(IServiceCollection serviceCollection)
395395
private static void CheckUploadedDataIntegrity(MicrotingDbContext dbContext, Core core)
396396
{
397397
AmazonS3Client s3Client;
398-
string s3AccessKeyId = dbContext.Settings.Single(x => x.Name == Settings.s3AccessKeyId.ToString()).Value;
399-
string s3SecretAccessKey = dbContext.Settings.Single(x => x.Name == Settings.s3SecrectAccessKey.ToString()).Value;
400-
string s3Endpoint = dbContext.Settings.Single(x => x.Name == Settings.s3Endpoint.ToString()).Value;
401-
string s3BucktName = dbContext.Settings.Single(x => x.Name == Settings.s3BucketName.ToString()).Value;
402-
string customerNo = dbContext.Settings.Single(x => x.Name == Settings.customerNo.ToString()).Value;
398+
var s3AccessKeyId = dbContext.Settings.Single(x => x.Name == Settings.s3AccessKeyId.ToString()).Value;
399+
var s3SecretAccessKey = dbContext.Settings.Single(x => x.Name == Settings.s3SecrectAccessKey.ToString()).Value;
400+
var s3Endpoint = dbContext.Settings.Single(x => x.Name == Settings.s3Endpoint.ToString()).Value;
401+
var s3BucktName = dbContext.Settings.Single(x => x.Name == Settings.s3BucketName.ToString()).Value;
402+
var customerNo = dbContext.Settings.Single(x => x.Name == Settings.customerNo.ToString()).Value;
403403

404404
if (s3Endpoint.Contains("https"))
405405
{
@@ -415,7 +415,7 @@ private static void CheckUploadedDataIntegrity(MicrotingDbContext dbContext, Cor
415415
}
416416
var uploadedDatas = dbContext.UploadedDatas.Where(x => x.FileLocation.Contains("https")).ToList();
417417

418-
foreach (UploadedData ud in uploadedDatas)
418+
foreach (var ud in uploadedDatas)
419419
{
420420
if (ud.FileName == null)
421421
{
@@ -425,7 +425,7 @@ private static void CheckUploadedDataIntegrity(MicrotingDbContext dbContext, Cor
425425
{
426426
try
427427
{
428-
GetObjectMetadataRequest request = new GetObjectMetadataRequest
428+
var request = new GetObjectMetadataRequest
429429
{
430430
BucketName = $"{s3BucktName}/{customerNo}",
431431
Key = ud.FileName
@@ -442,7 +442,7 @@ private static void CheckUploadedDataIntegrity(MicrotingDbContext dbContext, Cor
442442
{
443443
try
444444
{
445-
GetObjectMetadataRequest request = new GetObjectMetadataRequest
445+
var request = new GetObjectMetadataRequest
446446
{
447447
BucketName = s3BucktName,
448448
Key = $"{s3BucktName}/{ud.FileName}"

eFormAPI/Plugins/Workflow.Pn/Workflow.Pn/Helpers/SeedHelper.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class SeedHelper
1919
{
2020
public static async Task<int> CreateAccidentTypesList(Core core)
2121
{
22-
EntityGroupList model = await core.Advanced_EntityGroupAll(
22+
var model = await core.Advanced_EntityGroupAll(
2323
"id",
2424
"eform-angular-workflow-plugin-editable-AccidentType",
2525
0, 1, Constants.FieldTypes.EntitySelect,
@@ -37,7 +37,7 @@ public static async Task<int> CreateAccidentTypesList(Core core)
3737

3838
public static async Task<int> CreateAccidentLocationList(Core core)
3939
{
40-
EntityGroupList model = await core.Advanced_EntityGroupAll(
40+
var model = await core.Advanced_EntityGroupAll(
4141
"id",
4242
"eform-angular-workflow-plugin-editable-AccidentLocations",
4343
0, 1, Constants.FieldTypes.EntitySelect,
@@ -67,11 +67,11 @@ public static async Task<int> CreateNewTaskEform(Core core)
6767
{
6868
timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("E. Europe Standard Time");
6969
}
70-
int accidentTypesList = await CreateAccidentTypesList(core);
71-
int accidentLocationList = await CreateAccidentLocationList(core);
72-
Language language = await sdkDbContext.Languages.FirstAsync();
70+
var accidentTypesList = await CreateAccidentTypesList(core);
71+
var accidentLocationList = await CreateAccidentLocationList(core);
72+
var language = await sdkDbContext.Languages.FirstAsync();
7373

74-
List<Template_Dto> templatesDto = await core.TemplateItemReadAll(false,
74+
var templatesDto = await core.TemplateItemReadAll(false,
7575
"",
7676
"eform-angular-workflow-plugin-newtask",
7777
false,
@@ -92,7 +92,7 @@ public static async Task<int> CreateNewTaskEform(Core core)
9292
return id;
9393
}
9494

95-
MainElement newTaskForm = new MainElement
95+
var newTaskForm = new MainElement
9696
{
9797
Id = 5769,
9898
Repeated = 0,
@@ -106,7 +106,7 @@ public static async Task<int> CreateNewTaskEform(Core core)
106106
EnableQuickSync = true,
107107
};
108108

109-
List<DataItem> dataItems = new List<DataItem>
109+
var dataItems = new List<DataItem>
110110
{
111111
new Date(
112112
371265,
@@ -190,7 +190,7 @@ public static async Task<int> CreateNewTaskEform(Core core)
190190
};
191191

192192

193-
DataElement dataElement = new DataElement(
193+
var dataElement = new DataElement(
194194
142108,
195195
"Ny opgave|New task|Neue Aufgabe",
196196
0,
@@ -221,7 +221,7 @@ public static async Task<int> CreateNewTaskEform(Core core)
221221
public static async Task<int> CreateTaskListEform(Core core)
222222
{
223223
var sdkDbContext = core.DbContextHelper.GetDbContext();
224-
string timeZone = "Europe/Copenhagen";
224+
var timeZone = "Europe/Copenhagen";
225225
TimeZoneInfo timeZoneInfo;
226226

227227
try
@@ -233,8 +233,8 @@ public static async Task<int> CreateTaskListEform(Core core)
233233
timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("E. Europe Standard Time");
234234
}
235235

236-
Language language = await sdkDbContext.Languages.FirstAsync();
237-
List<Template_Dto> templatesDto = await core.TemplateItemReadAll(false,
236+
var language = await sdkDbContext.Languages.FirstAsync();
237+
var templatesDto = await core.TemplateItemReadAll(false,
238238
"",
239239
"eform-angular-workflow-plugin-tasklist",
240240
false,
@@ -255,7 +255,7 @@ public static async Task<int> CreateTaskListEform(Core core)
255255
return id;
256256
}
257257

258-
MainElement taskListForm = new MainElement
258+
var taskListForm = new MainElement
259259
{
260260
Id = 7680,
261261
Repeated = 0,
@@ -269,7 +269,7 @@ public static async Task<int> CreateTaskListEform(Core core)
269269
EnableQuickSync = true
270270
};
271271

272-
List<DataItem> dataItems = new List<DataItem>
272+
var dataItems = new List<DataItem>
273273
{
274274
new None(
275275
371267,
@@ -350,7 +350,7 @@ public static async Task<int> CreateTaskListEform(Core core)
350350
};
351351

352352

353-
DataElement dataElement = new DataElement(
353+
var dataElement = new DataElement(
354354
142109,
355355
"Hændelse registreret|Incident registered|Vorfall registriert",
356356
0,
@@ -379,7 +379,7 @@ public static async Task<int> CreateTaskListEform(Core core)
379379
public static async Task<int> CreateInstructioneForm(Core core)
380380
{
381381
var sdkDbContext = core.DbContextHelper.GetDbContext();
382-
string timeZone = "Europe/Copenhagen";
382+
var timeZone = "Europe/Copenhagen";
383383
TimeZoneInfo timeZoneInfo;
384384

385385
try
@@ -391,8 +391,8 @@ public static async Task<int> CreateInstructioneForm(Core core)
391391
timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("E. Europe Standard Time");
392392
}
393393

394-
Language language = await sdkDbContext.Languages.FirstAsync();
395-
List<Template_Dto> templatesDto = await core.TemplateItemReadAll(false,
394+
var language = await sdkDbContext.Languages.FirstAsync();
395+
var templatesDto = await core.TemplateItemReadAll(false,
396396
"",
397397
"eform-angular-workflow-plugin-instructions",
398398
false,
@@ -413,7 +413,7 @@ public static async Task<int> CreateInstructioneForm(Core core)
413413
return id;
414414
}
415415

416-
MainElement taskListForm = new MainElement
416+
var taskListForm = new MainElement
417417
{
418418
Id = 7680,
419419
Repeated = 0,
@@ -427,7 +427,7 @@ public static async Task<int> CreateInstructioneForm(Core core)
427427
EnableQuickSync = true
428428
};
429429

430-
List<DataItem> dataItems = new List<DataItem>
430+
var dataItems = new List<DataItem>
431431
{
432432
new None(
433433
371267,
@@ -456,7 +456,7 @@ public static async Task<int> CreateInstructioneForm(Core core)
456456

457457

458458

459-
DataElement dataElement = new DataElement(
459+
var dataElement = new DataElement(
460460
142109,
461461
"Brugervejledning|User Manual|Benutzerhandbuch",
462462
0,

0 commit comments

Comments
 (0)