Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //create criminals
            Criminal c1 = new Criminal("Oleg Ivanenko", 24, CriminalType.Murder, DateTime.Now, new TimeSpan(4, 0, 0, 0));
            Criminal c2 = new Criminal("Stepan Onyshchenko", 20, CriminalType.Hooliganism, DateTime.Now, new TimeSpan(16, 0, 0));

            //create proxy
            ICase @case = new CaseProxy();

            //trying add new criminals
            @case.AddToDB(c1);
            @case.AddToDB(c2);
        }
Ejemplo n.º 2
0
 public void AddToDB(Criminal criminal)
 {
     if (criminal.ArrestTerm.TotalHours > minArrestTerm.TotalHours)
     {
         @case.AddToDB(criminal);
     }
     else
     {
         Console.WriteLine("There is no need of adding new Case!");
         Console.WriteLine(
             $"Term of arrest: {criminal.ArrestTerm.TotalHours} hours" +
             $"(minimal term: {minArrestTerm.TotalHours} hours)"
             );
     }
 }
Ejemplo n.º 3
0
 public void AddToDB(Criminal criminal)
 {
     Console.WriteLine("Adding new criminal case to database...");
     Console.WriteLine(criminal.ToString());
 }