private void ExecuteAddToListCommand(object sender) { StudentBusinessLogic stBusiness = new StudentBusinessLogic(); IEnumerable <GEN_Standards_Lookup> standards = stBusiness.GetAllStandards(); _currentStudent.StandardID = (_currentStudent.StandardID == 1) ? (short)102 : (short)(_currentStudent.StandardID - 1); _currentStudent.Standard = standards.Where(S => S.Standard_Id == _currentStudent.StandardID).FirstOrDefault().Name; _currentStudent.SectionId = (short)standards.Where(S => S.Standard_Id == _currentStudent.StandardID).FirstOrDefault().Section_Id; _currentStudent.Section = stBusiness.GetAllSections().Where(S => S.Section_Id == _currentStudent.SectionId).FirstOrDefault().Name; this.DetainStudentList.Add(this._currentStudent); //this.DetainStudentList.Add(new DetainStudentModel() //{ // StudentId = _currentStudent.StudentId, // RegNo = _currentStudent.RegNo, // Name = _currentStudent.Name, // SurName = _currentStudent.SurName, // Father = _currentStudent.Father, // SectionId = _currentStudent.SectionId, // Section = _currentStudent.Section, // StandardID = _currentStudent.StandardID, // Standard = _currentStudent.Standard, // User = _currentStudent.User //}); }
private void ExecuteFindStudentWithGRCommand(object obj) { if (String.IsNullOrEmpty(SelectedSection.Name)) { WPFCustomMessageBox.CustomMessageBox.ShowOK("Please Select Any Section", "Warning", "OK"); return; } 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; Result = string.Empty; } else { CurrentStudent = new S360Model.ChangeDivisionModel() { StudentId = student.StudentId, RegNo = student.RegNo, Name = student.Name, SurName = student.SurName, Father = student.Father, AccDetId = student.AccDetId, OldDivision = student.Standard + student.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(); } } }
private void ExecuteRemoveStudentCommand(object sender) { StudentBusinessLogic business = new StudentBusinessLogic(); STUD_Students_Master student = business.GetAllStudents().Where(S => S.IsActive == true && S.Student_ID == CurrentStudent.StudentId).FirstOrDefault(); student.IsActive = false; STUD_DetainingOrPromotions_Details DetOrPro = new STUD_DetainingOrPromotions_Details() { Student_ID = CurrentStudent.StudentId, CurrentAcadDetail_ID = CurrentStudent.AccDetId, LastAcadDetail_ID = CurrentStudent.AccDetId, Status_ID = 3, //Status id for TC issue EnteredBy = S360Model.S360Configuration.Instance.UserID, Login_ID = S360Model.S360Configuration.Instance.LoginID }; STUD_Student_TC TC = new STUD_Student_TC() { Student_ID = CurrentStudent.StudentId, RegNo = CurrentStudent.RegNo, IssuedOn = DateTimeOffset.Now, IssuedBy_ID = S360Model.S360Configuration.Instance.UserID, Login_ID = S360Model.S360Configuration.Instance.LoginID }; business.UpdateStudent(student); business.SaveStudentDetainPromotion(DetOrPro); business.SaveIssueTC(TC); ExecuteClearAllCommand(null); }
private void ExecuteFindStudentWithGRCommand(object obj) { if (String.IsNullOrEmpty(SelectedSection.Name)) { WPFCustomMessageBox.CustomMessageBox.ShowOK("Please Select Any Section", "Warning", "OK"); return; } S360Model.PromoteStudentModel student = new StudentBusinessLogic().GetStudentWithRegNoAndSection(this.CurrentChequeInwardModel.RegNo, this.SelectedSection.Section_Id); if (student == null) { WPFCustomMessageBox.CustomMessageBox.ShowOK("No Records Found", "Message", "OK"); this.CurrentChequeInwardModel.RegNo = string.Empty; this.CurrentChequeInwardModel = null; } else { CurrentChequeInwardModel = new ChequeInwardsModel() { Student_ID = student.StudentId, RegNo = student.RegNo, StudentName = student.Name + " " + student.SurName + " " + student.Father, Section_ID = student.SectionId, Section = student.Section, ChequeNo = "000000", ChqAmount = 0 }; } }
/// <summary> /// Converts the input ChequeMaster object to its model object type /// </summary> /// <param name="cheque"></param> /// <returns></returns> private ChequeInwardsModel ConvertToCheque(CHQ_Cheques_Master cheque, int SerialNo) { if (cheque == null) { return(new ChequeInwardsModel()); } StudentBusinessLogic bussiness = new StudentBusinessLogic(); //STUD_Students_Master student = bussiness.GetAllStudents().Where(S => S.Student_ID == cheque.Student_ID).FirstOrDefault(); //GEN_Sections_Lookup sec = bussiness.GetAllSections().Where(S => S.Section_Id == cheque.Section_ID).FirstOrDefault(); ChequeInwardsModel cheq = new ChequeInwardsModel(); cheq.SerialNo = SerialNo; cheq.Student_ID = cheque.Student_ID; cheq.Bank = cheque.Bank; cheq.ChequeNo = cheque.ChequeNo; cheq.Cheque_ID = cheque.Cheque_ID; cheq.ChqAmount = cheque.ChqAmount; cheq.ChqStatus_ID = cheque.ChqStatus_ID; cheq.EnteredBy = cheque.EnteredBy; cheq.EnteredOn = cheque.EnteredOn; cheq.InwardDate = cheque.InwardDate; cheq.IsActive = cheque.IsActive; cheq.Login_ID = cheque.Login_ID; cheq.Remarks = cheque.Remarks; cheq.Section_ID = cheque.Section_ID; cheq.RegNo = CurrentChequeInwardModel.RegNo; cheq.StudentName = CurrentChequeInwardModel.StudentName; cheq.Section = CurrentChequeInwardModel.Section; cheq.User = LoginBusinessLogic.GetUserByID(LoginBusinessLogic.GetUserIdByLoginId((decimal)cheque.Login_ID)).Username; return(cheq); }
private void ExecuteFindStudentWithGRCommand(object obj) { if (String.IsNullOrEmpty(SelectedSection.Name)) { WPFCustomMessageBox.CustomMessageBox.ShowOK("Please Select Any Section", "Warning", "OK"); return; } S360Model.PromoteStudentModel student = new StudentBusinessLogic().GetStudentWithRegNoAndSection(this.CurrentChequeInwardModel.RegNo, this.SelectedSection.Section_Id); if (student == null) { WPFCustomMessageBox.CustomMessageBox.ShowOK("No Records Found", "Message", "OK"); this.CurrentChequeInwardModel.RegNo = string.Empty; this.CurrentChequeInwardModel = null; } else { CurrentChequeInwardModel.Student_ID = student.StudentId; CurrentChequeInwardModel.StudentName = student.Name + " " + student.SurName + " " + student.Father; CurrentChequeInwardModel.RegNo = student.RegNo; CurrentChequeInwardModel.Section_ID = student.SectionId; CurrentChequeInwardModel.Section = student.Section; RaisePropertyChanged("CurrentChequeInwardModel"); ChequeBusinessLogic business = new ChequeBusinessLogic(); IEnumerable <CHQ_Cheques_Master> cheques = business.GetAllCheques().Where(C => C.Student_ID == student.StudentId && C.ChqStatus_ID == 1 /*Chq Recieved*/ && C.IsActive == true); int serialNo = 1; foreach (CHQ_Cheques_Master chq in cheques) { this.ChequeList.Add(ConvertToCheque(chq, serialNo++)); } } }
/// <summary> /// Converts the input ChequeMaster object to its temp object type /// </summary> /// <param name="cheque"></param> /// <returns></returns> private object ConvertToCheque(object chq, bool IsTemp = false) { if (!IsTemp) { CHQ_Cheques_Master_Temp cheque = chq as CHQ_Cheques_Master_Temp; if (cheque == null) { return(new ChequeInwardsModel()); } StudentBusinessLogic bussiness = new StudentBusinessLogic(); STUD_Students_Master student = bussiness.GetAllStudents().Where(S => S.Student_ID == cheque.Student_ID).FirstOrDefault(); GEN_Sections_Lookup sec = bussiness.GetAllSections().Where(S => S.Section_Id == cheque.Section_ID).FirstOrDefault(); ChequeInwardsModel cheq = new ChequeInwardsModel(); cheq.Student_ID = cheque.Student_ID; cheq.Bank = cheque.Bank; cheq.ChequeNo = cheque.ChequeNo; cheq.Cheque_ID = cheque.Cheque_ID; cheq.ChqAmount = cheque.ChqAmount; cheq.ChqStatus_ID = cheque.ChqStatus_ID; cheq.EnteredBy = cheque.EnteredBy; cheq.EnteredOn = cheque.EnteredOn; cheq.InwardDate = cheque.InwardDate; cheq.IsActive = cheque.IsActive; cheq.Login_ID = cheque.Login_ID; cheq.Remarks = cheque.Remarks; cheq.Section_ID = cheque.Section_ID; cheq.RegNo = student.RegNo; cheq.StudentName = student.Name + " " + student.Surname + " " + student.FatherName; cheq.Section = sec.Name; cheq.User = S360Model.S360Configuration.Instance.User; return(cheq); } else { CHQ_Cheques_Master cheque = chq as CHQ_Cheques_Master; if (cheque == null) { return(new CHQ_Cheques_Master_Temp()); } CHQ_Cheques_Master_Temp cheq = new CHQ_Cheques_Master_Temp(); cheq.Student_ID = cheque.Student_ID; cheq.Bank = cheque.Bank; cheq.ChequeNo = cheque.ChequeNo; cheq.Cheque_ID = cheque.Cheque_ID; cheq.ChqAmount = cheque.ChqAmount; cheq.ChqStatus_ID = cheque.ChqStatus_ID; cheq.EnteredBy = cheque.EnteredBy; cheq.EnteredOn = cheque.EnteredOn; cheq.InwardDate = cheque.InwardDate; cheq.IsActive = cheque.IsActive; cheq.Login_ID = cheque.Login_ID; cheq.Remarks = cheque.Remarks; cheq.Section_ID = cheque.Section_ID; return(cheq); } }
/// <summary> /// StudentViewModel Constructor /// </summary> public StudentViewModel() { studentBusinessLogic = new StudentBusinessLogic(); this.Sections = studentBusinessLogic.GetAllSections(); this.Religions = studentBusinessLogic.GetAllStudentReligion(); this.Languages = studentBusinessLogic.GetAllLanguages(); this.StudentCategorys = studentBusinessLogic.GetAllStudentCategory(); }
/// <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 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); }
public StudentController() { if (_commonBusinessLogic == null) { _commonBusinessLogic = new CommonBusinessLogic(); } if (_studentBusinessLogic == null) { _studentBusinessLogic = new StudentBusinessLogic(); } if (_adminBusinessLogic == null) { _adminBusinessLogic = new AdminBusinessLogic(); } }
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); }
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; } }
private void Button_Click(object sender, RoutedEventArgs e) { StudentBusinessLogic test = new StudentBusinessLogic(); var testing = test.FirstStudent(); firstname.Text = testing.Name; FatherName.Text = testing.FatherName; RegNo.Text = testing.RegNo; ////try ////{ //// S360Log.Instance.Debug("We're going to throw an exception now."); //// S360Log.Instance.Warn("It's gonna happen!!"); //// throw new ApplicationException(); ////} ////catch (ApplicationException ae) ////{ //// S360Log.Instance.ErrorException("Error doing something...", ae); ////} }
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 }); } } }