コード例 #1
0
        public static void Fill(DataType type, ParserEntity obj)
        {
            try
            {
                switch (type)
                {
                case DataType.Teachers:
                    FillTeachers(((ParsedTeacher)obj).ConvertToDataBaseRep());
                    break;

                case DataType.Students:
                    FillStudents(((ParsedStudent)obj).ConvertToDataBaseRep(), obj);
                    break;

                case DataType.Disciplines:
                    FillDisciplines(((ParsedDiscipline)obj).ConvertToDataBaseRep());
                    break;

                case DataType.None:
                    return;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        private static void FillStudents(Student student, ParserEntity obj)
        {
            if (student.id_of_group == 0)
            {
                student.id_of_group = DataService.InsertIntoGroupsTable(new Group()
                {
                    name   = ((ParsedStudent)obj).group,
                    course = int.Parse(((ParsedStudent)obj).group.Split('-')[1].Substring(0, 1))
                });
            }

            DataService.InsertIntoStudentsTable(student);
        }