Exemplo n.º 1
0
 public static void JsonDeserialization(Practiser practiser, string path)
 {
     using (Stream stream = new FileStream(path, FileMode.OpenOrCreate))
     {
         // Deserialization from JSON
         DataContractJsonSerializer deserializer = new DataContractJsonSerializer(typeof(Practiser));
         Practiser obj = (Practiser)deserializer.ReadObject(stream);
         Console.Write("Object is deserialized");
     }
 }
Exemplo n.º 2
0
     public SchoolWorkerStaff(Practiser practiser)
     {
         schoolWorkerStaff.Add(new SchoolWorker("Ehor", "Muronyik", "male", 27, "Secondary Education",
                                                "librarian", 10000));
         schoolWorkerStaff.Add(new SchoolWorker("Vadim", "Masiyk", "male", 27, "Secondary Education",
                                                "librarian", 10000));
         foreach (Human human in schoolWorkerStaff)
         {
             practiser.PracticeEvent += (f, fargs) => { human.CertificationTrainingSchoolStaff(f, fargs); }
         }
         ;
     }
 }
Exemplo n.º 3
0
 public static void JsonSerialization(Practiser practiser, string path)
 {
     using (Stream stream = new FileStream(path, FileMode.Create))
     {
         DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Practiser));
         ser.WriteObject(stream, practiser);
         stream.Position = 0;
         StreamReader streamReader = new StreamReader(stream);
         Console.WriteLine(streamReader.ReadToEnd());
         stream.Position = 0;
         Practiser result = (Practiser)ser.ReadObject(stream);
     }
 }
Exemplo n.º 4
0
 public TeacherStaff(Practiser practiser)
 {
     teacherStaff[0] = new Teacher("Danya", "Karpenko", "female", 56, "Secondary Education", "teacher", 20000,
                                   "higher", "mathematic");
     teacherStaff[1] = new Teacher("Lena", "Karpenko", "female", 56, "Secondary Education", "teacher", 20000,
                                   "higher", "mathematic");
     practiser.PracticeEvent += delegate(Practiser f, PracticEventArgs fargs)
     {
         for (int i = 0; i < HUMAN_AMOUNT; i++)
         {
             teacherStaff[i].CertificationTrainingSchoolStaff(f, fargs);
         }
     };
 }
Exemplo n.º 5
0
 // Using "Clean code" rule
 // Недвусмысленые имена функции
 abstract public void CertificationTrainingSchoolStaff(Practiser f, PracticEventArgs fargs);
Exemplo n.º 6
0
 // Using "Clean code" rule
 // Недвусмысленые имена функции
 public override void CertificationTrainingSchoolStaff(Practiser f, PracticEventArgs fargs)
 {
     Console.WriteLine("Student can not train ");
 }