Exemple #1
0
        private void Enter_button_Click(object sender, EventArgs e)
        {
            bool correct = false;

            foreach (User user in UserArray)
            {
                if (user.Login == Login_textBox.Text && user.Password == Password_textBox.Text)
                {
                    Hide();
                    if (user.Login == "admin")
                    {
                        MainFormAdmin form = new MainFormAdmin(this);
                        form.Show();
                    }
                    else
                    {
                        MainForm form = new MainForm(this);
                        form.Show();
                    }

                    correct = true;
                    Login_textBox.Clear();
                    Password_textBox.Clear();

                    break;
                }
            }

            if (!correct)
            {
                MessageBox.Show(@"Login and password doesn't match.");
                Password_textBox.Clear();
            }
        }
        private void Login_button_Click(object sender, EventArgs e)
        {
            string userName = "******";
            string pass     = "******";

            if (Username_textBox.Text == "" || Password_textBox.Text == "")
            {
                MessageBox.Show("You can't leave any ogf the field empty!");
            }
            else if ((Username_textBox.Text == userName) && (Password_textBox.Text == pass))
            {
                MessageBox.Show("Welcome " + userName);
                Username_textBox.Clear();
                Password_textBox.Clear();
            }
            else
            {
                MessageBox.Show("Invalid User Name or Password");
                Username_textBox.Clear();
                Password_textBox.Clear();
                Username_textBox.Focus();
            }
        }
Exemple #3
0
        private void Enter_button_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (Username_textBox.Text != "" && Password_textBox.Text != "")
            {
                if (UserVerifications.VerifyPassword(Username_textBox.Text, Password_textBox.Text))
                {
                    if (UserVerifications.Admin)
                    {
                        SchoolManagementSystem smsForm =
                            new SchoolManagementSystem(this, UserVerifications.GetUserName(Username_textBox.Text));
                        smsForm.Show();

//                var form = new AddForm(AddForm.AddOperationMode.AddTeacher);
//                form.Show();
                    }
                    else
                    {
                        ProgressFrom progress = new ProgressFrom(false, this);
                        progress.Show();
                    }

                    Hide();

                    Username_textBox.Clear();
                    Password_textBox.Clear();
                }
                else
                {
                    MessageBox.Show(UserVerifications.ObtainTextOfError(Username_textBox.Text));
                    Password_textBox.Clear();
                }
            }

            Cursor.Current = Cursors.Default;
        }
 private void Reset_button_Click(object sender, EventArgs e)
 {
     Username_textBox.Clear();
     Password_textBox.Clear();
     Username_textBox.Focus();
 }