Пример #1
0
        //validate and log in
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            string uid      = textBoxUserId.Text.Trim();
            string password = textBoxPassword.Text;
            string type     = comboBoxUserType.Text.Trim();

            if (!ctr.idValidator(uid))
            {
                MessageBox.Show("User id should be 1-6 numbers.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                textBoxUserId.Clear();
                textBoxUserId.Focus();
            }
            else if (!ctr.passwordValidator(password))
            {
                MessageBox.Show("Password should be 6-22 characters.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                textBoxPassword.Clear();
                textBoxPassword.Focus();
            }
            else if (!rd.checkStaff(int.Parse(uid), password, type))
            {
                MessageBox.Show("User id or password is incorrect, please try again.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBoxPassword.Clear();
                textBoxPassword.Focus();
            }
            else if (type.Equals("HR"))
            {
                Program.loginID = int.Parse(uid);
                this.Hide();
                HrForm df = new HrForm();
                df.ShowDialog();
                this.Close();
            }
            else if (type.Equals("Attendant"))
            {
                Program.loginID = int.Parse(uid);
                this.Hide();
                AttendantForm df = new AttendantForm();
                df.ShowDialog();
                this.Close();
            }
            else if (type.Equals("Assistant"))
            {
                Program.loginID = int.Parse(uid);
                this.Hide();
                AssistantForm lf = new AssistantForm();
                lf.ShowDialog();
                this.Close();
            }
            else if (type.Equals("Manager"))
            {
                Program.loginID = int.Parse(uid);
                this.Hide();
                ManagerForm mf = new ManagerForm();
                mf.ShowDialog();
                this.Close();
            }
        }
Пример #2
0
        private void ButtonOrdermanage_Click(object sender, EventArgs e)
        {
            AttendantForm af = new AttendantForm();

            af.Show();
        }