public Form_ScheduleStudent(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("Secretary"))
                {
                    secretary = dal.secretaries.Find(user.ID);
                }
                else if (user.permission.Equals("Admin"))
                {
                    admin = dal.admins.Find(user.ID);
                }
                else if (user.permission.Equals("Student"))
                {
                    student          = dal.students.Find(user.ID);
                    selected_student = student;
                    if (student == null)
                    {
                        return;
                    }
                    txt_CB_students.Text    = "S" + student.ID.ToString() + " : " + student.Name;
                    txt_CB_students.Enabled = false;
                    txt_CB_courses.Enabled  = true;
                    handlerShowCoursesStudent();
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details! (Only Secretary / Admin can enter to here)");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }

            checkBox_onlyPractises.Enabled = true;
            checkBox_onlyLectures.Enabled  = true;
            checkBox_onlyLabs.Enabled      = true;

            checkBox_onlyLabs.Checked      = true;
            checkBox_onlyLectures.Checked  = true;
            checkBox_onlyPractises.Checked = true;

            checkBox_LessonsOfStudentSelected.Checked = false;
            checkBox_LessonsOfStudentSelected.Enabled = true;

            GeneralFuntion.Form_Center_FixedDialog(this);
            setEmptyDataInGridView();
            setStudents();
            updateButtons();
        }
Ejemplo n.º 2
0
        public Form_MenuSecretaryAdmin(User u)
        {
            InitializeComponent();
            dal = new DbContextDal();

            user = u;
            if (user != null)
            {
                if (user.permission.Equals("Secretary"))
                {
                    secretary         = dal.secretaries.Find(user.ID);
                    lbl_userName.Text = lbl_userName.Text + secretary.Name;
                    lbl_title.Text    = lbl_title.Text + "Secretary";
                }
                else if (user.permission.Equals("Admin"))
                {
                    admin             = dal.admins.Find(user.ID);
                    lbl_userName.Text = lbl_userName.Text + admin.Name;
                    lbl_title.Text    = lbl_title.Text + "Admin";
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details! (Only Secretary or Admin can enter to here)");
                    clickGoBack = true;
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                this.Close();
            }
            GeneralFuntion.Form_Center_FixedDialog(this);
        }
        public Form_addCourseToStaffAndStudent(User u)
        {
            InitializeComponent();
            // init connection to database
            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("Secretary"))
                {
                    staffMember = secretary = dal.secretaries.Find(user.ID);
                }
                else if (user.permission.Equals("Admin"))
                {
                    staffMember = admin = dal.admins.Find(user.ID);
                }
                else if (user.permission.Equals("Lecturer"))
                {
                    staffMember = lecturer = dal.lecturers.Find(user.ID);
                }
                else if (user.permission.Equals("Practitioner"))
                {
                    staffMember = practitioner = dal.practitiners.Find(user.ID);
                }
                else if (user.permission.Equals("Student"))
                {
                    student = dal.students.Find(user.ID);
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details!");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }
            resertDetailCourse();
            UpdateDefaultButton();
            initPermission();
            GeneralFuntion.BlockResizeListViewColumns(listView_coursesFounded);
            GeneralFuntion.Form_Center_FixedDialog(this);
        }
        public Form_AddUpdateStaffMember(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("Secretary"))
                {
                    secretary = dal.secretaries.Find(user.ID);
                }
                else if (user.permission.Equals("Admin"))
                {
                    admin = dal.admins.Find(user.ID);
                }
                else if (user.permission.Equals("Lecturer"))
                {
                    lecturer = dal.lecturers.Find(user.ID);
                }
                else if (user.permission.Equals("Practitioner"))
                {
                    practitioner = dal.practitiners.Find(user.ID);
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details!");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }

            updateButtons();
            listView_staffFounded.Items.Clear();
            GeneralFuntion.BlockResizeListViewColumns(listView_staffFounded);
            GeneralFuntion.Form_Center_FixedDialog(this);
        }
        // the ctor of the frame
        public Form_AddUpdateStudent(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("Secretary"))
                {
                    secretary = dal.secretaries.Find(user.ID);
                }
                else if (user.permission.Equals("Admin"))
                {
                    admin = dal.admins.Find(user.ID);
                }
                else if (user.permission.Equals("Student"))
                {
                    studentAsPremission = dal.students.Find(user.ID);
                    studentSelected     = studentAsPremission;
                    txt_TB_ID.Text      = studentAsPremission.ID.ToString();
                    txt_TB_ID.Enabled   = false;
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details! (Only Secretary or Admin or Student can enter here!)");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }

            updateButtons();
            GeneralFuntion.BlockResizeListViewColumns(listView_studentFounded);
            GeneralFuntion.Form_Center_FixedDialog(this);
        }
        public Form_ScheduleLessonsByConstraint(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("Secretary"))
                {
                    secretary = dal.secretaries.Find(user.ID);
                }
                else if (user.permission.Equals("Admin"))
                {
                    admin = dal.admins.Find(user.ID);
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details! (Only Secretary / Admin can enter to here)");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }

            setLecturersAndPractitionersWithApprovedCourses();
            setListViewClasses();

            GeneralFuntion.BlockResizeListViewColumns(listView_constraints);
            GeneralFuntion.BlockResizeListViewColumns(listView_freeClasses);
            GeneralFuntion.Form_Center_FixedDialog(this);
            setEmptyDataInGridView();
            updateComponents();
            string[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };
        }
Ejemplo n.º 7
0
        public Form_SearchingStudents(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("Secretary"))
                {
                    secretary = dal.secretaries.Find(user.ID);
                }
                else if (user.permission.Equals("Admin"))
                {
                    admin = dal.admins.Find(user.ID);
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details! (Only Secretary or Admin can enter here!)");

                    MessageBox.Show("Error: Could not identify user details!");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }
            rbtn_FailedAtCourse.Checked = true;
            UpdateCoursesInComboBox(courses);
            updateButtons();
            GeneralFuntion.BlockResizeListViewColumns(listView_studentCourseGrade);
            GeneralFuntion.Form_Center_FixedDialog(this);
        }