public Form_AddConstraint(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);
                    listApprovedCourses = lecturer.getAllMyCourseInStateApproved();
                }
                else if (user.permission.Equals("Practitioner"))
                {
                    practitioner        = dal.practitiners.Find(user.ID);
                    listApprovedCourses = practitioner.getAllMyCourseInStateApproved();
                }
                else
                {
                    MessageBox.Show("Error: Could not identify user details! (Only Lecturer / Practitioner can enter to here)");
                    clickGoBack = true;
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Error: Could not identify user details!");
                clickGoBack = true;
                Close();
            }

            if (listApprovedCourses != null)
            {
                string[] CB_coursesItems = new string[listApprovedCourses.Count + 1];
                CB_coursesItems[0] = "";
                for (int i = 0; i < listApprovedCourses.Count; i++)
                {
                    string str = listApprovedCourses.ElementAt(i).ID.ToString() + " : " + listApprovedCourses.ElementAt(i).Name;
                    CB_coursesItems[i + 1] = str;
                }

                txt_CB_coursesApproved.DataSource = CB_coursesItems;
            }

            txt_checkBox_allCourses.Checked = true;
            updateButtonsAndTextBoxes();
            GeneralFuntion.BlockResizeListViewColumns(listView_constraints);
            GeneralFuntion.Form_Center_FixedDialog(this);
        }
Exemplo n.º 2
0
        public Form_ShowDetailStudent(Student s)
        {
            InitializeComponent();

            student = s;
            if (student == null)
            {
                MessageBox.Show("Missed details!");
                Close();
            }
            lbl_title.Text = lbl_title.Text + "  '" + student.Name + "'";
            GeneralFuntion.BlockResizeListViewColumns(listView_Courses);
            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" };
        }
Exemplo 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);
        }