예제 #1
0
        private void skip_button_Click(object sender, EventArgs e)
        {
            Main_Menu main_menu_form = new Main_Menu();

            ActiveForm.Hide();
            main_menu_form.Show();
        }
예제 #2
0
        private void sign_in_submit_button_Click(object sender, EventArgs e)
        {
            string username = UsernameBox.Text;
            string password = PasswordBox.Text;

            MySqlConnection conn = connect_to_database();

            try
            {
                conn.Open();
                string       sql = "SELECT * FROM davis_pizza_user WHERE userName=@username AND password=@password";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@username", username);
                cmd.Parameters.AddWithValue("@password", password);

                MySqlDataReader myReader = cmd.ExecuteReader();
                if (myReader.Read())
                {
                    user.set_signed_in(myReader["userName"].ToString());
                    user.set_user_id(int.Parse(myReader["customerID"].ToString()));
                }
                else
                {
                    MessageBox.Show("Login Credentials do not match what's in the system.", "Login Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                    return;
                }

                myReader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString() + "***");
                return;
            }

            Main_Menu main_menu_form = new Main_Menu();

            ActiveForm.Hide();
            main_menu_form.Show();

            return;
        }