Beispiel #1
0
        private void Guest_label_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //Use the text in loading form
            UserName = "******";
            //hide the form
            this.Hide();
            //Display the loading form
            using (Loading_Form frm = new Loading_Form(Wating))
            {
                frm.ShowDialog(this);
            }

            Main_Form Main = new Main_Form();

            //Disable the buttons in main form
            Main.Account_btn.Enabled      = false;
            Main.Transactions_btn.Enabled = false;
            Main.PaysBill_btn.Enabled     = false;
            //Display the main form
            Main.Show();
        }
Beispiel #2
0
        private void SignIn_btn_Click(object sender, EventArgs e)
        {
            try
            {
                //check inner name box if it's empty
                if (Signin_NameTextBox.Text == string.Empty)
                {
                    MessageBox.Show("Error empty box", "Empty", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Signin_NameTextBox.Focus();
                }
                else if (signin_PasswordTextBox.Text == string.Empty)
                {//check password field if it's empty
                    MessageBox.Show("Error empty password box", "Empty detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    signin_PasswordTextBox.Focus();
                }
                else if (signin_PasswordTextBox.Text.Length < 8)
                {//validate password length
                    MessageBox.Show("Error short password , password should be 8 digit or more ", "short password", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    signin_PasswordTextBox.Focus();
                    signin_PasswordTextBox.SelectAll();
                }
                else if (usersTableAdapter.get_Name(Signin_NameTextBox.Text) != null)
                {//check the name from database
                    if (usersTableAdapter.get_Password(signin_PasswordTextBox.Text) != null)
                    {
                        //check password and open the form
                        UserName = "******" + Signin_NameTextBox.Text;
                        U_Name   = Signin_NameTextBox.Text;
                        User_ID  = int.Parse(usersTableAdapter.Get_User_ID(Signin_NameTextBox.Text).ToString());
                        // MessageBox.Show(usersTableAdapter.get_Name(Signin_NameTextBox.Text), "Welcome Back", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        //Display the loading form
                        this.Hide();
                        using (Loading_Form frm = new Loading_Form(Wating))
                        {
                            frm.ShowDialog(this);
                        }
                        //Display the main form
                        Main_Form main = new Main_Form();
                        main.Show();
                    }
                    else
                    {
                        //display error messsage if password error
                        MessageBox.Show("Error Password Entry", "Error name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        signin_PasswordTextBox.Focus();
                        signin_PasswordTextBox.SelectAll();
                    }
                }
                else
                {//Display an error message if name incorrect
                    MessageBox.Show("Error Name Entry", "Error name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Signin_NameTextBox.Focus();
                    Signin_NameTextBox.SelectAll();
                }
            }
            catch (Exception data_entry)
            {//Display exception message error if there some error detected , keep it is needed
                MessageBox.Show(data_entry.Message, "Exception message", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }