Пример #1
0
        public void fillGrid3()
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from s in context.Students where s.Email.Contains(searchStudentsTextBox.Text) select s;
                var s1 = l2equery.ToList();

                studentGridView.DataSource = s1;
                studentGridView.DataBind();
            }
        }
Пример #2
0
        public void fillCourseGridView()
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from s in context.Students where s.Email.Contains(searchStudentsTextBox.Text) select s.Courses;
                var courses = l2equery.FirstOrDefault();

                courseGridView.DataSource = courses;
                courseGridView.DataBind();
            }
        }
Пример #3
0
        public void fillDefault()
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from c in context.Courses select c;
                var courses = l2equery.ToList();

                courseGridView.DataSource = courses;
                courseGridView.DataBind();

            }
        }
Пример #4
0
 protected void initializeStudent()
 {
     studentCourseDropDown.Items.Clear();
     studentCourseDropDown.Items.Add(new ListItem("--Select--", null));
     using(var context = new GradebookDataEntities())
     {
         var query = from c in context.Courses select new { c.CourseID, c.CourseNumber, c.Term, c.Year };
         foreach(var course in query)
         {
             string courseFormat = String.Format("{0,-10}\t{1,-10}\t{2, 10}", course.CourseID, course.CourseNumber, course.Term, course.Year);
             studentCourseDropDown.Items.Add(new ListItem(courseFormat,courseFormat));
         }
     }
 }
Пример #5
0
        protected void checkRole()
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = (from s in context.Students where s.Email == email select s).FirstOrDefault();

                if (l2equery != null)
                {
                    studentPanel.Visible = true;
                    teacherPanel.Visible = false;
                    studentCourseGridViewFill();
                }
                else
                {
                    teacherPanel.Visible = true;
                    studentPanel.Visible = false;
                    teacherCourseGridViewFill();
                }
            }
        }
Пример #6
0
        protected void AddStudentButton_Click(object sender, EventArgs e)
        {
            if (AddStudentTextBox.Text != "")
            {
                using (var context = new GradebookDataEntities())
                {
                    Course course = context.Courses.FirstOrDefault(c => c.CourseNumber == CourseNumberDropDownList.SelectedValue);
                    Student student = context.Students.FirstOrDefault(s => s.Email == AddStudentTextBox.Text);
                    course.Students.Add(student);

                    context.SaveChanges();

                    var l2equery = from s in context.Students where s.Email.Contains(searchStudentsTextBox.Text) select s.Courses;
                    var courses = l2equery.FirstOrDefault();

                    courseGridView.DataSource = courses;
                    courseGridView.DataBind();
                }
            }
            else
            {
                string email = studentGridView.Rows[studentGridView.SelectedIndex].Cells[0].Text.ToString(); ;
                using (var context = new GradebookDataEntities())
                {
                    Course course = context.Courses.FirstOrDefault(c => c.CourseNumber == CourseNumberDropDownList.SelectedValue);
                    Student student = context.Students.FirstOrDefault(s => s.Email == email);
                    course.Students.Add(student);

                    context.SaveChanges();

                    var l2equery = from s in context.Students where s.Email.Contains(searchStudentsTextBox.Text) select s.Courses;
                    var courses = l2equery.FirstOrDefault();

                    courseGridView.DataSource = courses;
                    courseGridView.DataBind();
                }
            }
        }
Пример #7
0
 protected bool checkIfStudent()
 {
     string studentEmail;
     using (var context = new GradebookDataEntities())
     {
         var query = (from c in context.Courses from s in c.Students where c.CourseID == courseID && s.Email == User.Identity.Name select s.Email);
         studentEmail = query.FirstOrDefault();
     }
     if(studentEmail == null)
         return false;
     return true;
 }
Пример #8
0
        protected void loadTeacherCourseStudentGrid()
        {
            using (var context = new GradebookDataEntities())
            {
                var query = (from c in context.Courses where c.CourseID == courseID select c.Students).FirstOrDefault();

                teacherCourseStudentGrid.DataSource = query;
                teacherCourseStudentGrid.DataBind();
            }
        }
Пример #9
0
        protected void loadTeacherCourseGradeGrid()
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from c in context.Courses where c.CourseID == courseID select c.GradeDistributions;
                var gradeDistribution = l2equery.FirstOrDefault();

                teacherCourseGradeGrid.DataSource = gradeDistribution;
                teacherCourseGradeGrid.DataBind();
            }
        }
Пример #10
0
        protected void loadTeacherCourseAssignmentGrid()
        {
            using (var context = new GradebookDataEntities())
            {
                var query = (from c in context.Courses from grade in c.GradeDistributions from assignment in grade.Assignments where c.CourseID == courseID select new { assignment.Description, assignment.PointsPossible }).ToList();

                teacherCourseAssignmentGrid.DataSource = query;
                teacherCourseAssignmentGrid.DataBind();
            }
            teacherCourseAssignmentGrid.GridLines = GridLines.None;
        }
Пример #11
0
 protected void getClassName()
 {
     string cName;
     using (var context = new GradebookDataEntities())
     {
         var query = (from c in context.Courses where c.CourseID == courseID select c).FirstOrDefault();
         cName = query.CourseNumber.ToString();
         ClassLabel.Text = cName;
     }
 }
Пример #12
0
        protected bool checkIfTeacher()
        {
            string teacherEmail;
            using (var context = new GradebookDataEntities())
            {
                var query = (from c in context.Courses where c.CourseID == courseID select c.Teacher).FirstOrDefault();
                teacherEmail = query.Email;
            }

            if (teacherEmail == User.Identity.Name)
                return true;
            else
                return false;
        }
Пример #13
0
        protected void registerCourseButton_Click(object sender, EventArgs e)
        {
            using (var context = new GradebookDataEntities())
            {
                var query = (from t in context.Teachers where t.Email == email select t.TeacherID).FirstOrDefault();
                int teacher = Convert.ToInt32(query);
                string cNumber = CourseNumber.Text;
                string term = termDropDownList.SelectedValue;
                int year = Convert.ToInt32(yearDropDownList.SelectedValue);

                var result = context.AddClass(cNumber,term,year,CourseDescription.Text,query);

            }
            teacherCourseGridViewFill();
        }
Пример #14
0
        protected void TermDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from c in context.Courses where c.Year >= DateTime.Now.Year && c.Term == TermDropDownList.SelectedValue select c;
                var courses = l2equery.ToList();

                CourseNumberDropDownList.DataSource = courses;
                CourseNumberDropDownList.DataBind();
            }
        }
Пример #15
0
        protected void studentGridView_SelectedIndexChanged(Object sender, EventArgs e)
        {
            string email = studentGridView.Rows[studentGridView.SelectedIndex].Cells[0].Text.ToString(); ;
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from s in context.Students where s.Email.Contains(email) select s.Courses;
                var courses = l2equery.FirstOrDefault();

                courseGridView.DataSource = courses;
                courseGridView.DataBind();
            }
            searchStudentsTextBox.Text = email;
        }
Пример #16
0
        protected void teacherCourseGridViewFill()
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from t in context.Teachers where t.Email == email select t.Courses;
                var teacherCourses = l2equery.FirstOrDefault();

                teacherCourseGridView.DataSource = teacherCourses;
                teacherCourseGridView.DataBind();
            }
        }
Пример #17
0
        protected void studentCourseGridViewFill()
        {
            using (var context = new GradebookDataEntities())
            {
                var l2equery = from s in context.Students where s.Email == email select s.Courses;
                var courses = l2equery.FirstOrDefault();

                studentCourseGridView.DataSource = courses;
                studentCourseGridView.DataBind();

            }
        }
Пример #18
0
        protected void registerStudentCourseButton_Click(object sender, EventArgs e)
        {
            if(courseID != 0)
                using(var context = new GradebookDataEntities())
                {
                    Course course = context.Courses.FirstOrDefault(c => c.CourseID == courseID);
                    Student student = context.Students.FirstOrDefault(s => s.Email == email);
                    course.Students.Add(student);

                    context.SaveChanges();
                }
            studentCourseGridViewFill();
        }