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(); } } }
private bool CanExecuteRemoveCommand(object sender) { DetainStudentModel detainStudent = this.DetainStudentList.Where(S => S.StudentId == this.CurrentRemovableStudent.StudentId).FirstOrDefault(); if (detainStudent != null) { return(true); } return(false); }
private bool CanExecuteAddToListCommand(object sender) { if (string.IsNullOrEmpty(this._currentStudent.Name)) { return(false); } DetainStudentModel existingStudent = this.DetainStudentList.Where(S => S.StudentId == this.CurrentStudent.StudentId).FirstOrDefault(); if (existingStudent != null) { return(false); } return(true); }
private void ExecuteFindStudentWithGRCommand(object obj) { if (String.IsNullOrEmpty(SelectedSection.Name)) { WPFCustomMessageBox.CustomMessageBox.ShowOK("Please Select Any Section", "Warning", "OK"); return; } //StudentBusinessLogic business = new StudentBusinessLogic(); //STUD_Students_Master student = (from st in business.GetAllStudents() // join ac in business.GetAllStudentsAccademicDetails() on st.CurrentAcaDetail_ID equals ac.AcademicDet_ID // where st.RegNo.ToUpper() == this._currentStudent.RegNo.ToUpper() && ac.Section_ID == this.SelectedSection.Section_Id && st.IsActive == true // select st).Distinct<STUD_Students_Master>().FirstOrDefault(); S360Model.PromoteStudentModel student = new StudentBusinessLogic().GetStudentWithRegNoAndSection(this.CurrentStudent.RegNo, this.SelectedSection.Section_Id); if (student == null) { WPFCustomMessageBox.CustomMessageBox.ShowOK("No Records Found", "Message", "OK"); this.CurrentStudent.RegNo = string.Empty; this.CurrentStudent = null; OldSection = null; DetainStd = null; } else { IEnumerable <GEN_Standards_Lookup> stds = new StudentBusinessLogic().GetAllStandards(); CurrentStudent = new DetainStudentModel() { StudentId = student.StudentId, RegNo = student.RegNo, Name = student.Name, SurName = student.SurName, Father = student.Father, Section = SelectedSection.Name, SectionId = SelectedSection.Section_Id, StandardID = student.StandardID, Standard = student.Standard }; OldSection = _sections.Where(Sec => Sec.Section_Id == stds.Where(S => S.Standard_Id == (this.CurrentStudent.StandardID - 1)) .FirstOrDefault().Section_Id).FirstOrDefault(); DetainStd = stds.Where(S => S.Standard_Id == (this.CurrentStudent.StandardID - 1)).FirstOrDefault().Name; } }