Exemple #1
0
        public ActionResult Student_Index()
        {
            if (!this.User.IsInRole("Student"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            string             UserId    = System.Web.HttpContext.Current.User.Identity.GetUserId();
            GradebookViewModel viewModel = new GradebookViewModel();

            viewModel.grades = new List <GradeBookModel>();
            StudentModels         currentStudent = new StudentModels();
            List <StudentModels>  students       = db.studentModels.ToList();
            List <GradeBookModel> all_grades     = db.gradeBookModel.ToList();

            foreach (StudentModels student in students)
            {
                if (student.student_account_Id == UserId)
                {
                    currentStudent        = student;
                    viewModel.studentName = student.fName + " " + student.lName;
                    break;
                }
            }
            foreach (GradeBookModel grade in all_grades)
            {
                if (grade.student_Id == currentStudent.student_Id)
                {
                    grade.ClassModel = db.classmodel.Find(grade.class_Id);
                    grade.TaskModel  = db.taskModel.Find(grade.task_Id);
                    viewModel.grades.Add(grade);
                }
            }
            return(View(viewModel));
        }
Exemple #2
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            gradebookVm = GradebookViewModel.Instance;
            this.AutoGenerateColumns = false;
            this.DataSource          = gradebookVm.Students;
        }
 public GradebookModel(GradebookViewModel gradebookVM)
 {
     this.SchoolYears = new List <SchoolYear>();
     foreach (SchoolYearViewModel schoolYearVM in gradebookVM.SchoolYears)
     {
         this.SchoolYears.Add(new SchoolYear(schoolYearVM));
     }
 }
Exemple #4
0
        private void btnLogout_Click(object sender, RoutedEventArgs e)
        {
            GradebookViewModel.Test();

            // clear gradebook
            loginWindow.Reset();
            loginOverlay.Visibility = System.Windows.Visibility.Visible;
        }
Exemple #5
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            gradebookVM          = GradebookViewModel.Instance;
            courses              = gradebookVM.Courses;
            courses.ListChanged += new ListChangedEventHandler(blCourses_ListChanged);
            createAssignmentTabs();
        }
Exemple #6
0
        public ActionResult AdminCharts(int?id, int?task_id)
        {
            if (!this.User.IsInRole("Admin"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            GradebookViewModel viewModel = new GradebookViewModel();

            viewModel.taskList = new List <SelectListItem>();
            viewModel.grades   = new List <GradeBookModel>();
            List <ClassTaskJoinModel> classTasks = db.classTask.ToList();
            List <TaskModel>          tasks      = db.taskModel.ToList();
            List <GradeBookModel>     grades     = db.gradeBookModel.ToList();

            ViewBag.class_Id = new SelectList(db.classmodel, "class_Id", "className");
            if (id == null)
            {
                return(RedirectToAction("Index", "Class"));
            }
            ClassModel this_class = db.classmodel.Find(id);

            foreach (ClassTaskJoinModel task in classTasks)
            {
                if (task.class_id == this_class.class_Id)
                {
                    TaskModel newTask = db.taskModel.Find(task.task_id);
                    viewModel.taskList.Add(new SelectListItem()
                    {
                        Text = newTask.taskName, Value = newTask.task_Id.ToString()
                    });
                }
            }
            foreach (GradeBookModel grade in grades)
            {
                grade.TaskModel = db.taskModel.Find(grade.task_Id);

                if (grade.class_Id == id)
                {
                    if (task_id == null)
                    {
                        viewModel.grades = classAverage(id);
                        break;
                    }
                    else if (grade.task_Id == task_id)
                    {
                        grade.StudentModels  = db.studentModels.Find(grade.student_Id);
                        grade.possiblePoints = db.taskModel.Find(grade.task_Id).points;
                        viewModel.grades.Add(grade);
                    }
                }
            }
            viewModel.taskList = viewModel.taskList.OrderBy(x => x.Text).ToList();
            viewModel.grades   = viewModel.grades.OrderByDescending(x => x.grade).ToList();
            return(View(viewModel));
        }
        // GET: Gradebook
        public ActionResult Index(int?instructorId)
        {
            var viewModel = new GradebookViewModel();

            if (instructorId != null)
            {
                viewModel.Instructor = _db.Instructors
                                       .Single(x => x.ID == instructorId);
                viewModel.Courses = viewModel.Instructor.Courses;
            }

            return(View(viewModel));
        }
Exemple #8
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            gradebookVM = GradebookViewModel.Instance;

            dgCourses.AutoGenerateColumns = false;
            dgCourses.DataSource          = gradebookVM.Courses;

            dgStudents.AutoGenerateColumns = false;

            tbGrades.Controls.Add(new GradeTabControl());
            tbAssignments.Controls.Add(new AssignmentTabControl());

            //applyTheme();
        }
Exemple #9
0
        public GradebookViewModel LoadGradebook()
        {
            Gradebook = GradebookViewModel.Load();

            chkMyStudents.IsChecked = UserViewModel.CurrentUser.HasStudents;
            chkMyStudents.IsEnabled = UserViewModel.CurrentUser.HasStudents;

            MarkingPeriods.Singleton.OrderByDescending(q => q.EndDate).ToList().ForEach(q => cmbQuarter.Items.Add(q));
            cmbQuarter.Text = cmbQuarter.Items[1].ToString();

            Maintenance.GradeLevelShorts.ToList().ForEach(g => cmbGradeLevel.Items.Add(g));
            cmbGradeLevel.Text = cmbGradeLevel.Items[0].ToString();

            FillCourses(MarkingPeriodKey.Current, cmbGradeLevel.Text);
            FillStudents(entStudent.Text, cmbQuarter.SelectedItem as MarkingPeriod, cmbGradeLevel.Text, cmbCourse.SelectedItem as CourseViewModel);
            return(Gradebook);
        }
Exemple #10
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            gradebookVm     = GradebookViewModel.Instance;
            this.DataSource = gradebookVm.Students;

            columnDictionary = new Dictionary <AssignmentViewModel, DataGridViewTextBoxColumn>();

            if (Course != null)
            {
                assignments              = Course.Assignments;
                assignments.ListChanged += new ListChangedEventHandler(assignments_ListChanged);

                createColumns();
            }
        }
Exemple #11
0
        private void OnLogin(object sender, System.EventArgs e)
        {
            Title = "Highlands School";
            loginOverlay.Visibility = System.Windows.Visibility.Hidden;
            _gradebook = studentsControl.LoadGradebook();
            ctrlClasses.Refresh(_gradebook);
            ctrlAttendees.Refresh();
            //ctrlClasses.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanEditAttendance);
            //tabAttendance.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanEditAttendance);
            tabClasses.Visibility   = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanViewGrades);
            tabStudents.Visibility  = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanViewGrades);
            btnExport.Visibility    = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanImportExport);
            btnImport.Visibility    = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanImportExport);
            btnHonorRoll.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanViewHonorRoll);
            tabClasses.Visibility   = ViewUtils.IsVisible(UserViewModel.CurrentUser.HasStudents);

            staUser.Content = "Welcome, " + UserViewModel.CurrentUser;
        }
Exemple #12
0
 // GET: GradeBook
 public ActionResult Index(int?task_Id, int?id)
 {
     if (!this.User.IsInRole("Admin"))
     {
         return(RedirectToAction("Index", "Home"));
     }
     if (id == null || task_Id == null)
     {
         return(RedirectToAction("Index", "Class"));
     }
     else
     {
         GradebookViewModel        viewModel = new GradebookViewModel();
         List <ClassTaskJoinModel> joinModel = db.classTask.ToList();
         viewModel.taskList = new List <SelectListItem>();
         List <TaskModel> tasks = db.taskModel.ToList();
         viewModel.grades = new List <GradeBookModel>();
         List <GradeBookModel> gradeBookModel = db.gradeBookModel.Include(g => g.StudentModels).Include(g => g.TaskModel).Include(g => g.ClassModel).Include(g => g.TaskModel.CourseModels).ToList();
         ClassModel            this_class     = db.classmodel.Find(id);
         foreach (ClassTaskJoinModel classTask in joinModel)
         {
             if (classTask.class_id == id)
             {
                 classTask.task = db.taskModel.Find(classTask.task_id);
                 viewModel.taskList.Add(new SelectListItem()
                 {
                     Text = classTask.task.taskName, Value = classTask.task_id.ToString()
                 });
             }
         }
         foreach (GradeBookModel grade in gradeBookModel)
         {
             if (grade.class_Id == id)
             {
                 if (grade.task_Id == task_Id)
                 {
                     viewModel.grades.Add(grade);
                 }
             }
         }
         return(View(viewModel));
     }
 }
        public GradebookViewModel GetGradebookViewModel(int?instructorId, int?courseId)
        {
            var viewModel = new GradebookViewModel();

            if (instructorId != null)
            {
                ViewBag.InstructorID = instructorId.Value;
                viewModel.Instructor = _db.Instructors
                                       .Single(x => x.ID == instructorId);
                viewModel.Courses = viewModel.Instructor.Courses;
            }

            if (courseId != null)
            {
                ViewBag.CourseID      = courseId.Value;
                viewModel.Enrollments = viewModel.Courses
                                        .Single(x => x.CourseID == courseId)
                                        .Enrollments;
            }
            return(viewModel);
        }
        internal void Refresh(GradebookViewModel gradebook)
        {
            _gradebook = gradebook;

            FillStudents();
        }