Beispiel #1
0
        void CheckUserAdmin(User u)
        {
            txtNumber.Text = "";
            if (u.isAdmin)
            {
                var f = new Admin.AdminPanel(false);


                this.Parent.Controls.Add(f);

                f.Dock = DockStyle.Fill;
                f.Show();
                f.BringToFront();
            }
            else
            {
                if (u.isDone)
                {
                    MessageBox.Show("You have taken this exam");
                    return;
                }

                MessageBox.Show("Welcome. Click Ok to start Your exam");
                var f = new ExamControl();


                this.Parent.Controls.Add(f);

                f.Dock = DockStyle.Fill;
                f.Show();
                f.BringToFront();
            }
        }
Beispiel #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var password = txtNumber.Text.Trim();

            if (!string.IsNullOrWhiteSpace(password))
            {
                if (password == "ADMIN1234")
                {
                    txtNumber.Text = "";
                    var f = new Admin.AdminPanel(true);


                    this.Parent.Controls.Add(f);

                    f.Dock = DockStyle.Fill;
                    f.Show();
                    f.BringToFront();

                    return;
                }
                var user = User.GetUser(password);

                if (user == null)
                {
                    MessageBox.Show("User does not exist");
                }
                else
                {
                    Constants.User = user;
                    CheckUserAdmin(user);
                }
            }
            else
            {
                MessageBox.Show("Please enter your ID");
            }
        }