Esempio n. 1
0
 public void RemoveTeacher(TeacherGroup teacherGroup)
 {
     if (teacherGroup != null)
     {
         this.TeacherList.Remove(teacherGroup);
     }
 }
Esempio n. 2
0
        //database - check duplicates moved to super
//        public static void CheckDuplicatesInGrid(DataGridView dataGridView, int rowIndex, string revertName)
//        {
//            if (rowIndex < 0) return;
//            string courseNameAfterUpdate = dataGridView[0, rowIndex].CellValue();
//            for (int i = 0; i < dataGridView.RowCount; i++)
//            {
//                if (dataGridView[0, i].CellValue() == courseNameAfterUpdate && i != rowIndex)
//                {
//                    EditorUtilities.ShowWarning(
//                        "Warning: Duplicate course names not allowed, reverting back to previous name");
//                    dataGridView[0, rowIndex].Value = revertName;
//                }
//            }
//        }



        //*****************************************
        // PARSER
        //*****************************************

        public override void ParseCtt(string line)
        {
            var words = GetStringData(line);

            var i = 0;

            CourseCode  = words[i++];
            HoursPerDay = CourseCode.EndsWith("_WK") ? 3 : 2;

            TeacherGroup = new TeacherGroup(words[i++]);
            if (EntityDataBase.TeacherGroups.IndexOf(TeacherGroup) == -1)
            {
                EntityDataBase.TeacherGroups.Add(TeacherGroup);
            }
            LectureSize        = int.Parse(words[i++]);
            MinimumWorkingDays = int.Parse(words[i++]);
            StudentSize        = int.Parse(words[i++]);

            MinimumDate  = ParseDate(words[i++], DateType.Minium);
            DeadlineDate = ParseDate(words[i++], DateType.Maximum);

            MaximumWorkingDays = ParseMaximumValue(words[i++]);

            if (words.Length >= 9)
            {
                IsPcNeeded = bool.Parse(words[i++]);
            }
            if (words.Length >= 10)
            {
                HoursPerDay = int.Parse(words[i++]);
            }
        }
Esempio n. 3
0
 public void AddTeacher(TeacherGroup teacherGroup)
 {
     if (teacherGroup != null)
     {
         this.TeacherList.Add(teacherGroup);
     }
 }
Esempio n. 4
0
 public Course(string courseCode, string teacherGroup, int lectureSize, int minimumWorkingDays, int studentSize)
 {
     CourseCode         = courseCode;
     TeacherGroup       = new TeacherGroup(teacherGroup);
     LectureSize        = lectureSize;
     MinimumWorkingDays = minimumWorkingDays;
     StudentSize        = studentSize;
 }
Esempio n. 5
0
        public void RemoveTeacher(string teachercode)
        {
            TeacherGroup teacherGroup = EntityDataBase.TeacherGroups.FirstOrDefault(t => t.TeacherCode == teachercode);

            if (teacherGroup != null)
            {
                this.TeacherList.Remove(teacherGroup);
            }
        }
Esempio n. 6
0
 //get from database - listbox
 public static TeacherGroup FromDatabase(ListBox listbox)
 {
     if (listbox.SelectedItem != null)
     {
         var teacherCode = listbox.SelectedItem.ToString();
         return(TeacherGroup.FromDatabase(teacherCode));
     }
     return(null);
 }
Esempio n. 7
0
        //get from database - DataGridView
        public static TeacherGroup FromDatabase(DataGridView datagridView, int i = -1)
        {
            if (i == -1)
            {
                if (datagridView.CurrentRow != null)
                {
                    i = datagridView.CurrentRow.Index;
                }
            }
            if (i == -1)
            {
                return(null);
            }

            //new curriculum with code
            string       teachercode  = datagridView[0, i].CellValue();
            TeacherGroup teacherGroup = FromDatabase(teachercode);

            return(teacherGroup);
        }
Esempio n. 8
0
        public override bool FillDataFromGridline(DataGridView dataGridView, int rowIndex)
        {
            var i = 0;

            CourseCode   = dataGridView[i++, rowIndex].CellValue();
            HoursPerDay  = CourseCode.EndsWith("_WK") ? 3 : 2;
            TeacherGroup = new TeacherGroup(dataGridView[i++, rowIndex].CellValue());
            if (EntityDataBase.TeacherGroups.IndexOf(TeacherGroup) == -1)
            {
                EntityDataBase.TeacherGroups.Add(TeacherGroup);
            }
            LectureSize        = int.Parse(dataGridView[i++, rowIndex].CellValue());
            MinimumWorkingDays = int.Parse(dataGridView[i++, rowIndex].CellValue());
            StudentSize        = int.Parse(dataGridView[i++, rowIndex].CellValue());

            MinimumDate  = ParseDate(dataGridView[i++, rowIndex].CellValue(), DateType.Minium);
            DeadlineDate = ParseDate(dataGridView[i++, rowIndex].CellValue(), DateType.Maximum);

            MaximumWorkingDays = ParseMaximumValue(dataGridView[i++, rowIndex].CellValue());

            if (dataGridView[i, rowIndex].CellValue() == null)
            {
                IsPcNeeded = false;
                i++;
            }
            else
            {
                IsPcNeeded = bool.Parse(dataGridView[i++, rowIndex].CellValue());
            }

            if (dataGridView[i, rowIndex].CellValue() != null)
            {
                HoursPerDay = int.Parse(dataGridView[i++, rowIndex].CellValue());
            }

            return(true);
        }
Esempio n. 9
0
        public string Print()
        {
            var maximumWorkingDaysString = MaximumWorkingDays == int.MaxValue ? "/" : MaximumWorkingDays.ToString();
            var MinimumWorkingDaysString = MinimumWorkingDays < 1 ? "/" : MinimumWorkingDays.ToString();
            var minimumDateString        = MinimumDate.Equals(DateTime.MinValue) ? "/         " : MinimumDate.ToString("dd/MM/yyy");
            var deadlineDateString       = DeadlineDate.Equals(DateTime.MaxValue) ? "/         " : DeadlineDate.ToString("dd/MM/yyy");

            string CourseCodeWhitespace  = EditorUtilities.GenerateTrailingWhiteSpace(CourseCode, 16);
            string TeacherCodeWhitespace = EditorUtilities.GenerateTrailingWhiteSpace(TeacherGroup.ToString(), 30);



            string line;

            line =
                CourseCode + CourseCodeWhitespace +
                TeacherGroup + TeacherCodeWhitespace + "\t" +
                LectureSize + " \t" + "\t" +
                MinimumWorkingDaysString + "\t" + "\t" +
                StudentSize + "\t" + "\t" + "\t" +
                minimumDateString + "\t" +
                deadlineDateString + "\t" +
                maximumWorkingDaysString + "\t" + "\t" + "\t" +
                IsPcNeeded + "\t" + "\t" + "\t" +
                HoursPerDay;

            return(line);
        }
Esempio n. 10
0
 protected bool Equals(TeacherGroup other)
 {
     return(string.Equals(TeacherCode, other.TeacherCode));
 }