Skip to content

Commit e91cf1e

Browse files
committed
EXAMPREP-12-AUGUST-2018
1 parent 24b3691 commit e91cf1e

34 files changed

+2243
-0
lines changed
Binary file not shown.

ExamPrep-12-August-2018/SoftJail.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27703.2018
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoftJail", "SoftJail\SoftJail.csproj", "{B3A112C9-15D1-47E6-895D-6D381C436243}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{B3A112C9-15D1-47E6-895D-6D381C436243}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{B3A112C9-15D1-47E6-895D-6D381C436243}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{B3A112C9-15D1-47E6-895D-6D381C436243}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{B3A112C9-15D1-47E6-895D-6D381C436243}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {994022F9-7A30-46DF-BC21-3B62FD63882E}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace SoftJail.Data
2+
{
3+
public static class Configuration
4+
{
5+
public static string ConnectionString = @"Server=.;Database=SoftJail;Trusted_Connection=True";
6+
}
7+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace SoftJail.Data.Models
2+
{
3+
using System.Collections.Generic;
4+
using System.ComponentModel.DataAnnotations;
5+
using System.ComponentModel.DataAnnotations.Schema;
6+
7+
public class Cell
8+
{
9+
public int Id { get; set; }
10+
11+
[Required]
12+
[Range(1, 1000)]
13+
public int CellNumber { get; set; }
14+
15+
[Required]
16+
public bool HasWindow { get; set; }
17+
18+
[ForeignKey(nameof(Department))]
19+
public int DepartmentId { get; set; }
20+
[Required]
21+
public Department Department { get; set; }
22+
23+
public ICollection<Prisoner> Prisoners { get; set; } = new HashSet<Prisoner>();
24+
}
25+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace SoftJail.Data.Models
2+
{
3+
using System.Collections.Generic;
4+
using System.ComponentModel.DataAnnotations;
5+
6+
public class Department
7+
{
8+
public int Id { get; set; }
9+
10+
[Required]
11+
[MinLength(3), MaxLength(25)]
12+
public string Name { get; set; }
13+
14+
public ICollection<Cell> Cells { get; set; } = new HashSet<Cell>();
15+
}
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace SoftJail.Data.Models.Enums
6+
{
7+
public enum Position
8+
{
9+
Overseer,
10+
Guard,
11+
Watcher,
12+
Labour
13+
}
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace SoftJail.Data.Models.Enums
6+
{
7+
public enum Weapon
8+
{
9+
Knife,
10+
FlashPulse,
11+
ChainRifle,
12+
Pistol,
13+
Sniper
14+
}
15+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace SoftJail.Data.Models
2+
{
3+
using System.ComponentModel.DataAnnotations;
4+
using System.ComponentModel.DataAnnotations.Schema;
5+
6+
public class Mail
7+
{
8+
public int Id { get; set; }
9+
10+
[Required]
11+
public string Description { get; set; }
12+
13+
[Required]
14+
public string Sender { get; set; }
15+
16+
[Required]
17+
[RegularExpression(@"^[A-Za-z0-9\s]+?str.$")]
18+
public string Address { get; set; }
19+
20+
[ForeignKey(nameof(Prisoner))]
21+
public int PrisonerId { get; set; }
22+
[Required]
23+
public Prisoner Prisoner { get; set; }
24+
}
25+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
namespace SoftJail.Data.Models
2+
{
3+
using SoftJail.Data.Models.Enums;
4+
using System.Collections.Generic;
5+
using System.ComponentModel.DataAnnotations;
6+
using System.ComponentModel.DataAnnotations.Schema;
7+
8+
public class Officer
9+
{
10+
public int Id { get; set; }
11+
12+
[Required]
13+
[MinLength(3), MaxLength(30)]
14+
public string FullName { get; set; }
15+
16+
[Required]
17+
[Range(typeof(decimal), "0", "79228162514264337593543950335")]
18+
public decimal Salary { get; set; }
19+
20+
[Required]
21+
public Position Position { get; set; }
22+
23+
[Required]
24+
public Weapon Weapon { get; set; }
25+
26+
[ForeignKey(nameof(Department))]
27+
public int DepartmentId { get; set; }
28+
[Required]
29+
public Department Department { get; set; }
30+
31+
public ICollection<OfficerPrisoner> OfficerPrisoners { get; set; } = new HashSet<OfficerPrisoner>();
32+
}
33+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace SoftJail.Data.Models
2+
{
3+
public class OfficerPrisoner
4+
{
5+
public int PrisonerId { get; set; }
6+
public Prisoner Prisoner { get; set; }
7+
8+
public int OfficerId { get; set; }
9+
public Officer Officer { get; set; }
10+
}
11+
}

0 commit comments

Comments
 (0)