示例#1
0
        protected void ddlSections_SelectedIndexChanged(object sender, EventArgs e)
        {
            Instructor instructor = (Instructor)Session["Instructor"];
            TermClass  termclass  = new TermClass();
            Student    student    = new Student();
            Section    section    = new Section();
            Class      clas       = new Class();

            TermClassList tClassList = new TermClassList();
            DataTable     dt         = new DataTable();

            tClassList = tClassList.GetAll(); // Get Term classes



            dt.Columns.Add("Student Name");
            dt.Columns.Add("Class Name");
            dt.Columns.Add("Instructor Name");
            dt.Columns.Add("Section Name");

            Guid sectionID = new Guid(ddlSections.SelectedValue);

            foreach (TermClass tc in tClassList.List)
            {
                if (tc.InstructorId == instructor.Id)
                {
                    if (tc.SectionId == sectionID)
                    {
                        clas    = clas.GetById(tc.ClassId);
                        student = student.GetById(tc.StudentId);

                        string className      = clas.Name;
                        string instructorName = instructor.FirstName + " " + instructor.LastName;
                        string studentName    = student.FirstName + " " + student.LastName;
                        string sectionName    = ddlSections.SelectedItem.ToString();

                        dt.Rows.Add(studentName, className, instructorName, sectionName);
                    }
                }
                ShowTable(dt);
            }
        }
示例#2
0
        protected void btnEditAttendance_Click(object sender, EventArgs e)
        {
            Instructor instructor = (Instructor)Session["Instructor"];
            TermClass  termclass  = new TermClass();
            Student    student    = new Student();
            Section    section    = new Section();
            Class      clas       = new Class();
            Attendance attendance = new Attendance();

            List <Student> sList       = new List <Student>();
            TermClassList  tClassList  = new TermClassList();
            StudentList    studentList = new StudentList();
            DataTable      dt          = new DataTable();

            tClassList  = tClassList.GetAll(); // Get Term classes
            studentList = studentList.GetAll();


            dt.Columns.Add("Student Name");
            dt.Columns.Add("Class Name");
            dt.Columns.Add("Instructor Name");
            dt.Columns.Add("Section Name");
            dt.Columns.Add("Total Absences");
            //dt.Columns.Add(new DataColumn("Absent", typeof(CheckBox)));

            Guid sectionID = new Guid(ddlSections.SelectedValue);
            Guid classID   = new Guid(ddlSelectClass.SelectedValue);

            foreach (TermClass tc in tClassList.List)
            {
                if (tc.InstructorId == instructor.Id)
                {
                    if (tc.SectionId == sectionID)
                    {
                        if (tc.ClassId == classID)
                        {
                            clas       = clas.GetById(tc.ClassId);
                            student    = student.GetById(tc.StudentId);
                            attendance = attendance.GetByStudentId(tc.StudentId);
                            string className      = clas.Name;
                            string instructorName = instructor.FirstName + " " + instructor.LastName;
                            string studentName    = student.FullName;
                            string sectionName    = ddlSections.SelectedItem.ToString();
                            int    totalAbsences  = attendance.TotalAbsences;



                            dt.Rows.Add(studentName, className, instructorName, sectionName, totalAbsences);
                            foreach (Student stud in studentList.List)
                            {
                                if (stud.Id == tc.StudentId)
                                {
                                    sList.Add(stud);
                                }
                            }
                        }
                    }
                }
            }
            if (sList != null)
            {
                ddlSelectStudent.DataSource = sList;
                ddlSelectStudent.DataBind();
                ddlSelectStudent.Items.Add("Choose Student");
                ddlSelectStudent.SelectedValue = "Choose Student";
                ddlSelectStudent.Visible       = true;
                btnMarkAbsent.Visible          = true;
            }
            Session["SaveTable"] = dt;

            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
示例#3
0
        private void RefreshTable()
        {
            Instructor instructor = (Instructor)Session["Instructor"];
            TermClass  termclass  = new TermClass();
            Student    student    = new Student();
            Section    section    = new Section();
            Class      clas       = new Class();
            Attendance attendance = new Attendance();

            AttendanceList aList = new AttendanceList();

            TermClassList tClassList  = new TermClassList();
            StudentList   studentList = new StudentList();
            DataTable     dt          = new DataTable();

            tClassList = tClassList.GetAll(); // Get Term classes



            dt.Columns.Add("Student Name");
            dt.Columns.Add("Class Name");
            dt.Columns.Add("Instructor Name");
            dt.Columns.Add("Section Name");
            dt.Columns.Add("Total Absences");

            Guid sectionID = new Guid(ddlSections.SelectedValue);
            Guid classID   = new Guid(ddlSelectClass.SelectedValue);


            foreach (TermClass tc in tClassList.List)
            {
                if (tc.InstructorId == instructor.Id)
                {
                    if (tc.SectionId == sectionID)
                    {
                        if (tc.ClassId == classID)
                        {
                            clas       = clas.GetById(tc.ClassId);
                            student    = student.GetById(tc.StudentId);
                            attendance = attendance.GetByStudentId(tc.StudentId);
                            string className      = clas.Name;
                            string instructorName = instructor.FirstName + " " + instructor.LastName;
                            string studentName    = student.FullName;
                            string sectionName    = ddlSections.SelectedItem.ToString();
                            int    totalAbsences  = attendance.TotalAbsences;

                            aList.GetAttendanceByStudentID(student.Id);
                            foreach (Attendance a in aList.List)
                            {
                                totalAbsences = totalAbsences + 1;
                            }


                            dt.Rows.Add(studentName, className, instructorName, sectionName, totalAbsences);
                        }
                    }
                }
            }
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }