public List <StudentAssessment> AssessMe(StudentEnrollment student) { FeeService fs = new FeeService(); List <Fee> feeList = new List <Fee>(); Fee FeeforAll = new Fee(); feeList = fs.GetAllFeesForGradeLevel(student.GradeLevel, student.SY); FeeforAll = fs.GetFeeForAll(student.SY); if (FeeforAll.Amount != null) { feeList.Add(FeeforAll); } foreach (Fee f in feeList) { StudentAssessmentBDO sabdo = new StudentAssessmentBDO() { StudentSY = student.StudentSY, FeeID = f.FeeID, DiscountId = student.DiscountId }; sal.AssessStudent(sabdo); } return(GetStudentAssessment(student.StudentId, student.SY)); }
public StudentEnrollment GetStudentEnrolled(string IDNum, string SY) { StudentEnrollment se = new StudentEnrollment(); TranslatEnrolBDOToEnrol(sel.GetStudentEnrolled(IDNum, SY), se); return(se); }
public StudentEnrollment GetEnrolledStudent(string id, string sy) { StudentEnrollment se = new StudentEnrollment(); TranslatEnrolBDOToEnrol(sel.GetStudentEnrolled(id, sy), se); return(se); }
public ActionResult EnrollCourse(int Id, Course model) { bool alreadyEnrolled = false; var course = db.Courses.Single(x => x.Id == Id); var user = db.AspNetUsers.Single(x => x.UserName == User.Identity.Name); List <StudentEnrollment> studentEnrolls = db.StudentEnrollments.ToList(); if (studentEnrolls != null) { foreach (StudentEnrollment s in studentEnrolls) { if (s.AspNetUser == user && s.Course == course) { alreadyEnrolled = true; break; } } } if (!alreadyEnrolled) { StudentEnrollment enrollment = new StudentEnrollment(); enrollment.AspNetUser = user; enrollment.Course = course; enrollment.DateOfEnrollment = DateTime.Now.Date; db.StudentEnrollments.Add(enrollment); db.SaveChanges(); } return(EnrollCourse(course.Id)); }
/// <summary> /// Adds a student to a course. Assumes the student already exists. /// Will not allow more than MaxStudents students. /// </summary> /// <exception cref="AppObjectNotFoundException">Thrown if either the course or the student doesn't exist.</exception> /// <param name="courseID">The ID of the course.</param> /// <param name="SSN">The SSN of the student.</param> /// <returns>A student object.</returns> public StudentDTO AddStudentToCourse(int courseID, string SSN) { //Does the course exist? Course course = _context.Courses.Where(c => c.ID == courseID).SingleOrDefault(); if (course == null) { throw new AppObjectNotFoundException(); } Student student = _context.Students.Where(s => s.SSN == SSN).SingleOrDefault(); if (student == null) { throw new AppObjectNotFoundException(); } //Verify that we won't violate the MaxStudents property int numStudents = _context.StudentEnrollment.Count(se => se.CourseID == courseID && se.IsDeleted == false && se.IsOnWaitingList == false); if (numStudents == course.MaxStudents) { throw new FullCourseException(); } StudentEnrollment studentEnrollment = new StudentEnrollment { StudentID = student.ID, CourseID = courseID, IsOnWaitingList = false, IsDeleted = false }; //Verify that the user isn't already registered.. if (_context.StudentEnrollment.SingleOrDefault(se => se.StudentID == student.ID && se.CourseID == courseID && se.IsDeleted == false && se.IsOnWaitingList == false) != null) { throw new DuplicateCourseRegistrationException(); } //If the user is already on a waiting list, we remove it from the waiting list.. StudentEnrollment enrollment = _context.StudentEnrollment.SingleOrDefault(se => se.StudentID == student.ID && se.CourseID == courseID && se.IsOnWaitingList == true); if (!(enrollment == null)) { _context.StudentEnrollment.Remove(enrollment); } //If the user has already registered on the course but the enrollment has been deleted.. we simply "undelete" it.. enrollment = _context.StudentEnrollment.SingleOrDefault(se => se.CourseID == courseID && se.StudentID == student.ID && se.IsDeleted == true); if (enrollment != null) { enrollment.IsDeleted = false; } else { _context.StudentEnrollment.Add(studentEnrollment); } _context.SaveChanges(); return(new StudentDTO { ID = student.ID, Name = student.Name, SSN = student.SSN }); }
private void frmControlSubjects_Load(object sender, EventArgs e) { IRegistrationService registrationService = new RegistrationService(); string message = String.Empty; ControlStudent = registrationService.GetStudent(controlStudentId, ref message); StudentEnrollment enrStudent = new StudentEnrollment(); SY = GlobalClass.currentsy; enrStudent = registrationService.GetStudentEnrolled(controlStudentId, SY); ISubjectAssignmentService schedService = new SubjectAssignmentService(); sections = new List <GradeSection>(schedService.GetAllSections()); List <GradeSection> gs = new List <GradeSection>(); gs = sections.FindAll(s => s.GradeLevel == ControlStudent.GradeLevel); // cbSection.DataSource = gs; int index = gs.FindIndex(s => s.Section == ControlStudent.Section); gradeSectionCode = gs[index].GradeSectionCode; loadSched(); txtSection.Text = ControlStudent.Section; // cbSection.Text = ControlStudent.Section; txtSY.Text = SY; txtGradeLevel.Text = ControlStudent.GradeLevel; txtStudentId.Text = ControlStudent.StudentId; txtStudentName.Text = ControlStudent.LastName + "," + ControlStudent.FirstName + " " + ControlStudent.MiddleName; txtPrevGPA.Text = ControlStudent.Average.ToString(); txtUnitsFailed.Text = ControlStudent.UnitsFailedLastYear.ToString(); }
public ActionResult EditCourseSchedule(int id) { StudentEnrollment stdmModel = new StudentEnrollment(); try { if (Session[Constant.ConstantFields.courseSchedule] != null) { List <StudentEnrollment> lst = (List <StudentEnrollment>)Session[Constant.ConstantFields.courseSchedule]; for (int i = 0; i < lst.Count; i++) { StudentEnrollment std = lst[i]; if (std.scheduleId == id) { stdmModel = std; TempData[Constant.ConstantFields.scheduleID] = id; TempData[Constant.ConstantFields.courseID] = std.courseId; } } } } catch (Exception ex) { log.Error("Exception ex ", ex); } return(View(stdmModel)); }
public Boolean EnrolStudent(StudentEnrollment studentEnr) { GradeSectionLogic gsl = new GradeSectionLogic(); StudentService ss = new StudentService(); StudentEnrollmentBDO studentBDO = new StudentEnrollmentBDO(); string message = string.Empty; List <GradeSectionBDO> sections = new List <GradeSectionBDO>(); string grade = studentEnr.GradeLevel; sections = (gsl.GetAllSectionsofGrade(grade)); int div = studentEnr.Rank / 20; div++; int index = sections.FindIndex(item => item.Class == div); studentEnr.GradeSectionCode = (int?)sections[index].GradeSectionCode; TranslatEnrolToEnrolBDO(studentEnr, studentBDO); if (sel.RegisterStudent(studentBDO, ref message)) { string section = String.Empty; studentBDO.GradeSectionCode = studentEnr.GradeSectionCode; index = sections.FindIndex(item => item.GradeSectionCode == studentEnr.GradeSectionCode); section = sections[index].Section; ss.UpdateStudent(studentEnr.StudentId, studentEnr.GradeLevel, studentEnr.Rank, section); ControlStudentCharacters(studentBDO); return(true); } else { return(false); } }
public ActionResult EditStudentSchedule(int id) { StudentEnrollment stdmModel = new StudentEnrollment(); List <SelectListItem> studentLst = usrFacade.getStudent(); try { if (Session[Constant.ConstantFields.StudentSchedule] != null) { List <StudentEnrollment> lst = (List <StudentEnrollment>)Session[Constant.ConstantFields.StudentSchedule]; for (int i = 0; i < lst.Count; i++) { StudentEnrollment std = lst[i]; if (std.usrScheduleId == id) { stdmModel = std; stdmModel.studentSelected = (Int16 )std.userId; TempData[Constant.ConstantFields.usrScheduleID] = id; TempData[Constant.ConstantFields.scheduleID] = std.scheduleId; stdmModel.lstStudent = studentLst; //TempData[Constant.ConstantFields.courseID] = std.courseId; break; } } } } catch (Exception ex) { log.Error("Exception ex ", ex); } return(View(stdmModel)); }
public ActionResult Index(int id) { List <StudentEnrollment> lst = null; StudentEnrollment std = null; ScheduleFacade usrSch = new ScheduleFacade(); try { if (Session[ConstantFields.userSession] != null) { User u = (User)Session[ConstantFields.userSession]; if (!usrSch.isUserEnrolled(u.UserID, id)) { return(RedirectToAction("Index", "Home")); } } UserFacade user = new UserFacade(); lst = user.getStudentEnrollmentWithLecturerName(id); if (lst == null || lst.Count == 0) { lst = user.getStudentEnrollmentWithoutLecturerName(id); } std = lst[0]; } catch (Exception ex) { log.Error("Exception ", ex); } return(View(std)); }
public List <StudentEnrollment> getStudentEnrollment(int userId) { List <StudentEnrollment> c = new List <StudentEnrollment>(); JLearnDBEntities db = new JLearnDBEntities(); var query = (from m in db.UserSchedules join n in db.Schedules on m.ScheduleID equals n.ScheduleID join x in db.Courses on n.CourseID equals x.CourseID join a in db.Users on m.UserID equals a.UserID where a.UserID == userId && m.ObsInd == "N" orderby n.StartDate select new { courseCode = x.CourseCode, courseName = x.CourseName, startDate = n.StartDate, endDate = n.EndDate, scheduleId = n.ScheduleID }); try { foreach (var a in query) { StudentEnrollment obj = new StudentEnrollment(); obj.courseCode = a.courseCode; obj.courseName = a.courseName; obj.scheduleId = a.scheduleId; obj.startDate = a.startDate; obj.endDate = a.endDate; c.Add(obj); } } catch (Exception ex) { throw ex; } return(c); }
public ActionResult EditForm(StudentEnrollment std) { try { Schedule sch = new Schedule(); if (TempData[Constant.ConstantFields.scheduleID] != null) { sch.ScheduleID = (int)TempData[Constant.ConstantFields.scheduleID]; } if (TempData[Constant.ConstantFields.courseID] != null) { sch.CourseID = (int)TempData[Constant.ConstantFields.courseID]; } sch.StartDate = std.startDate; sch.EndDate = std.endDate; sch.ObsInd = "N"; schFacade.updateCourseSchedule(sch); CourseSchedule(); } catch (Exception ex) { log.Error("Exception ex", ex); } return(View("CourseSchedule")); }
public ActionResult UpdateGrade(string courseID, string name, string sectionID, string grade, string studentID) { StudentEnrollment s = new StudentEnrollment(courseID, name, sectionID, grade, studentID); TempData["result"] = WebApplication3.Models.AdminDbConnectionClass.updateGrade(s); return(RedirectToAction("AdminHome")); }
/// <summary> /// Adds a student to a course. If the student doesn't exist, it is created. /// </summary> /// <param name="courseID">The ID of the course.</param> /// <param name="studentVM">The student VM.</param> /// <returns>True if successful, false if the course does not exist.</returns> public bool AddStudentToCourse(int courseID, StudentViewModel studentVM) { //Does the course exist? Course course = _context.Courses.Where(c => c.ID == courseID).SingleOrDefault(); if (course == null) { return(false); } Student student = _context.Students.Where(s => s.SSN == studentVM.SSN).SingleOrDefault(); if (student == null) { student = new Student { Name = studentVM.Name, SSN = studentVM.SSN }; _context.Students.Add(student); _context.SaveChanges(); } StudentEnrollment studentEnrollment = new StudentEnrollment { StudentID = student.ID, CourseID = courseID }; _context.StudentEnrollment.Add(studentEnrollment); _context.SaveChanges(); return(true); }
public List <StudentEnrollment> getCourseSchedule() { List <StudentEnrollment> c = new List <StudentEnrollment>(); JLearnDBEntities db = new JLearnDBEntities(); //var query = (from m in db.UserSchedules // join n in db.Schedules on m.ScheduleID equals n.ScheduleID // join x in db.Courses on n.CourseID equals x.CourseID // join a in db.Users on m.UserID equals a.UserID // join role in db.Roles on a.UserID equals role.UserID // where role.Name == "Lecturer" && n.ObsInd == "N" // orderby n.StartDate // select new // { // courseCode = x.CourseCode, // courseName = x.CourseName, // startDate = n.StartDate, // endDate = n.EndDate, // scheduleId = n.ScheduleID, // lecturerName = a.Name, // description = x.Description // }); var query = (from n in db.Schedules join x in db.Courses on n.CourseID equals x.CourseID where n.ObsInd == "N" orderby n.StartDate select new { courseCode = x.CourseCode, courseName = x.CourseName, startDate = n.StartDate, endDate = n.EndDate, scheduleId = n.ScheduleID, courseId = n.CourseID, description = x.Description }); try { foreach (var a in query) { StudentEnrollment obj = new StudentEnrollment(); obj.courseCode = a.courseCode; obj.courseName = a.courseName; obj.scheduleId = a.scheduleId; obj.startDate = a.startDate; obj.endDate = a.endDate; obj.courseId = (int)a.courseId; obj.description = a.description; c.Add(obj); } } catch (Exception ex) { throw ex; } return(c); }
public ActionResult StudentSchedule(string SearchString) { List <StudentEnrollment> lst = null; List <StudentEnrollment> lst1 = null; List <StudentEnrollment> finalLst = new List <StudentEnrollment>(); try { if (SearchString == null || SearchString.Trim().Length == 0) { lst = schFacade.getStudentScheduleByID(0); lst1 = schFacade.getStudentCfmScheduleByID(0); } else { int id = Int32.Parse(SearchString); lst = schFacade.getStudentScheduleByID(id); lst1 = schFacade.getStudentCfmScheduleByID(id); } for (int i = 0; i < lst.Count; i++) { StudentEnrollment s1 = new StudentEnrollment(); s1 = lst[i]; for (int j = 0; j < lst1.Count; j++) { StudentEnrollment s2 = new StudentEnrollment(); s2 = lst1[j]; if (s1.usrScheduleId == s2.usrScheduleId) { s1.studentName = s2.studentName; s1.userId = s2.userId; s1.usrScheduleId = s2.usrScheduleId; break; } } if (s1.studentName != null) { finalLst.Add(s1); } } } catch (Exception ex) { log.Error("Exception ", ex); } Session.Add(Constant.ConstantFields.StudentSchedule, finalLst); return(View(finalLst)); }
public List <StudentEnrollment> getStudentScheduleEnlById(int ID) { List <StudentEnrollment> c = new List <StudentEnrollment>(); JLearnDBEntities db = new JLearnDBEntities(); var query = (from n in db.Schedules join y in db.UserSchedules on n.ScheduleID equals y.ScheduleID join x in db.Courses on n.CourseID equals x.CourseID where n.ObsInd == "N" && y.ObsInd == "N" orderby n.StartDate select new { courseCode = x.CourseCode, courseName = x.CourseName, startDate = n.StartDate, endDate = n.EndDate, scheduleId = n.ScheduleID, courseId = n.CourseID, description = x.Description, userSchID = y.UserScheduleID, userId = y.UserID }); if (ID > 0) { query = query.Where(n => n.scheduleId == ID); } try { foreach (var a in query) { StudentEnrollment obj = new StudentEnrollment(); obj.courseCode = a.courseCode; obj.courseName = a.courseName; obj.scheduleId = a.scheduleId; obj.startDate = a.startDate; obj.endDate = a.endDate; obj.courseId = (int)a.courseId; obj.description = a.description; obj.usrScheduleId = a.userSchID; obj.userId = (int)a.userId; c.Add(obj); } } catch (Exception ex) { throw ex; } return(c); }
private Boolean IsValidEnrollments(StudentEnrollment enrollments) { if (String.IsNullOrWhiteSpace(enrollments.IndexNumber) || String.IsNullOrWhiteSpace(enrollments.FirstName) || String.IsNullOrWhiteSpace(enrollments.LastName) || String.IsNullOrWhiteSpace(enrollments.Studies) || enrollments.BirthDate == null || enrollments.BirthDate.Equals(new DateTime())) { return(false); } return(true); }
public void TranslatEnrolToEnrolBDO(StudentEnrollment se, StudentEnrollmentBDO seb) { seb.StudentSY = se.StudentSY; seb.StudentId = se.StudentId; seb.SY = se.SY; seb.GradeLevel = se.GradeLevel; seb.GradeSectionCode = se.GradeSectionCode; seb.Dismissed = se.Dismissed; seb.Stat = se.Stat; seb.DiscountId = se.DiscountId; seb.Rank = se.Rank; // seb.StudentEnrollmentsID = se.StudentEnrollmentsID }
public List <StudentEnrollment> GetCurrentStudents(string sy) { StudentEnrollmentLogic ser = new StudentEnrollmentLogic(); List <StudentEnrollmentBDO> selbdo = ser.GetEnrolledStudents(sy); List <StudentEnrollment> currentStudents = new List <StudentEnrollment>(); foreach (StudentEnrollmentBDO seb in selbdo) { StudentEnrollment se = new StudentEnrollment(); TranslatEnrolBDOToEnrol(seb, se); currentStudents.Add(se); } return(currentStudents); }
public StudentEnrollment setModel(StudentEnrollment a) { StudentEnrollment obj = new StudentEnrollment(); obj.userId = (int)a.userId; obj.lecturerName = a.lecturerName; obj.usrScheduleId = a.usrScheduleId; obj.scheduleId = (int)a.scheduleId; obj.courseCode = a.courseCode; obj.courseName = a.courseName; obj.endDate = a.endDate; obj.startDate = a.startDate; return(obj); }
public ActionResult LecturerSchedule() { List <StudentEnrollment> lst = null; List <StudentEnrollment> lst1 = null; List <StudentEnrollment> finalLst = new List <StudentEnrollment>(); try { lst = schFacade.getLecturerSchedule(); lst1 = schFacade.getLecturerCfmSchedule(); for (int i = 0; i < lst.Count; i++) { StudentEnrollment s1 = new StudentEnrollment(); s1 = lst[i]; bool recFound = false; for (int j = 0; j < lst1.Count; j++) { StudentEnrollment s2 = new StudentEnrollment(); s2 = lst1[j]; if (s1.scheduleId == s2.scheduleId) { s1.lecturerName = s2.lecturerName; s1.userId = s2.userId; s1.usrScheduleId = s2.usrScheduleId; // break; finalLst.Add(s1); //s1 = new StudentEnrollment(); s1 = schFacade.setModel(s1); recFound = true; } } if (!recFound) { finalLst.Add(s1); } } } catch (Exception ex) { log.Error("Exception ", ex); } Session.Add(Constant.ConstantFields.lecturerSchedule, finalLst); return(View(finalLst)); }
public static void InsertStudentEnrollment(StudentEnrollment studentEnrollment) { try { using (var db = new SMSContext()) { db.StudentEnrollments.Add(studentEnrollment); db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
/// <summary> /// Adds a student to the waiting list of a course. /// </summary> /// <exception cref="AppObjectNotFoundException">Thrown if the course is not found.</exception> /// <exception cref="DuplicateCourseRegistrationException">Thrown if the student is already enrolled to the course or to the waiting list.</exception> /// <param name="courseID">ID of the course.</param> /// <param name="studentID">ID of the student.</param> public void AddStudentToWaitingList(int courseID, StudentViewModel student) { //Check if course exists Course course = _context.Courses.SingleOrDefault(c => c.ID == courseID); if (course == null) { throw new AppObjectNotFoundException(); } int studentID = _context.Students.Where(s => s.SSN == student.SSN).Select(s => s.ID).SingleOrDefault(); if (studentID == 0) { throw new AppObjectNotFoundException(); } //Check to see if the user is already on the waiting list (or registered) StudentEnrollment enrollment = _context.StudentEnrollment.SingleOrDefault(se => se.StudentID == studentID && se.CourseID == courseID && se.IsDeleted == false); if (enrollment != null) { throw new DuplicateCourseRegistrationException(); } //Check if the user was deleted before from the course.. if so, we undelete him and put ont he waitin glist enrollment = _context.StudentEnrollment.SingleOrDefault(se => se.StudentID == studentID && se.CourseID == courseID && se.IsDeleted == true); if (enrollment != null) { enrollment.IsDeleted = false; enrollment.IsOnWaitingList = true; } else { enrollment = new StudentEnrollment { CourseID = courseID, StudentID = studentID, IsOnWaitingList = true, }; _context.StudentEnrollment.Add(enrollment); } _context.SaveChanges(); }
public void TranslateStudentSubjectBDOToStudentSubject(StudentSubjectBDO ssbdo, StudentSubject ss) { SubjectService s = new SubjectService(); Subject sub = new Subject(); s.TranslateSubjectBDOToSubject(ssbdo.Subject, sub); RegistrationService r = new RegistrationService(); StudentEnrollment se = new StudentEnrollment(); r.TranslatEnrolBDOToEnrol(ssbdo.StudentEnrollment, se); ss.StudentEnr = se; ss.Description = sub.Description; ss.FirstPeriodicRating = ssbdo.FirstPeriodicRating; ss.SecondPeriodicRating = ssbdo.SecondPeriodicRating; ss.ThirdPeriodicRating = ssbdo.ThirdPeriodicRating; ss.FourthPeriodicRating = ssbdo.FourthPeriodicRating; ss.FirstEntered = ssbdo.FirstEntered; ss.SecondEntered = ssbdo.SecondEntered; ss.ThirdEntered = ssbdo.ThirdEntered; ss.FourthEntered = ssbdo.FourthEntered; ss.LockFirst = (bool)ssbdo.LockFirst; ss.LockFourth = (bool)ssbdo.LockFourth; ss.LockSecond = (bool)ssbdo.LockSecond; ss.LockThird = (bool)ssbdo.LockThird; ss.FirstLocked = ssbdo.FirstLocked; ss.SecondLocked = ssbdo.SecondLocked; ss.ThirdLocked = ssbdo.ThirdLocked; ss.FourthLocked = ssbdo.FourthLocked; ss.Remarks = ssbdo.Remarks; ss.StudentEnrSubCode = ssbdo.StudentEnrSubCode; ss.StudentEnrSubCode = ssbdo.StudentEnrSubCode; ss.StudentSubjectsID = ssbdo.StudentSubjectsID; ss.StudentSY = ssbdo.StudentSY; ss.SubjectCode = ssbdo.SubjectCode; ss.StudentId = se.StudentId; ss.StudentName = se.StudentName; }
public StudentEnrollment PromoteStudents(PromoteStudentRequest request) { using (var connection = new SqlConnection("Data Source=db-mssql;Initial Catalog=s17179;Integrated Security=True")) using (var command = new SqlCommand()) { command.Connection = connection; connection.Open(); // Powinniśmy upewnić się, że w tabeli Enrollment istnieje wpis o podanej wartości Studies i Semester. // W przeciwnym razie zwracamy błąd 404 Not Found. command.CommandText = "SELECT 1 FROM Enrollment JOIN Studies ON Enrollment.IdStudy = Studies.IdStudy WHERE Semester = @semester AND Studies.Name = @studiesName"; command.Parameters.AddWithValue("semester", request.Semester); command.Parameters.AddWithValue("studiesName", request.Studies); var reader = command.ExecuteReader(); command.Parameters.Clear(); if (!reader.HasRows) { throw new DataException(); } reader.Close(); command.CommandText = "EXEC PromoteStudents @Studies, @Semester"; command.Parameters.AddWithValue("Studies", request.Studies); command.Parameters.AddWithValue("Semester", request.Semester); command.ExecuteNonQuery(); command.Parameters.Clear(); // Na końcu zwracamy kod 201 wraz z zawartością reprezentującą nowy obiekt Enrollment command.CommandText = "SELECT Enrollment.IdEnrollment, Enrollment.Semester, Enrollment.StartDate, Studies.IdStudy, Studies.Name FROM Enrollment JOIN Studies ON Enrollment.IdStudy = Studies.IdStudy WHERE Studies.Name = @studiesName AND Enrollment.Semester = @semester"; command.Parameters.AddWithValue("semester", request.Semester + 1); command.Parameters.AddWithValue("studiesName", request.Studies); reader = command.ExecuteReader(); command.Parameters.Clear(); reader.Read(); var studentEnrollment = new StudentEnrollment(); studentEnrollment.IdEnrollment = (int)reader["IdEnrollment"]; studentEnrollment.Semester = (int)reader["Semester"]; studentEnrollment.StartDate = DateTime.Parse(reader["StartDate"].ToString()); studentEnrollment.Study = new Study { IdStudy = (int)reader["IdStudy"], Name = reader["Name"].ToString() }; return(studentEnrollment); } }
public List <StudentEnrollment> GetStudentEnrollList(int scheduleId, ref List <string> errors) { var conn = new SqlConnection(ConnectionString); var studentEnrollmentList = new List <StudentEnrollment>(); try { var adapter = new SqlDataAdapter(GetStudentEnrollListProcedure, conn); adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.Add(new SqlParameter("@schedule_id", SqlDbType.Int)); adapter.SelectCommand.Parameters["@schedule_id"].Value = scheduleId; var dataSet = new DataSet(); adapter.Fill(dataSet); if (dataSet.Tables[0].Rows.Count == 0) { return(null); } for (var i = 0; i < dataSet.Tables[0].Rows.Count; i++) { var studentEnrollList = new StudentEnrollment { StudentId = dataSet.Tables[0].Rows[i]["student_id"].ToString(), ScheduleId = (int)dataSet.Tables[0].Rows[i]["schedule_id"], CourseId = (int)dataSet.Tables[0].Rows[i]["course_id"], GradeOption = dataSet.Tables[0].Rows[i]["grade_option"].ToString(), PrereqStatus = (int)dataSet.Tables[0].Rows[i]["pre_req_status"] }; studentEnrollmentList.Add(studentEnrollList); } } catch (Exception e) { errors.Add("Error: " + e); } finally { conn.Dispose(); } return(studentEnrollmentList); }
public void TranslatEnrolBDOToEnrol(StudentEnrollmentBDO seb, StudentEnrollment se) { StudentService ss = new StudentService(); Student stu = new Student(); ss.TranslateStudentBDOToStudentDTO(seb.Student, stu); se.StudentSY = seb.StudentSY; se.StudentId = seb.StudentId; se.SY = seb.SY; se.GradeLevel = seb.GradeLevel; se.GradeSectionCode = seb.GradeSectionCode; se.Dismissed = seb.Dismissed; se.Stat = seb.Stat; se.DiscountId = (int)seb.DiscountId; se.StudentName = stu.LastName + ", " + stu.FirstName + " " + stu.MiddleName; se.StudentEnrollmentsID = seb.StudentEnrollmentsID; se.student = stu; }
public List<StudentAssessment> AssessMe(StudentEnrollment student) { FeeService fs = new FeeService(); List<Fee> feeList = new List<Fee>(); feeList = fs.GetAllFeesForGradeLevel(student.GradeLevel, student.SY); feeList.Add(fs.GetFeeForAll(student.SY)); foreach (Fee f in feeList) { StudentAssessmentBDO sabdo = new StudentAssessmentBDO() { StudentSY = student.StudentSY, FeeID = f.FeeID, DiscountId = student.DiscountId }; sal.AssessStudent(sabdo); } return GetStudentAssessment(student.StudentId,student.SY); }
public List <Fee> GetStudentFees(StudentEnrollment student) { FeeService fs = new FeeService(); List <Fee> feeList = new List <Fee>(); //Changed feeList = fs.GetAllFeesForGradeLevel(student.GradeLevel, student.SY); feeList.Add(fs.GetFeeForAll(student.SY)); foreach (Fee f in feeList) { StudentAssessmentBDO sabdo = new StudentAssessmentBDO() { StudentSY = student.StudentSY, FeeID = f.FeeID, DiscountId = student.DiscountId }; } return(feeList); }
public static void UpdateStudentEnrollment(StudentEnrollment studentEnrollment) { try { using (var db = new SMSContext()) { var tempStudentEnrollment = db.StudentEnrollments.Single(x => x.Id == studentEnrollment.Id); tempStudentEnrollment.StudentId = studentEnrollment.StudentId; tempStudentEnrollment.SectionId = studentEnrollment.SectionId; tempStudentEnrollment.SessionId = studentEnrollment.SessionId; tempStudentEnrollment.EnrollmentDate = studentEnrollment.EnrollmentDate; db.SaveChanges(); } } catch (Exception exception) { LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message); } }
public void TranslateStuSubjectsBDOToStuSubjects(StudentSubjectBDO sbdo, StudentSubject s) { SubjectService ss = new SubjectService(); Subject sub = new Subject(); ss.TranslateSubjectBDOToSubject(sbdo.Subject, sub); s.SubjectCode = sbdo.SubjectCode; s.Description = sub.Description; RegistrationService rs = new RegistrationService(); StudentEnrollment se = new StudentEnrollment(); rs.TranslatEnrolBDOToEnrol(sbdo.StudentEnrollment, se); s.StudentEnr = se; s.StudentSY = sbdo.StudentSY; s.StudentId = se.StudentId; s.StudentName = se.StudentName; s.StudentSubjectsID = sbdo.StudentSubjectsID; s.StudentEnrSubCode = sbdo.StudentEnrSubCode; s.Remarks = sbdo.Remarks; s.FirstPeriodicRating = sbdo.FirstPeriodicRating; s.SecondPeriodicRating = sbdo.SecondPeriodicRating; s.ThirdPeriodicRating = sbdo.ThirdPeriodicRating; s.FourthPeriodicRating = sbdo.FourthPeriodicRating; s.Description = sub.Description; s.SubjectAssignments = sbdo.SubjectAssignments; s.FirstEntered = sbdo.FirstEntered; s.FirstLocked = sbdo.FirstLocked; s.FourthEntered = sbdo.FourthEntered; s.FourthLocked = sbdo.FourthLocked; s.LockFirst = sbdo.LockFirst; s.LockFourth = sbdo.LockFourth; s.LockSecond = sbdo.LockSecond; s.LockThird = sbdo.LockThird; s.SecondEntered = sbdo.SecondEntered; s.SecondLocked = sbdo.SecondLocked; s.ThirdEntered = sbdo.ThirdEntered; s.ThirdLocked = sbdo.ThirdLocked; s.FinalRating = (double)sbdo.FourthPeriodicRating; if (s.FinalRating > 90) s.Proficiency = "O"; else if (s.FinalRating >= 85) s.Proficiency = "VS"; else if (s.FinalRating >= 80) s.Proficiency = "S"; else if (s.FinalRating >= 75) s.Proficiency = "FS"; else if (s.FinalRating <= 74) s.Proficiency = "D"; }
private void frmControlSubjects_Load(object sender, EventArgs e) { RegistrationServiceClient registrationService = new RegistrationServiceClient(); string message = String.Empty; ControlStudent = registrationService.GetStudent(controlStudentId,ref message); StudentEnrollment enrStudent = new StudentEnrollment(); SY = GlobalClass.currentsy; enrStudent = registrationService.GetStudentEnrolled(controlStudentId,SY); EnrolMe.StudentSY = controlStudentId + SY; int prev =Int32.Parse(SY.Substring(0,4)); prev--; int sy = Int32.Parse(SY.Substring(5, 4)); sy--; string prevSY = prev.ToString() + "-" + sy.ToString(); string prevRecord = controlStudentId + prevSY; FailedSubjects = new List<StudentSubject>(registrationService.GetFailedSubjects(prevRecord)); StudentSubs = new List<StudentSubject>(registrationService.GetStudentSubjects(EnrolMe.StudentSY)); Schedules = new List<StudentSchedule>(registrationService.GetSubjectSchedules(SY)); if (StudentSubs.Count > 0) { ExistingSchedule = new List<StudentSchedule>(registrationService.GetStudentExistingSchedule(StudentSubs.ToArray(), SY)); } if (ExistingSchedule.Count > 0) { foreach (StudentSchedule ss in ExistingSchedule) { int index = Schedules.FindIndex(item => item.SubjectAssignments == ss.SubjectAssignments); Schedules.RemoveAt(index); //StudentSubject s = new StudentSubject() //{ // StudentSY = controlStudentId + SY, // SubjectCode = ss.SubjectCode, // SubjectAssignments = ss.SubjectAssignments, // StudentEnrSubCode = controlStudentId + SY + ss.SubjectCode, // LockFirst = false, // LockSecond = false, // LockThird = false, // LockFourth = false, // FirstPeriodicRating = 0.00, // SecondPeriodicRating = 0.00, // ThirdPeriodicRating = 0.00, // FourthPeriodicRating = 0.00 //}; //subjects.Add(s); } } gvAllSchedules.DataSource = Schedules; gvFail.DataSource = FailedSubjects; if (ControlStudent.UnitsFailedLastYear == 0 && StudentSubs.Count == 0) { int sectionCode = (int)enrStudent.GradeSectionCode; Schedule = new List<StudentSchedule>(registrationService.GetSubjectsOfSection(sectionCode, SY)); foreach (StudentSchedule sch in Schedule) { StudentSubject ss = new StudentSubject() { StudentSY = controlStudentId + SY, SubjectCode = sch.SubjectCode, SubjectAssignments = sch.SubjectAssignments, StudentEnrSubCode = controlStudentId + SY + sch.SubjectCode, LockFirst = false, LockSecond = false, LockThird = false, LockFourth = false, FirstPeriodicRating = 0.00, SecondPeriodicRating = 0.00, ThirdPeriodicRating = 0.00, FourthPeriodicRating = 0.00 }; subjects.Add(ss); } ControlSchedule = Schedule; GlobalClass.gvDatasource = 1; gvSchedule.DataSource = ControlSchedule; gvSchedule.ReadOnly = false; } else if (StudentSubs.Count > 0) { GlobalClass.gvDatasource = 2; ControlSchedule = ExistingSchedule; gvAllSchedules.ReadOnly = false; gvSchedule.ReadOnly = false; // btnSelect.Enabled = true; gvSchedule.DataSource = ControlSchedule; } else if (ControlStudent.UnitsFailedLastYear > 0) { GlobalClass.gvDatasource = 3; gvAllSchedules.ReadOnly = false; gvSchedule.ReadOnly = false; } txtSection.Text = ControlStudent.Section; txtSY.Text = SY; txtGradeLevel.Text = ControlStudent.GradeLevel; txtStudentId.Text = ControlStudent.StudentId; txtStudentName.Text = ControlStudent.LastName + "," + ControlStudent.FirstName + " " + ControlStudent.MiddleName; txtPrevGPA.Text = ControlStudent.Average.ToString(); txtUnitsFailed.Text = ControlStudent.UnitsFailedLastYear.ToString(); }
public Boolean EnrolStudent(StudentEnrollment studentEnr) { GradeSectionLogic gsl = new GradeSectionLogic(); StudentService ss = new StudentService(); StudentEnrollmentBDO studentBDO = new StudentEnrollmentBDO(); string message = string.Empty; List<GradeSectionBDO> sections = new List<GradeSectionBDO>(); string grade = studentEnr.GradeLevel; sections = (gsl.GetAllSectionsofGrade(grade)); int div = studentEnr.Rank / 20; div++; int index = sections.FindIndex(item => item.Class == div); studentEnr.GradeSectionCode = sections[index].GradeSectionCode; TranslatEnrolToEnrolBDO(studentEnr, studentBDO); if (sel.RegisterStudent(studentBDO, ref message)) { string section = String.Empty; studentBDO.GradeSectionCode = studentEnr.GradeSectionCode; index = sections.FindIndex(item => item.GradeSectionCode == studentEnr.GradeSectionCode); section = sections[index].Section; ss.UpdateStudent(studentEnr.StudentId, studentEnr.GradeLevel, studentEnr.Rank, section); ControlStudentCharacters(studentBDO); return true; } else return false; }
private void AssessStudent_Load(object sender, EventArgs e) { RegistrationServiceClient registrationService = new RegistrationServiceClient(); List<Fee> fees = new List<Fee>(); ScholarshipServiceClient scholarshipService = new ScholarshipServiceClient(); List<RegistrationServiceRef.ScholarshipDiscount> scholarships = new List<RegistrationServiceRef.ScholarshipDiscount>(); currentSY = registrationService.GetCurrentSY(); StudentAssessed = registrationService.GetStudentEnrolled(StudentId, currentSY.SY); txtGradeLevel.Text = StudentAssessed.GradeLevel; txtIDnum.Text = StudentAssessed.StudentId; txtName.Text = StudentAssessed.StudentName; txtSY.Text = currentSY.SY; //scholarshipDiscount = scholarshipService.GetAllScholarshipDiscount(StudentAssessed.DiscountId); //scholarshipDiscount = scholarshipService.GetAllScholarships(); fees = new List<Fee>(registrationService.GetStudentFees(StudentAssessed)); gvAssessment.DataSource = fees; fees.ToArray(); scholarships = new List<RegistrationServiceRef.ScholarshipDiscount>(registrationService.GetScholarshipDiscounts()); int scholarshipDiscountId = StudentAssessed.DiscountId; RegistrationServiceRef.ScholarshipDiscount sd = new RegistrationServiceRef.ScholarshipDiscount(); sd = scholarships.Find(v => v.ScholarshipDiscountId == scholarshipDiscountId); amountTuition = (double)fees[0].Amount; enrollment = (double)fees[1].Amount; // Read Only TextBox tuitionFee.ReadOnly = true; discountPercent.ReadOnly = true; totalTuitionFee.ReadOnly = true; enrollmentFee.ReadOnly = true; enrTotalTuitionFee.ReadOnly = true; subTotal.ReadOnly = true; discountbyAmountSubTotal.ReadOnly = true; Total.ReadOnly = true; // Total Tuition Fee tuitionFee.Text = amountTuition.ToString("0.###"); // Percent Discount double perc = 0; double percRound = 0; double percInitial = 0; perc = (double)sd.Discount; if (sd.Discount == null) { discountPercent.Enabled = false; } else { discountPercent.Text = perc.ToString("0.##"); percRound = perc / 100; if (percRound == 1) { percValue = amountTuition; fullPaymentDisc.ReadOnly = true; } else { percInitial = amountTuition * percRound; percValue = amountTuition - percInitial; } } /* Operations */ // Operation for Percent Discount if not null if (fullPaymentDisc != null) { finalPercentDisc = amountTuition - percValue - fullPaymentDiscount; } else { finalPercentDisc = amountTuition - percValue; } // Total Tuition Fee totalTuitionFee.Text = finalPercentDisc.ToString("0.##"); // Enrollment Fee enrollmentFee.Text = enrollment.ToString(); // Total Tuition Fee enrTotalTuitionFee.Text = finalPercentDisc.ToString("0.##"); // Sub Total subTotalValue = enrollment + finalPercentDisc; subTotal.Text = subTotalValue.ToString("0.##"); // Sub Total discountbyAmountSubTotal.Text = subTotalValue.ToString("0.##"); // Discount by Amount double discByAmout = 0; //discByAmout = discountByAmount // Para ma assess og ma save sa db //var assessments = registrationService.AssessMe(StudentAssessed); //gvAssessment.DataSource = assessments; }
public bool EnrolIrregStudent(StudentEnrollment studentEnr) { GradeSectionLogic gsl = new GradeSectionLogic(); StudentService ss = new StudentService(); StudentEnrollmentBDO studentBDO = new StudentEnrollmentBDO(); TranslatEnrolToEnrolBDO(studentEnr, studentBDO); string message = string.Empty; if (sel.RegisterStudent(studentBDO, ref message)) { string section = String.Empty; int gsc = (int)studentEnr.GradeSectionCode; section = gsl.GetSection(gsc); ss.UpdateStudent(studentEnr.StudentId,studentEnr.GradeLevel,studentEnr.Rank,section); ControlStudentCharacters(studentBDO); return true; } else return false; }
public List<StudentEnrollment> GetCurrentStudents(string sy) { StudentEnrollmentLogic ser = new StudentEnrollmentLogic(); List<StudentEnrollmentBDO> selbdo = ser.GetEnrolledStudents(sy); List<StudentEnrollment> currentStudents = new List<StudentEnrollment>(); foreach (StudentEnrollmentBDO seb in selbdo) { StudentEnrollment se = new StudentEnrollment(); TranslatEnrolBDOToEnrol(seb, se); currentStudents.Add(se); } return currentStudents; }
public StudentEnrollment GetStudentEnrolled(string IDNum, string SY) { StudentEnrollment se = new StudentEnrollment(); TranslatEnrolBDOToEnrol(sel.GetStudentEnrolled(IDNum, SY),se); return se; }
public StudentEnrollment GetEnrolledStudent(string id, string sy) { StudentEnrollment se = new StudentEnrollment(); TranslatEnrolBDOToEnrol(sel.GetStudentEnrolled(id, sy), se); return se; }