File tree Expand file tree Collapse file tree 7 files changed +113
-0
lines changed
src/Arma.Demo.Core/Processing Expand file tree Collapse file tree 7 files changed +113
-0
lines changed Original file line number Diff line number Diff line change
1
+ namespace Arma . Demo . Core . Processing ;
2
+ public class Package
3
+ {
4
+ public static Guid Key => Guid . NewGuid ( ) ;
5
+ public string Name { get ; set ; }
6
+ }
Original file line number Diff line number Diff line change
1
+ namespace Arma . Demo . Core . Processing ;
2
+ public class Process
3
+ {
4
+ public string Name { get ; set ; }
5
+
6
+ public List < ProcessTask > Tasks { get ; set ; }
7
+ }
Original file line number Diff line number Diff line change
1
+ namespace Arma . Demo . Core . Processing ;
2
+ public class ProcessTask
3
+ {
4
+ public int Step { get ; set ; }
5
+ public string Name { get ; set ; }
6
+ public string Section { get ; set ; }
7
+ public int Duration { get ; set ; }
8
+ }
Original file line number Diff line number Diff line change
1
+ using Arma . Demo . Core . Processing ;
2
+
3
+ namespace Processor ;
4
+ public static class PackageGenerator
5
+ {
6
+ public static Package ApprovalPackage ( ) =>
7
+ new ( ) { Name = "Demo Approval" } ;
8
+ }
Original file line number Diff line number Diff line change
1
+ using Arma . Demo . Core . Processing ;
2
+
3
+ namespace Processor ;
4
+ public static class ProcessGenerator
5
+ {
6
+ public static Process ApprovalProcess ( ) =>
7
+ new ( )
8
+ {
9
+ Name = "Demo Approval Process" ,
10
+ Tasks = new ( )
11
+ {
12
+ new ( )
13
+ {
14
+ Name = "Security Review" ,
15
+ Section = "Cybersecurity" ,
16
+ Step = 1 ,
17
+ Duration = 800
18
+ } ,
19
+ new ( )
20
+ {
21
+ Name = "Legal Review" ,
22
+ Section = "Legal" ,
23
+ Step = 2 ,
24
+ Duration = 1100
25
+ } ,
26
+ new ( )
27
+ {
28
+ Name = "Informal Review" ,
29
+ Section = "Operational Review Board" ,
30
+ Step = 3 ,
31
+ Duration = 500
32
+ } ,
33
+ new ( )
34
+ {
35
+ Name = "Formal Review" ,
36
+ Section = "Command Review Board" ,
37
+ Step = 4 ,
38
+ Duration = 1800
39
+ } ,
40
+ new ( )
41
+ {
42
+ Name = "Final Approval" ,
43
+ Section = "Headquarters Commander" ,
44
+ Step = 5 ,
45
+ Duration = 1000
46
+ }
47
+ }
48
+ } ;
49
+ }
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+
3
+ <ItemGroup >
4
+ <ProjectReference Include =" ..\..\src\Arma.Demo.Core\Arma.Demo.Core.csproj" />
5
+ </ItemGroup >
6
+
7
+ <PropertyGroup >
8
+ <OutputType >Exe</OutputType >
9
+ <TargetFramework >net7.0</TargetFramework >
10
+ <ImplicitUsings >enable</ImplicitUsings >
11
+ <Nullable >enable</Nullable >
12
+ </PropertyGroup >
13
+
14
+ </Project >
Original file line number Diff line number Diff line change
1
+ using Arma . Demo . Core . Processing ;
2
+ using Processor ;
3
+
4
+ Package package = PackageGenerator . ApprovalPackage ( ) ;
5
+
6
+ Console . WriteLine ( $ "Submitting package { package . Name } for approval") ;
7
+
8
+ await Task . Delay ( 1200 ) ;
9
+
10
+ Process process = ProcessGenerator . ApprovalProcess ( ) ;
11
+
12
+ Console . WriteLine ( $ "Package { package . Name } assigned process { process . Name } ") ;
13
+
14
+ foreach ( ProcessTask task in process . Tasks )
15
+ {
16
+ Console . WriteLine ( $ "Current step: { task . Name } ") ;
17
+ await Task . Delay ( task . Duration ) ;
18
+ Console . WriteLine ( $ "Package { package . Name } was approved by { task . Section } ") ;
19
+ }
20
+
21
+ Console . WriteLine ( $ "Package { package . Name } was successfully approved") ;
You can’t perform that action at this time.
0 commit comments