Example #1
0
        private void ModifyTeamMnBtn_Click(object sender, EventArgs e)
        {
            YouAreHere(ModifyTeamMnBtn);

            SelectedCourseLabel.Hide();
            CoursesList.Hide();
            SelectCourseBtn.Hide();
            ProjectGroupBox.Hide();
            ProjectList.Hide();
            GradeList.Hide();
            GradeGroupBox.Hide();


            TeamList.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top);
            TeamGroupBox.Show();
            TeamList.Show();
            TeamGroupBox.Location = new Point(550, 12);
            TeamList.Location     = new Point(150, 12);



            RefreshList();
            ClearAllBoxes();
            EnableViewLists();
            ChangeBtnNames();
        }
Example #2
0
        private void ProjectsMnBtn_Click(object sender, EventArgs e)
        {
            YouAreHere(ProjectsMnBtn);

            CoursesList.Hide();
            SelectCourseBtn.Hide();
            SelectedCourseLabel.Hide();

            label11.Text = CoursesList.SelectedItems[0].Text;

            ProjectsList.Show();
            UploadGroupBox.Show();

            ProjectsList.Items.Clear();
            try
            {
                Team team         = Database.GetTeamOfStudent(user, SelectedCourse);
                var  listViewItem = new ListViewItem();

                foreach (KeyValuePair <Project, ProjectFile> pair in team.getProjectAssignmentsD())
                {
                    if (DateTime.Compare(pair.Key.getDueDate(), DateTime.Now) > 0)
                    {
                        listViewItem      = new ListViewItem();
                        listViewItem.Text = pair.Key.getProjectID();
                        listViewItem.SubItems.Add(pair.Key.getname());
                        if (pair.Value == null)
                        {
                            listViewItem.SubItems.Add("No");
                        }
                        else
                        {
                            listViewItem.SubItems.Add("Yes");
                        }
                        try
                        {
                            if (!(pair.Value.getGrade() < 0))
                            {
                                listViewItem.SubItems.Add(pair.Value.getGrade().ToString());
                            }
                            else
                            {
                                listViewItem.SubItems.Add("-");
                            }
                        }
                        catch (NullReferenceException ex)
                        {
                            listViewItem.SubItems.Add("-");
                        }
                        ProjectsList.Items.Add(listViewItem);
                    }
                }
            }
            catch (Exception msg)
            {
                MessageBox.Show("You have no team");
            }
        }
        //On click on every menu button, objects that are not needed are being hidden, text boxes are being cleared
        //and the lists are being enabled. The regnumbo on edit must be disable so that the admin cannot create or
        //replace(by accident or not) a user from there

        private void CreateCourseMenuBtn_Click(object sender, EventArgs e)
        {
            UserGroupBox.Hide();
            CoursesList.Hide();
            AssignMsgLabel.Hide();
            AssignCourseBtn.Hide();
            CancelUsersBtn.Hide();
            CancelCoursesBtn.Hide();
            ClearBoxes();
            UsersList.Enabled        = true;
            CoursesList.Enabled      = true;
            CreateEditCourseBtn.Text = "Create";
            ChangeMsgLabel("Create", "Courses");
            UsersList.Show();
            CourseGroupBox.Show();
            this.CourseGroupBox.Location = new Point(550, 12);
            this.UsersList.Location      = new Point(150, 12);
        }
 private void EditDelUsersMnBtn_Click(object sender, EventArgs e)
 {
     CourseGroupBox.Hide();
     CoursesList.Hide();
     PassBox.Hide();
     PassLabel.Hide();
     AssignMsgLabel.Hide();
     AssignCourseBtn.Hide();
     HideAllErrors();
     CancelUsersBtn.Hide();
     CancelCoursesBtn.Hide();
     ClearBoxes();
     UsersList.Enabled   = true;
     CoursesList.Enabled = true;
     RegNumBox.Enabled   = false;
     UserGroupBox.Show();
     UsersList.Show();
     this.UserGroupBox.Location = new Point(550, 12);
     this.UsersList.Location    = new Point(150, 12);
     ChangeMsgLabel("Edit", "Users");
     CreateEditUserBtn.Text = "Submit";
 }
Example #5
0
        private void GradeProjectsMnBtn_Click(object sender, EventArgs e)
        {
            YouAreHere(GradeProjectsMnBtn);

            SelectedCourseLabel.Hide();
            CoursesList.Hide();
            SelectCourseBtn.Hide();
            ProjectList.Hide();
            ProjectGroupBox.Hide();
            TeamGroupBox.Hide();
            TeamList.Hide();

            GradeGroupBox.Show();
            GradeList.Show();
            GradeGroupBox.Location = new Point(450, 12);



            RefreshList();
            ClearAllBoxes();
            EnableViewLists();
            ChangeBtnNames();
        }
        private void CreateUserMenuBtn_Click(object sender, EventArgs e)
        {
            CourseGroupBox.Hide();
            UsersList.Hide();
            CoursesList.Hide();
            AssignMsgLabel.Hide();
            AssignCourseBtn.Hide();
            CancelUsersBtn.Hide();
            CancelCoursesBtn.Hide();
            HideAllErrors();
            ChangeMsgLabel("Create", "Users");
            ClearBoxes();

            UsersList.Enabled   = true;
            CoursesList.Enabled = true;
            RegNumBox.Enabled   = true;
            PassBox.Show();
            PassLabel.Show();
            UserGroupBox.Show();
            UserGroupBox.Left = (this.ClientSize.Width - UserGroupBox.Width + 100) / 2;
            UserGroupBox.Top  = (this.ClientSize.Height - UserGroupBox.Height - 100) / 2;

            CreateEditUserBtn.Text = "Create";
        }
        public AdminForm()
        {
            InitializeComponent();

            UserGroupBox.Controls.Add(NameBox);
            UserGroupBox.Controls.Add(RegNumBox);
            UserGroupBox.Controls.Add(SurnameBox);
            UserGroupBox.Controls.Add(PassBox);
            UserGroupBox.Controls.Add(EmailBox);
            UserGroupBox.Controls.Add(CapacityBox);
            UserGroupBox.Controls.Add(CreateEditUserBtn);
            UserGroupBox.Controls.Add(NameLabel);
            UserGroupBox.Controls.Add(RegNumLabel);
            UserGroupBox.Controls.Add(SurnameLabel);
            UserGroupBox.Controls.Add(PassLabel);
            UserGroupBox.Controls.Add(EmailLabel);
            UserGroupBox.Controls.Add(CapacityLabel);



            //Creating the UsersList
            UsersList.Bounds        = new Rectangle(new Point(196, 12), new Size(375, 500));
            UsersList.View          = View.Details;
            UsersList.FullRowSelect = true;
            UsersList.GridLines     = true;
            UsersList.Sorting       = SortOrder.Ascending;
            UsersList.Columns.Add("Registration Number", -2, HorizontalAlignment.Left);
            UsersList.Columns.Add("Name", -2, HorizontalAlignment.Left);
            UsersList.Columns.Add("Surname", -2, HorizontalAlignment.Left);
            UsersList.Columns.Add("Email", -2, HorizontalAlignment.Left);
            UsersList.Columns.Add("Capacity", -2, HorizontalAlignment.Left);

            //============================================================================



            LocalUsersDatabase.Add("kp0000");
            LocalUsersDatabase.Add("Mike");
            LocalUsersDatabase.Add("Kalliafas");
            LocalUsersDatabase.Add("*****@*****.**");
            LocalUsersDatabase.Add("Professor");

            LocalUsersDatabase.Add("p50000");
            LocalUsersDatabase.Add("Alberto");
            LocalUsersDatabase.Add("Makavegias");
            LocalUsersDatabase.Add("*****@*****.**");
            LocalUsersDatabase.Add("Student");

            LocalCoursesDatabase.Add("Algebra");
            LocalCoursesDatabase.Add("Professor 1");
            LocalCoursesDatabase.Add("Physics");
            LocalCoursesDatabase.Add("Professor 2");



            //Users Right Click menu creation
            ToolStripMenuItem UsersRightClickMenuEdit   = new ToolStripMenuItem("Edit");
            ToolStripMenuItem UsersRightClickMenuDelete = new ToolStripMenuItem("Delete");

            UsersRightClickMenuDelete.Click += new EventHandler(UserDelete_RightClick);
            UsersRightClickMenuEdit.Click   += new EventHandler(UserEdit_RightClick);
            UsersRightClickMenu.Items.AddRange(new ToolStripItem[] { UsersRightClickMenuEdit, UsersRightClickMenuDelete });

            //===================================================================================


            //Courses Right Click menu creation
            ToolStripMenuItem CoursesRightClickMenuEdit   = new ToolStripMenuItem("Edit");
            ToolStripMenuItem CoursesRightClickMenuDelete = new ToolStripMenuItem("Delete");

            CoursesRightClickMenuDelete.Click += new EventHandler(CoursesDelete_RightClick);
            CoursesRightClickMenuEdit.Click   += new EventHandler(CoursesEdit_RightClick);
            CoursesRightClickMenu.Items.AddRange(new ToolStripItem[] { CoursesRightClickMenuEdit, CoursesRightClickMenuDelete });
            //===================================================================================



            //Creating the CoursesList
            CoursesList.Bounds        = new Rectangle(new Point(150, 12), new Size(250, 500));
            CoursesList.View          = View.Details;
            CoursesList.FullRowSelect = true;
            CoursesList.GridLines     = true;
            CoursesList.Sorting       = SortOrder.Ascending;
            CoursesList.Columns.Add("Courses", -2, HorizontalAlignment.Left);
            CoursesList.Columns.Add("Professor", -2, HorizontalAlignment.Left);
            //=============================================================================



            ChangeMsgLabel("Create", "Users");

            CourseGroupBox.Text = "";
            UserGroupBox.Text   = "";

            CoursesList.Hide();
            UsersList.Hide();
            CourseGroupBox.Hide();
            CourseTitleErrorLabel.Hide();
            AssignMsgLabel.Hide();
            AssignCourseBtn.Hide();
            RegMsgLabel.Hide();
            NameMsgLabel.Hide();
            SurnameMsgLabel.Hide();
            EmailMsgLabel.Hide();
            PassMsgLabel.Hide();
            CapacityMsgLabel.Hide();
            CancelCoursesBtn.Hide();
            RegNumErrorLabel.Hide();
            NameErrorLabel.Hide();
            SurnameErrorLabel.Hide();
            EmailErrorLabel.Hide();
            PassErrorLabel.Hide();
            CapacityErrorLabel.Hide();
            CancelUsersBtn.Hide();

            RegNumErrorLabel.SendToBack();
            NameErrorLabel.SendToBack();
            SurnameErrorLabel.SendToBack();
            EmailErrorLabel.SendToBack();
            PassErrorLabel.SendToBack();
            CapacityErrorLabel.SendToBack();



            UserGroupBox.Left = (this.ClientSize.Width - UserGroupBox.Width + 100) / 2;
            UserGroupBox.Top  = (this.ClientSize.Height - UserGroupBox.Height - 100) / 2;

            UpdateList("Users");
            UpdateList("Courses");
        }