コード例 #1
0
        public void AddTeacher(TeacherModel teacher)
        {
            string teacherID;

            _dal.AddTeacher(teacher, out teacherID);
            teacher.TeacherID = teacherID;
            Teachers.Add(teacher);
            TeacherChangedEvent?.Invoke(OperationType.Add, teacher);
        }
コード例 #2
0
        public void ChangeClass(string className)
        {
            if (!string.IsNullOrEmpty(className))
            {
                //update current class ID
                CurrentClassID = (ClassType)CurrentClassType == ClassType.Regular ?
                                 _regular.RegularClassCollection.Where(c => c.ClassName == className).First().ClassID :
                                 _block.BlockClassCollection.Where(c => c.ClassName == className).First().ClassID;

                //update default teacher ID
                CurrentTeacherID = (ClassType)CurrentClassType == ClassType.Regular ?
                                   _regular.RegularClassCollection.Where(c => c.ClassName == className).First().TeacherID :
                                   _block.BlockClassCollection.Where(c => c.ClassName == className).First().TeacherID;

                //update teacher name in UI
                TeacherChangedEvent?.Invoke(TeacherManagementBussiness.Instance.Teachers.Where(t => t.TeacherID == CurrentTeacherID).First().TeacherName);

                //update trainees
                if ((ClassType)CurrentClassType == ClassType.Regular)
                {
                    _regularTrainees.GetTrainees(CurrentClassID);
                }
                else
                {
                    if (_isUsedForPayment)
                    {
                        _blockTrainees.GetTraineesNotPay(CurrentClassID);
                    }
                    else
                    {
                        _blockTrainees.GetTrainees(CurrentClassID);
                    }
                }
                SelectedClassChangedEvent?.Invoke((ClassType)CurrentClassType == ClassType.Regular ?
                                                  (ClassModel)_regular.RegularClassCollection.Where(c => c.ClassName == className).First() :
                                                  (ClassModel)_block.BlockClassCollection.Where(c => c.ClassName == className).First());
            }
        }
コード例 #3
0
 public void UpdateTeacher(TeacherModel teacher)
 {
     _dal.UpdateTeacher(teacher);
     TeacherChangedEvent?.Invoke(OperationType.Update, teacher, Teachers.Where(t => t.TeacherID == teacher.TeacherID).First());
     Teachers[Teachers.IndexOf(Teachers.Where(t => t.TeacherID == teacher.TeacherID).First())] = teacher;
 }