Пример #1
0
 private void HideAllErrors()
 {
     RegMsgLabel.Hide();
     NameMsgLabel.Hide();
     SurnameMsgLabel.Hide();
     EmailMsgLabel.Hide();
     PassMsgLabel.Hide();
     CapacityMsgLabel.Hide();
     RegNumErrorLabel.Hide();
     NameErrorLabel.Hide();
     SurnameErrorLabel.Hide();
     EmailErrorLabel.Hide();
     PassErrorLabel.Hide();
     CapacityErrorLabel.Hide();
 }
Пример #2
0
        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");
        }