예제 #1
0
        private void setLessons()
        {
            list_lessons = new List <Lesson>();

            if (student != null)
            {
                if (checkBox_labs.Checked && checkBox_lectures.Checked && checkBox_practises.Checked)
                {
                    list_lessons = student.getAllMyLessons();
                }
                else
                {
                    list_lessons = new List <Lesson>();

                    if (checkBox_labs.Checked)
                    {
                        setAllLabsLessonOfStudent();
                    }
                    if (checkBox_lectures.Checked)
                    {
                        setAllLecturesLessonOfStudent();
                    }
                    if (checkBox_practises.Checked)
                    {
                        setAllPractiseLessonOfStudent();
                    }
                }
            }

            else if (lecturer != null)
            {
                if (checkBox_lectures.Checked)
                {
                    list_lessons = lecturer.GetAllMyLesson();
                }
            }

            else if (practitioner != null)
            {
                if (checkBox_labs.Checked && checkBox_practises.Checked)
                {
                    list_lessons = practitioner.GetAllMyLesson();
                }
                else
                {
                    list_lessons = new List <Lesson>();

                    if (checkBox_labs.Checked)
                    {
                        setAllLabsLessonOfPractitioner();
                    }
                    if (checkBox_practises.Checked)
                    {
                        setAllPractisesLessonOfPractitioner();
                    }
                }
            }
        }
        private void initDataTimeTable()
        {
            list_lessons = null;

            if (selected_Lecturer != null)
            {
                list_lessons = selected_Lecturer.GetAllMyLesson();
            }
            else if (selected_Practitioner != null)
            {
                list_lessons = selected_Practitioner.GetAllMyLesson();
            }

            if (list_lessons == null || list_lessons.Count == 0)
            {
                items = null;
                return;
            }

            resetDataTimeTable();

            for (int i = 0; i < list_lessons.Count; i++)
            {
                int    colums    = 0;
                string strShowed = "C:" + list_lessons.ElementAt(i).LCourseID + " " + list_lessons.ElementAt(i).classroom.getNameClass();
                if (list_lessons.ElementAt(i).Day.Equals("Sunday"))
                {
                    items[list_lessons.ElementAt(i).Start - 8].Sunday = strShowed;
                    colums = 1;
                }
                else if (list_lessons.ElementAt(i).Day.Equals("Monday"))
                {
                    items[list_lessons.ElementAt(i).Start - 8].Monday = strShowed;
                    colums = 2;
                }
                else if (list_lessons.ElementAt(i).Day.Equals("Tuesday"))
                {
                    items[list_lessons.ElementAt(i).Start - 8].Tuesday = strShowed;
                    colums = 3;
                }
                else if (list_lessons.ElementAt(i).Day.Equals("Wednesday"))
                {
                    items[list_lessons.ElementAt(i).Start - 8].Wednesday = strShowed;
                    colums = 4;
                }
                else if (list_lessons.ElementAt(i).Day.Equals("Thursday"))
                {
                    items[list_lessons.ElementAt(i).Start - 8].Thursday = strShowed;
                    colums = 5;
                }
                else if (list_lessons.ElementAt(i).Day.Equals("Friday"))
                {
                    items[list_lessons.ElementAt(i).Start - 8].Friday = strShowed;
                    colums = 6;
                }
                coloredColumnInDataGridView(colums, list_lessons.ElementAt(i).Start - 8, list_lessons.ElementAt(i).End - 8, i % list_colors.Length);
            }
        }
예제 #3
0
        public Form_MySchedule(User u)
        {
            InitializeComponent();

            dal = new DbContextDal();

            //Receives a staff member indicating what authorization is, to know what actions are allowed
            user = u;

            if (user != null)
            {
                if (user.permission.Equals("Lecturer"))
                {
                    lecturer         = dal.lecturers.Find(user.ID);
                    list_lessons     = lecturer.GetAllMyLesson();
                    list_lessons_fix = lecturer.GetAllMyLesson();

                    checkBox_lectures.Enabled = true;
                    checkBox_lectures.Checked = true;

                    checkBox_practises.Enabled = false;
                    checkBox_practises.Checked = false;
                    checkBox_labs.Enabled      = false;
                    checkBox_labs.Checked      = false;
                }
                else if (user.permission.Equals("Practitioner"))
                {
                    practitioner     = dal.practitiners.Find(user.ID);
                    list_lessons     = practitioner.GetAllMyLesson();
                    list_lessons_fix = practitioner.GetAllMyLesson();


                    checkBox_practises.Enabled = true;
                    checkBox_practises.Checked = true;
                    checkBox_labs.Enabled      = true;
                    checkBox_labs.Checked      = true;


                    checkBox_lectures.Enabled = false;
                    checkBox_lectures.Checked = false;
                }
                else if (user.permission.Equals("Student"))
                {
                    student                    = dal.students.Find(user.ID);
                    list_lessons               = student.getAllMyLessons();
                    list_lessons_fix           = student.getAllMyLessons();
                    checkBox_practises.Enabled = true;
                    checkBox_practises.Checked = true;
                    checkBox_labs.Enabled      = true;
                    checkBox_labs.Checked      = true;
                    checkBox_lectures.Enabled  = true;
                    checkBox_lectures.Checked  = true;
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details! (Only Student / Lecturer / Practitioner can enter to here)");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }

            GeneralFuntion.Form_Center_FixedDialog(this);
            setEmptyDataInGridView();
            setDataInGridView();
            initListView();
        }