Exemplo n.º 1
0
        private void Edit()
        {
            if (Index >= 0)
            {
                var teacher = ClassTeacher[Index];
                var context = new TeacherVM(teacher, departments.ToArray());
                var wind    = new NewTeacher()
                {
                    DataContext = context
                };
                wind.DepTwo.Visibility           = System.Windows.Visibility.Collapsed;
                wind.TextBlockDepTwo.Visibility  = System.Windows.Visibility.Collapsed;
                wind.TextBlockPostTwo.Visibility = System.Windows.Visibility.Collapsed;
                wind.PostTwo.Visibility          = System.Windows.Visibility.Collapsed;

                wind.ShowDialog();
                if (wind.DialogResult == true)
                {
                    if (context.Teacher != null)
                    {
                        if (RequestToDataBase.Instance.requestUpdateTeacher(context.Teacher, ClassTeacher, Index))
                        {
                            ClassTeacher[Index] = context.Teacher;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void Add()
        {
            var context = new TeacherVM(departments.ToArray());
            var wind    = new NewTeacher()
            {
                DataContext = context
            };

            wind.ShowDialog();
            if (wind.DialogResult == true)
            {
                bool res = false;
                if (context.Teacher != null)
                {
                    res = RequestToDataBase.Instance.requestInsertIntoTeacher(context.Teacher);
                }
                if (context.Teacher.DepartmentTwo != null && context.Teacher.PostTwo != null)
                {
                    res = RequestToDataBase.Instance.requestInsertIntoTeacherDepartmentTwo(context.Teacher) || res;
                }
                if (res)
                {
                    ClassTeacher.Clear();
                    foreach (var value in RequestToDataBase.Instance.ReadTeachers())
                    {
                        ClassTeacher.Add(value);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void Add()
        {
            var context = new TeacherVM(departments.ToArray());
            var wint    = new NewTeacher()
            {
                DataContext = context
            };

            wint.ShowDialog();
            System.Console.WriteLine(context.Teacher != null);
            if (context.Teacher != null)
            {
                ClassTeacher.Add(context.Teacher);
            }
        }
Exemplo n.º 4
0
 private void Edit()
 {
     if (Index >= 0)
     {
         var teacher = ClassTeacher[Index];
         var context = new TeacherVM(teacher, departments.ToArray());
         var wint    = new NewTeacher()
         {
             DataContext = context
         };
         wint.ShowDialog();
         if (context.Teacher != null)
         {
             ClassTeacher[Index] = context.Teacher;
         }
     }
 }