public void TranslateSAToLoadStudentSchedule(SubjectAssignment sab, StudentSchedule sa) { sa.GradeSection = sab.GradeSection; sa.Section = sab.Section; sa.GradeLevel = sab.GradeLevel; sa.Class = sab.Class; sa.Room = sab.Room; sa.RoomCode = sab.RoomCode; sa.Subject = sab.Subject; sa.Teacher = sab.Teacher; sa.TeacherName = sab.TeacherName; sa.Timeslot = sab.Timeslot; sa.Timestart = sab.Timestart; sa.TimeEnd = sab.TimeEnd; sa.Days = sab.Days; sa.Deactivated = sab.Deactivated; sa.GradeSectionCode = sab.GradeSectionCode; sa.RoomId = sab.RoomId; sa.SubjectCode = sab.SubjectCode; sa.SY = sab.SY; sa.TeacherId = sab.TeacherId; sa.TimeSlotCode = sab.TimeSlotCode; sa.SubjectInfo = sa.SubjectInfo; sa.SubjectDescription = sa.SubjectDescription; }
public void AcceptScheduleResponse(int mid, int stuid, int subid, int mshipid) { List <MentorScheduleRequest> msrList = (from r in context.MentorScheduleRequests where r.fk_mentor_Id == mid & r.Mentorship.id == mshipid select r).ToList(); List <MentorSchedule> msList = (from r in context.MentorSchedules where r.fk_mentor_Id == mid select r).ToList(); List <StudentSchedule> ssList = (from r in context.StudentSchedules where r.fk_student_Id == stuid select r).ToList(); foreach (MentorScheduleRequest msr in msrList) { Mentorship mship = msr.Mentorship; mship.status = 2;//accepted if (msr.isRequested == 1) { MentorSchedule ms = (from m in msList where m.fk_day_Id == msr.fk_day_Id & m.fk_time_id == msr.fk_time_id select m).FirstOrDefault(); /*if(ms.fk_mentorship_id != null){ * throw new Exception(); * }*/ ms.fk_mentorship_id = msr.fk_mentorship_id; StudentSchedule ss = (from m in ssList where m.fk_day_Id == msr.fk_day_Id & m.fk_time_id == msr.fk_time_id select m).FirstOrDefault(); ss.fk_mentorship_id = msr.fk_mentorship_id; } } context.SaveChanges(); }
public static void Main() { String myJson = @"{ 'morning': [ { 'name': 'Morning Student 1', 'id': '123456', 'status': '0' } ], 'afternoon': [ { 'name': 'Afternoon Student 1', 'id': '123456', 'status': '0' } ] }"; StudentSchedule studentSchedule = JsonConvert.DeserializeObject <StudentSchedule>(myJson); Console.WriteLine("========== MORNING ==========="); foreach (Student student in studentSchedule.morning) { Console.WriteLine(student); } Console.WriteLine("========== AFTERNOON ==========="); foreach (Student student in studentSchedule.afternoon) { Console.WriteLine(student); } }
public ActionResult Edit(StudentSchedule studentSchedule, string Id) { StudentSchedule studentScheduleToEdit = context.Find(Id); if (studentSchedule == null) { return(HttpNotFound()); } else { if (!ModelState.IsValid) { return(View(studentSchedule)); } studentScheduleToEdit.c_code = studentSchedule.c_code; studentScheduleToEdit.professor = studentSchedule.professor; studentScheduleToEdit.day = studentSchedule.day; studentScheduleToEdit.time = studentSchedule.time; studentScheduleToEdit.room = studentSchedule.room; context.Commit(); return(RedirectToAction("Index")); } }
private void cbEditor_ValueChanged(object sender, EventArgs e) { int i = gvSchedule.CurrentRow.Index; StudentSchedule sa = Schedules[i]; RadCheckBoxEditor cbEditor = sender as RadCheckBoxEditor; if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor.Value == Telerik.WinControls.Enumerations.ToggleState.On) { int index = -1; index = ControlSched.FindIndex(item => item.TimeSlotCode.Substring(0, 2) == sa.TimeSlotCode.Substring(0, 2)); if (index == -1) { Schedules[i].Selected = true; AddToSched.Add(Schedules[i]); } else { MessageBox.Show(this, "Schedule Selected is Conflicting. Select another schedule"); cbEditor.Value = Telerik.WinControls.Enumerations.ToggleState.Off; } } else if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor.Value == Telerik.WinControls.Enumerations.ToggleState.Off) { AddToSched.Remove(sa); } }
public List <StudentSchedule> GetSchedules(string sy) { List <SubjectAssignment> schedList = new List <SubjectAssignment>(); schedList = GetAllSchedules(sy); List <StudentSchedule> studSched = new List <StudentSchedule>(); foreach (SubjectAssignment sab in schedList) { int index = -1; index = studSched.FindIndex(item => item.SubjectCode == sab.SubjectCode && item.GradeSectionCode == sab.GradeSectionCode); if (index == -1) { StudentSchedule sa = new StudentSchedule(); TranslateSAToLoadStudentSchedule(sab, sa); sa.SubjectAssignments = sab.SubjectAssignmentsID.ToString(); sa.TimeslotInfo = sab.TimeslotInfo; studSched.Add(sa); } else { studSched[index].SubjectAssignments += " " + sab.SubjectAssignmentsID.ToString(); studSched[index].TimeslotInfo += " " + sab.TimeslotInfo; } } return(studSched); }
public ActionResult DeleteConfirmed(int id) { StudentSchedule studentSchedule = db.StudentSchedules.Find(id); db.StudentSchedules.Remove(studentSchedule); db.SaveChanges(); return(RedirectToAction("Index")); }
private void button_Shedule_Click(object sender, EventArgs e) { StudentSchedule schedule = new StudentSchedule(student); schedule.RefToFormStudentMenu = this; schedule.Show(); this.Hide(); }
public async Task <ApiResult <PagedResult <StudentSchedule> > > GetPagingBySchedule(int id_Schedule) { var queryStudentSchedule = from s in _context.Schedules join c in _context.Courses on s.Id_Course equals c.Id_Course join rc in _context.RegisterCourses on c.Id_Course equals rc.Id_Course join st in _context.Students on rc.Id_Student equals st.Id where s.Id_Schedule == id_Schedule select new { s, st }; var dataStudentSchedule = await queryStudentSchedule.Select(x => new StudentSchedule() { Id_Student = x.st.Id, Name = x.st.FullName, Date = x.s.Date, Status = false }).ToListAsync(); var queryStudentAttdendace = from s in _context.Schedules join ha in _context.HistoryAttendances on s.Id_Schedule equals ha.Id_Schedule join d in _context.DetailHAs on ha.Id_HistoryAttendace equals d.Id_HistoryAttendance join st in _context.Students on d.Id_Student equals st.Id where s.Id_Schedule == id_Schedule select new { s, d, st }; var dataStudentAttdendace = await queryStudentAttdendace.Select(x => x.st.Id).ToListAsync(); var data = new List <StudentSchedule>(); foreach (var item in dataStudentSchedule) { int check = dataStudentAttdendace.IndexOf(item.Id_Student); if (check == -1) { data.Add(item); } else { var user = new StudentSchedule() { Id_Student = item.Id_Student, Name = item.Name, Date = item.Date, Status = true }; data.Add(user); } } var totalRow = dataStudentSchedule.Count(); var pagedResult = new PagedResult <StudentSchedule>() { TotalRecords = totalRow, PageSize = totalRow, PageIndex = 1, Items = data }; return(new ApiSuccessResult <PagedResult <StudentSchedule> >(pagedResult)); }
/// <summary> /// Convert StudentSchedule into StudentScheduleDAO. /// </summary> /// <param name="studentSchedule">The StudentSchedule to convert.</param> /// <returns>The StudentScheduleDAO.</returns> public static StudentScheduleDAO MapToStudentScheduleDAO(StudentSchedule studentSchedule) { return(new StudentScheduleDAO { CourseSchedule = MapToCourseScheduleDAO(studentSchedule.CourseSchedule), Student = MapToStudentDAO(studentSchedule.Student), Enrolled = studentSchedule.Enrolled }); }
public ActionResult Index([Bind(Include = "StudentScheduleGeneratorId,StudentNumber,StartTerm,DepartmentName,ProgramOptionName,IncludeSummer,DateGenerated")] StudentScheduleGenerator generator) { int?studentId = StudentController.LoggedInStudentID; generator.StudentNumber = db.Students.Find(studentId).StudentNumber; generator.DateGenerated = DateTime.Now; db.StudentScheduleGenerators.Add(generator); //Object containing course sequences, initialize once Programs p = new Programs(); //Scheduler object, first parameter is student (change to logged in student), second parameter is the program option (from Programs object). Scheduler s = new Scheduler(db.Students.Find(StudentController.LoggedInStudentID), Programs.SOEN_General); //Generate a schedule. Argument is semester. If fall, you get fall and winter schedule. If winter, only winter schedule if (generator.StartTerm == "Fall 2015") { s.GenerateSchedule(Semester.Fall); //LAY: if starting term is fall, put Semester.Fall. If winter, put Semester.Winter } else if (generator.StartTerm == "Winter 2016") { s.GenerateSchedule(Semester.Winter); } else { s.GenerateSchedule(Semester.Summer); } //Once generated, retrieve the list of scheduled sections. These are the sections to put on the schedule. List <Section> sectionsFall = s.ScheduledSectionsFall; List <Section> sectionsWinter = s.ScheduledSectionsWinter; List <StudentSchedule> scheduleList = new List <StudentSchedule>(); foreach (var item in sectionsFall) { StudentSchedule schedule = new StudentSchedule(); schedule.StudentId = studentId; schedule.SectionId = item.SectionId; scheduleList.Add(schedule); } foreach (var item in sectionsWinter) { StudentSchedule schedule = new StudentSchedule(); schedule.StudentId = studentId; schedule.SectionId = item.SectionId; scheduleList.Add(schedule); } db.StudentSchedules.AddRange(scheduleList); db.SaveChanges(); return(RedirectToAction("Index", "StudentSchedule")); }
public Junior(Student student) : base(student) { this.schedule = student.getSchedule(); this.name = student.getName(); this.gender = student.gender; this.school = student.school; this.DOB = student.getDOB(); this.completedCredits = student.getCredits(); this.major = student.getMajor(); }
public IHttpActionResult GetStudentSchedule(int id) { StudentSchedule result = BusinessLayer.GetRow <StudentSchedule>(id); if (result == null) { return(NotFound()); } return(Ok(result)); }
public ActionResult Edit([Bind(Include = "StudentScheduleId,StudentId,SectionId")] StudentSchedule studentSchedule) { if (ModelState.IsValid) { db.Entry(studentSchedule).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.SectionId = new SelectList(db.Sections, "SectionId", "Name", studentSchedule.SectionId); ViewBag.StudentId = new SelectList(db.Students, "StudentId", "StudentNumber", studentSchedule.StudentId); return(View(studentSchedule)); }
public ActionResult Delete(string Id) { StudentSchedule studentScheduleToDelete = context.Find(Id); if (studentScheduleToDelete == null) { return(HttpNotFound()); } else { return(View(studentScheduleToDelete)); } }
public ActionResult Create(StudentSchedule studentSchedule) { if (!ModelState.IsValid) { return(View(studentSchedule)); } else { context.Insert(studentSchedule); context.Commit(); return(RedirectToAction("Index")); } }
/// <summary> /// Convert StudentScheduleDAO into StudentSchedule. /// </summary> /// <param name="studentScheduleDAO">The StudentScheduleDAO to convert.</param> /// <returns>The StudentSchedule.</returns> public static StudentSchedule MapToStudentSchedule(StudentScheduleDAO studentScheduleDAO) { RegistrationData data = new RegistrationData(); StudentSchedule studentSchedule = data.FindOrCreateStudentSchedule(studentScheduleDAO.CourseSchedule.Id, studentScheduleDAO.Student.Person.Id); studentSchedule.CourseSchedule = MapToCourseSchedule(studentScheduleDAO.CourseSchedule); studentSchedule.CourseScheduleId = studentScheduleDAO.CourseSchedule.Id; studentSchedule.Student = MapToStudent(studentScheduleDAO.Student); studentSchedule.StudentId = studentScheduleDAO.Student.Person.Id; studentSchedule.Enrolled = studentScheduleDAO.Enrolled; return(studentSchedule); }
// GET: StudentSchedule/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudentSchedule studentSchedule = db.StudentSchedules.Find(id); if (studentSchedule == null) { return(HttpNotFound()); } return(View(studentSchedule)); }
public ActionResult ConfirmDelete(string Id) { StudentSchedule studentScheduleToDelete = context.Find(Id); if (studentScheduleToDelete == null) { return(HttpNotFound()); } else { context.Delete(Id); context.Commit(); return(RedirectToAction("Index")); } }
// GET: StudentSchedule/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudentSchedule studentSchedule = db.StudentSchedules.Find(id); if (studentSchedule == null) { return(HttpNotFound()); } ViewBag.SectionId = new SelectList(db.Sections, "SectionId", "Name", studentSchedule.SectionId); ViewBag.StudentId = new SelectList(db.Students, "StudentId", "StudentNumber", studentSchedule.StudentId); return(View(studentSchedule)); }
public async Task <ApiResult <StudentSchedule> > GetBySchedule(GetByScheduleRequest request) { var student = await _context.Students.FindAsync(request.Id_Student); var schedule = await _context.Schedules.FindAsync(request.Id_Schedule); if (student == null || schedule == null) { return(new ApiErrorResult <StudentSchedule>("Không tìm thấy dữ liệu")); } var queryStudentAttdendace = from s in _context.Schedules join ha in _context.HistoryAttendances on s.Id_Schedule equals ha.Id_Schedule join d in _context.DetailHAs on ha.Id_HistoryAttendace equals d.Id_HistoryAttendance join st in _context.Students on d.Id_Student equals st.Id where s.Id_Schedule == request.Id_Schedule select new { s, d, st }; var dataStudentAttdendace = await queryStudentAttdendace.Select(x => x.st.Id).ToListAsync(); int check = dataStudentAttdendace.IndexOf(request.Id_Student); var user = new StudentSchedule(); if (check > -1) { user = new StudentSchedule() { Id_Student = student.Id, Name = student.FullName, Date = schedule.Date, Status = true }; } else { user = new StudentSchedule() { Id_Student = student.Id, Name = student.FullName, Date = schedule.Date, Status = false }; } return(new ApiSuccessResult <StudentSchedule>(user)); }
public List <StudentSchedule> GetStudentExistingSchedule(List <StudentSubject> studSubs, string sy) { List <StudentSchedule> schedList = new List <StudentSchedule>(); schedList = GetSchedules(sy); List <StudentSchedule> existing = new List <StudentSchedule>(); StudentSchedule stud = new StudentSchedule(); foreach (StudentSubject ss in studSubs) { int index = schedList.FindIndex(item => item.SubjectAssignments == ss.SubjectAssignments); stud = schedList[index]; stud.Selected = false; existing.Add(stud); } return(existing); }
private void cbEditor1_ValueChanged(object sender, EventArgs e) { StudentSchedule sa = new StudentSchedule(); int i = gvAllSchedules.CurrentRow.Index; string subass = gvAllSchedules.Rows[i].Cells["SubjectAssignments"].Value.ToString(); int index = Schedules.FindIndex(item => item.SubjectAssignments == subass); Schedules[index].Selected = false; sa = Schedules[index]; RadCheckBoxEditor cbEditor1 = sender as RadCheckBoxEditor; StudentSubject ss = new StudentSubject() { StudentSY = controlStudentId + SY, SubjectCode = sa.SubjectCode, SubjectAssignments = sa.SubjectAssignments, StudentEnrSubCode = controlStudentId + SY + sa.SubjectCode, LockFirst = false, LockSecond = false, LockThird = false, LockFourth = false, FirstPeriodicRating = 0.00, SecondPeriodicRating = 0.00, ThirdPeriodicRating = 0.00, FourthPeriodicRating = 0.00 }; if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor1.Value == Telerik.WinControls.Enumerations.ToggleState.On) { sa.Selected = false; AddFromControl.Add(sa); subjects.Add(ss); Schedules.Remove(sa); } else if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor1.Value == Telerik.WinControls.Enumerations.ToggleState.Off) { sa.Selected = false; ControlSchedule.Remove(sa); subjects.Remove(ss); AddFromAll.Add(sa); } }
public async Task Add(StudentSchedule model) { await _context.AddAsync(model); await _context.SaveChangesAsync(); }
public ActionResult Create() { StudentSchedule studentSchedule = new StudentSchedule(); return(View(studentSchedule)); }
public void RegisterNewUser(RegisterModel regMod) { User user = new User(); user.fname = regMod.FirstName; user.lname = regMod.LastName; user.UserID = regMod.UserName; user.Password = regMod.Password; user.addr1 = regMod.Address1; user.addr2 = regMod.Address2; user.city = regMod.City; user.state = regMod.State; user.zip = regMod.ZipCode; user.phNo = regMod.PhoneNumber; user.user_type = regMod.EnrollAs; context.Users.Add(user); if (regMod.EnrollAs == 1) { MentorProfile mp = new MentorProfile(); mp.description = null; mp.imgPath = "/Uploads/UserImage/m1.jpeg"; mp.major = null; mp.User = user; context.MentorProfiles.Add(mp); List <weekday> weekdays = context.weekdays.Select(w => w).ToList(); List <time> times = context.times.Select(w => w).ToList(); foreach (weekday w in weekdays) { foreach (time t in times) { MentorSchedule ms = new MentorSchedule(); ms.fk_day_Id = w.dayid; ms.fk_time_id = t.timeid; ms.MentorProfile = mp; ms.fk_mentorship_id = null; ms.isMentoring = 0; context.MentorSchedules.Add(ms); } } } else if (regMod.EnrollAs == 2) { StudentProfile mp = new StudentProfile(); mp.description = null; mp.imgPath = "/Uploads/UserImage/m2.jpeg"; mp.clas = null; mp.User = user; context.StudentProfiles.Add(mp); List <weekday> weekdays = context.weekdays.Select(w => w).ToList(); List <time> times = context.times.Select(w => w).ToList(); foreach (weekday w in weekdays) { foreach (time t in times) { StudentSchedule ms = new StudentSchedule(); ms.fk_day_Id = w.dayid; ms.fk_time_id = t.timeid; ms.StudentProfile = mp; ms.fk_mentorship_id = null; context.StudentSchedules.Add(ms); } } } context.SaveChanges(); }
private void cbEditor1_ValueChanged(object sender, EventArgs e) { StudentSchedule sa = new StudentSchedule(); int i = gvAllSchedules.CurrentRow.Index; string subass = gvAllSchedules.Rows[i].Cells["SubjectAssignments"].Value.ToString(); int index = Schedules.FindIndex(item => item.SubjectAssignments == subass); Schedules[index].Selected = false; sa = Schedules[index]; RadCheckBoxEditor cbEditor1 = sender as RadCheckBoxEditor; StudentSubject ss = new StudentSubject() { StudentSY = controlStudentId + SY, SubjectCode = sa.SubjectCode, SubjectAssignments = sa.SubjectAssignments, StudentEnrSubCode = controlStudentId + SY + sa.SubjectCode, LockFirst = false, LockSecond = false, LockThird = false, LockFourth = false, FirstPeriodicRating = 0.00, SecondPeriodicRating = 0.00, ThirdPeriodicRating = 0.00, FourthPeriodicRating = 0.00 }; if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor1.Value == Telerik.WinControls.Enumerations.ToggleState.On) { //foreach (StudentSchedule sc in ControlSchedule) { // // if (sc.TimeslotInfo.Contains(sa.TimeslotInfo)) //} sa.Selected = false; AddFromControl.Add(sa); subjects.Add(ss); Schedules.Remove(sa); } else if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor1.Value == Telerik.WinControls.Enumerations.ToggleState.Off) { sa.Selected = false; ControlSchedule.Remove(sa); subjects.Remove(ss); AddFromAll.Add(sa); } }
private void cbEditor_ValueChanged(object sender, EventArgs e) { StudentSchedule sa = new StudentSchedule(); int i = gvSchedule.CurrentRow.Index; string subass=gvSchedule.Rows[i].Cells["SubjectAssignments"].Value.ToString(); int index = ControlSchedule.FindIndex(item => item.SubjectAssignments == subass); ControlSchedule[index].Selected = false; sa = ControlSchedule[index]; RadCheckBoxEditor cbEditor = sender as RadCheckBoxEditor; StudentSubject ss = new StudentSubject() { StudentSY = controlStudentId + SY, SubjectCode = sa.SubjectCode, SubjectAssignments = sa.SubjectAssignments, StudentEnrSubCode = controlStudentId + SY + sa.SubjectCode, LockFirst = false, LockSecond = false, LockThird = false, LockFourth = false, FirstPeriodicRating = 0.00, SecondPeriodicRating = 0.00, ThirdPeriodicRating = 0.00, FourthPeriodicRating = 0.00 }; if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor.Value == Telerik.WinControls.Enumerations.ToggleState.Off) { sa.Selected = false; AddFromControl.Add(sa); subjects.Add(ss); Schedules.Remove(sa); } else if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor.Value == Telerik.WinControls.Enumerations.ToggleState.On) { sa.Selected = false; RemoveFromControl.Add(sa); bool cont = ExistingSchedule.Contains(sa); if (cont) { int ind = ExistingSchedule.FindIndex(item => item.SubjectAssignments == sa.SubjectAssignments); StudentSubject sti = new StudentSubject() { StudentSY = controlStudentId + SY, SubjectCode = ExistingSchedule[ind].SubjectCode, SubjectAssignments = ExistingSchedule[ind].SubjectAssignments, StudentEnrSubCode = controlStudentId + SY + ExistingSchedule[ind].SubjectCode, LockFirst = false, LockSecond = false, LockThird = false, LockFourth = false, FirstPeriodicRating = 0.00, SecondPeriodicRating = 0.00, ThirdPeriodicRating = 0.00, FourthPeriodicRating = 0.00 }; ExistingSchedRemove.Add(sti); } else subjects.Remove(ss); AddFromAll.Add(sa); } }