private void ExecuteFindStudentCommand(object sender) { View.Student.UC_FindStudentScreen findStuent = new View.Student.UC_FindStudentScreen(); findStuent.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; FindStudentViewModel findStudentVM = new FindStudentViewModel(); findStudentVM.SelectedSection = this._selectedSection; findStuent.DataContext = findStudentVM; if (findStuent.ShowDialog() == true) { findStudentVM = findStuent.DataContext as FindStudentViewModel; if (findStudentVM.SelectedStudent != null && findStudentVM.SelectedStudent.StudentId > 0) { CurrentStudent = new S360Model.ChangeDivisionModel() { StudentId = findStudentVM.SelectedStudent.StudentId, RegNo = findStudentVM.SelectedStudent.RegNo, Name = findStudentVM.SelectedStudent.Name, SurName = findStudentVM.SelectedStudent.SurName, Father = findStudentVM.SelectedStudent.Father, AccDetId = findStudentVM.SelectedStudent.AccDetId, OldDivision = findStudentVM.SelectedStudent.Standard + findStudentVM.SelectedStudent.Division }; Result = string.Empty; } } }
private void ExecuteFindStudent(object sender) { UC_FindStudentScreen findStuent = new UC_FindStudentScreen(); findStuent.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; FindStudentViewModel findStudentVM = new FindStudentViewModel(); findStudentVM.SelectedSection = this._selectedSection; findStuent.DataContext = findStudentVM; if (findStuent.ShowDialog() == true) { findStudentVM = findStuent.DataContext as FindStudentViewModel; if (findStudentVM.SelectedStudent != null && findStudentVM.SelectedStudent.StudentId > 0) { CurrentStudent = new DetainStudentModel() { StudentId = findStudentVM.SelectedStudent.StudentId, RegNo = findStudentVM.SelectedStudent.RegNo, Name = findStudentVM.SelectedStudent.Name, SurName = findStudentVM.SelectedStudent.SurName, Father = findStudentVM.SelectedStudent.Father, Section = findStudentVM.SelectedSection.Name, SectionId = findStudentVM.SelectedSection.Section_Id, StandardID = findStudentVM.SelectedStudent.StandardID, Standard = findStudentVM.SelectedStudent.Standard }; IEnumerable <GEN_Standards_Lookup> stds = new StudentBusinessLogic().GetAllStandards(); DetainStd = stds.Where(S => S.Standard_Id == (this.CurrentStudent.StandardID - 1)).FirstOrDefault().Name; OldSection = _sections.Where(Sec => Sec.Section_Id == stds.Where(S => S.Standard_Id == (this.CurrentStudent.StandardID - 1)) .FirstOrDefault().Section_Id).FirstOrDefault(); } } }