private void ExecuteDetainStudentCommand(object sender) { StudentBusinessLogic StBusiness = new StudentBusinessLogic(); IEnumerable <STUD_Students_Master> students = (from st in StBusiness.GetAllStudents() join ds in this._detainStudentList on st.Student_ID equals ds.StudentId select st); IEnumerable <STUD_StudentAcademic_Details> accDetails = StBusiness.GetAllStudentsAccademicDetails().Where(S => S.IsActive == true); List <STUD_StudentAcademic_Details> detainstudentsacc = new List <STUD_StudentAcademic_Details>(); IEnumerable <STUD_DetainingOrPromotions_Details> detorpromo = StBusiness.GetAllStudentsDetainOrPromotion(); List <STUD_DetainingOrPromotions_Details> detainorpromotion = new List <STUD_DetainingOrPromotions_Details>(); foreach (STUD_Students_Master detainst in students) { detainstudentsacc.AddRange((from stacc in accDetails where stacc.Student_ID == detainst.Student_ID && stacc.AcademicDet_ID == detainst.CurrentAcaDetail_ID select stacc)); detainorpromotion.AddRange((from dop in detorpromo where dop.Student_ID == detainst.Student_ID && dop.CurrentAcadDetail_ID == detainst.CurrentAcaDetail_ID select dop)); } foreach (DetainStudentModel ds in this._detainStudentList) { detainstudentsacc.Where(S => S.Student_ID == ds.StudentId).Select(A => { A.Section_ID = ds.SectionId; A.Standard_ID = ds.StandardID; return(A); }).ToList(); students.Where(S => S.Student_ID == ds.StudentId).Select(A => { A.CurrentStd_ID = ds.StandardID; return(A); }).ToList(); detainorpromotion.Where(A => A.Student_ID == ds.StudentId).Select(S => { S.Status_ID = 2; //Status for detain S.EnteredBy = S360Model.S360Configuration.Instance.UserID; S.Login_ID = S360Model.S360Configuration.Instance.LoginID; return(S); }).ToList(); } StBusiness.DetainStudents(students, detainstudentsacc, detainorpromotion); }
private void ExecuteChangeDivisionCommand(object sender) { StudentBusinessLogic business = new StudentBusinessLogic(); STUD_Students_Master student = business.GetAllStudents().Where(S => S.Student_ID == this.CurrentStudent.StudentId).FirstOrDefault(); STUD_StudentAcademic_Details Acc = business.GetAllStudentsAccademicDetails().Where(A => A.Student_ID == this.CurrentStudent.StudentId && A.AcademicDet_ID == this.CurrentStudent.AccDetId).FirstOrDefault(); student.CurrentDiv = CurrentStudent.NewDivision.ToUpper(); Acc.Division = CurrentStudent.NewDivision.ToUpper(); business.UpdateStudent(student); business.UpdateStudentAcademics(Acc); //Result = string.Format(SelectedSection.Name.Substring(0, 1) + " " + CurrentStudent.RegNo + " - " + CurrentStudent.Fullname + "\t\t" + "Division Changed from " + CurrentStudent.OldDivision + " to " + CurrentStudent.NewDivision); Result = string.Format("{0} {1} - {2} \t\tDivision changed from {3} to {4}", SelectedSection.Name.Substring(0, 1), CurrentStudent.RegNo, CurrentStudent.Fullname, CurrentStudent.OldDivision, CurrentStudent.NewDivision); }
/// <summary> /// Method to get students with section filter /// </summary> /// <returns></returns> private System.Collections.ObjectModel.ObservableCollection <StudentDataModel> GetStudentsWithCurrentSection() { StudentBusinessLogic business = new StudentBusinessLogic(); System.Collections.ObjectModel.ObservableCollection <StudentDataModel> studentdata = new System.Collections.ObjectModel.ObservableCollection <StudentDataModel>(); try { studentdata = new System.Collections.ObjectModel.ObservableCollection <StudentDataModel>((from st in business.GetAllStudents() join acc in business.GetAllStudentsAccademicDetails() on st.CurrentAcaDetail_ID equals acc.AcademicDet_ID where acc.Section_ID == SectionID && st.IsActive == true select new StudentDataModel() { Student_ID = st.Student_ID, RegNo = st.RegNo, Gender = st.Gender, Surname = st.Surname, Name = st.Name, FatherName = st.FatherName, MotherName = st.MotherName, CurrentStd_ID = st.CurrentStd_ID, Standard = business.GetAllStandards().Where(S => S.Standard_Id == st.CurrentStd_ID).FirstOrDefault().Name, CurrentDiv = st.CurrentDiv, Address = st.Address, DOB = st.DOB, AadharNo = st.Address, Caste = st.Caste, Category_ID = st.Category_ID, CurrentAcaDetail_ID = st.CurrentAcaDetail_ID, Email = st.Email, HomePh = st.HomePh, Mobile1 = st.Mobile1, Mobile2 = st.Mobile2, Mobile3 = st.Mobile3, MotherTongue = st.MotherTongue, PrimaryContact = st.PrimaryContact, WorkPh = st.WorkPh, Religion = st.Religion }).Distinct()); } catch (S360Exceptions.S360Exception ex) { S360Logging.S360Log.Instance.Log(NLog.LogLevel.Error, "Section Id not supplied while calling Student Data screen", ex.InnerException, null); } finally { business = null; } return(studentdata); }
private void ExecuteSearchCommand(object sender) { StudentBusinessLogic studentBussiness = new StudentBusinessLogic(); _studentsList.Clear(); //System.Collections.Generic.IEnumerable<STUD_Students_Master> students = studentBussiness.GetStudentsBySearchStringAndSection // (this._findString, this.SelectedSection.Section_Id); System.Collections.Generic.IEnumerable <STUD_Students_Master> students = (from st in studentBussiness.GetAllStudents() join ac in studentBussiness.GetAllStudentsAccademicDetails() on st.CurrentAcaDetail_ID equals ac.AcademicDet_ID where st.Name.ToUpper().Contains(this._findString.ToUpper()) && ac.Section_ID == this.SelectedSection.Section_Id && st.IsActive == true select st).Distinct <STUD_Students_Master>(); if (students == null || students.Count() < 1) { WPFCustomMessageBox.CustomMessageBox.Show("Could Not Find Any Student"); this._findString = string.Empty; } else { foreach (STUD_Students_Master st in students) { _studentsList.Add(new PromoteStudentModel() { Division = st.CurrentDiv, Father = st.FatherName, AccDetId = (long)st.CurrentAcaDetail_ID, Name = st.Name, RegNo = st.RegNo, SatusID = 0, Section = this.SelectedSection.Name, SectionId = this.SelectedSection.Section_Id, Standard = studentBussiness.GetAllStandards().Where(S => S.Standard_Id == st.CurrentStd_ID).FirstOrDefault().Name, StandardID = (short)st.CurrentStd_ID, StudentId = (long)st.Student_ID, SurName = st.Surname }); } } }