Ejemplo n.º 1
0
        public bool AddFromConsole()
        {
            Console.Write("Input Exam info (Format: Math;95;27.03.2000): ");
            string info = Console.ReadLine();

            try
            {
                string[] vs = info.Split(new char[] { ';' });

                Exam exam = new Exam();
                exam.Title = vs[0];
                exam.Mark  = Convert.ToInt32(vs[1]);

                string[] vs1 = vs[2].Split(new char[] { '.' });
                exam.Date = new DateTime(Convert.ToInt32(vs1[2]), Convert.ToInt32(vs1[1]), Convert.ToInt32(vs1[0]));

                Exams.Add(exam);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
 public void AddExams(Exam[] exams)
 {
     for (int i = 0; i < exams.Length; i++)
     {
         Exams.Add(exams[i]);
     }
 }
Ejemplo n.º 3
0
        public void Add(Model.Model m)
        {
            switch (m.Table)
            {
            case "Educations":
                Educations.Add((Education)m);
                break;

            case "Students":
                Students.Add((Student)m);
                break;

            case "Exams":
                Exams.Add((Exam)m);
                break;

            case "Attempts":
                Attempts.Add((Attempt)m);
                break;
            }

            DataRow dr = dao.Data.Tables[m.Table].NewRow();

            m.FillRow(dr);
            dao.Data.Tables[m.Table].Rows.Add(dr);
            dao.UpdateTable(m.Table);
            m.Data = dr;
            m.AfterCreate();
        }
Ejemplo n.º 4
0
        public bool AddFromConsole()
        {
            string text = "";

            text += "Input values\n";
            text += "Separators: \" \" , \"-\" , \",\" \n";
            text += "[Subject] [Mark] [Date]";
            Console.WriteLine(text);
            string[] data = Console.ReadLine().Split(' ', ',', '-');
            DateTime date;

            try
            {
                date = new DateTime(int.Parse(data[2]));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return(false);
            }
            try
            {
                Exam subject = new Exam(data[0], Convert.ToInt32(data[1]), date);
                Exams.Add(subject);
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine("Wrong data!");
                return(false);
            }
        }
        public async Task <List <Ex> > GetDataCollection()
        {
            // Lấy danh sách kỳ thi
            (await _ExamCategoryServices.GetBase()).Data
            .ForEach(x =>
            {
                var ex = new Ex
                {
                    Exam = x,
                    Scs  = new List <Sc>()
                };

                _SkillCategoryServices.GetBase(x.Id).Data
                .ForEach(y =>
                {
                    var sc = new Sc
                    {
                        Cat   = y,
                        Parts = _SkillPartServices.GetBase(y.Id).Data
                    };
                    ex.Scs.Add(sc);
                });

                Exams.Add(ex);
            });

            return(Exams);
        }
 public ExamsViewModel(IEnumerable <Exam> exams)
 {
     this.exams = exams;
     foreach (Exam exam in this.exams)
     {
         Exams.Add(new ExamViewModel(exam.Patient.Name, exam.Report.ToString(), exam.Date.ToString(CultureInfo.CurrentCulture), exam.Physician.Name));
     }
 }
Ejemplo n.º 7
0
        protected override void ReadRow(DataRow dr)
        {
            data    = dr;
            ID      = (int)dr["id"];
            Title   = (string)dr["title"];
            Created = (DateTime)dr["created_at"];

            Students.Clear();
            Exams.Clear();
            foreach (DataRow cRow in dr.GetChildRows("EducationStudents"))
            {
                Students.Add(new Student(cRow, this));
            }

            foreach (DataRow cRow in dr.GetChildRows("EducationExams"))
            {
                Exams.Add(new Exam(cRow, this));
            }
        }
Ejemplo n.º 8
0
 static void AddNotes()
 {
     while (true)
     {
         //ClearCurrentConsoleLine();
         Console.WriteLine("Entra notas <subjeto*dni*nota> / q - exit");
         string notaText = Console.ReadLine();
         if (notaText == "q")
         {
             Console.Clear();
             break;
         }
         char[]   c1   = { '*' };
         string[] info = notaText.Split(c1);
         if (info.Length < 3)
         {
             Console.WriteLine("Entered data is incorrect. Try again!");
             continue;
         }
         var result = Students.Where(x => x.Dni == info[1]);
         if (result.Count() == 0)
         {
             Console.WriteLine("Error! Este alumno no existe!");
             continue;
         }
         Subject subject;
         //WriteInSubjects();
         var res_subjeto = Subjects.Where(x => x.Name == info[0]);
         if (res_subjeto.Count() == 0)
         {
             subject = new Subject()
             {
                 Name = info[0]
             };
             Subjects.Add(subject);
         }
         else
         {
             subject = res_subjeto.First();
         }
         double nota;
         if (double.TryParse(info[2].Replace(".", ","), out nota))
         {
             //WriteInExams(student, subject, nota);
             //EditExams(student, subject, nota);
             var res_exam = Exams.Where(x => x.Student == result.First() && x.Subject == subject);
             if (res_exam.Count() > 0)
             {
                 Exam exam_exist = res_exam.First();
                 exam_exist.Nota = nota;
             }
             else
             {
                 Exam exam = new Exam()
                 {
                     Student = result.First(), Subject = subject, Nota = nota
                 };
                 Exams.Add(exam);
             }
         }
         else
         {
             Console.WriteLine($"valor introducidio [{notaText}] no válido");
             Console.WriteLine("Entered data is incorrect. Try again!");
             continue;
         }
     }
 }
Ejemplo n.º 9
0
 private void ServiceDataProvider_AddExamNotification(object sender, Events.ExamEventArgs e)
 {
     Exams.Add(e.Exam);
 }