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; } } } } }
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); } } } }
private void NuevoProfesor_Click(object sender, EventArgs e) { NewTeacher AddTeacherForm = new NewTeacher(datosBin); AddTeacherForm.ShowDialog(); datosBin.RecargarProfesores(); TablaProfesores.DataSource = datosBin.Profesores; TablaProfesores.Refresh(); }
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); } }
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; } } }