示例#1
0
        private void btnLogout_Click_1(object sender, EventArgs e)
        {
            refreshTransportation();

            this.Hide();
            formSignIn si = new formSignIn();

            si.Show();
        }
示例#2
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (txtFullName.Text == "")
            {
                MessageBox.Show("Full name must be filled!");
            }
            else if (txtUsername.Text == "")
            {
                MessageBox.Show("Username must be filled!");
            }
            else if (txtPassword.Text == "")
            {
                MessageBox.Show("Password must be filled!");
            }
            else
            {
                try {
                    conn.Open();

                    MySqlCommand com = conn.CreateCommand();
                    com.CommandText = "select username from user where username='******'";
                    MySqlDataAdapter adapter   = new MySqlDataAdapter(com);
                    DataTable        dataTable = new DataTable();
                    adapter.Fill(dataTable);

                    if (dataTable.Rows.Count == 1)
                    {
                        MessageBox.Show("Username is exist(s)!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        conn.Close();
                    }
                    else
                    {
                        cmd             = conn.CreateCommand();
                        cmd.CommandText = "insert into user (fullname, username, password, level) values (@fullname, @username, @password, 'Customer')";
                        cmd.Parameters.AddWithValue("@username", txtUsername.Text);
                        cmd.Parameters.AddWithValue("@password", txtPassword.Text);
                        cmd.Parameters.AddWithValue("@fullname", txtFullName.Text);
                        cmd.ExecuteNonQuery();

                        MessageBox.Show("Register success!");

                        conn.Close();

                        txtFullName.Text = "";
                        txtUsername.Text = "";
                        txtPassword.Text = "";

                        this.Hide();
                        formSignIn si = new formSignIn();
                        si.Show();
                    }
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
示例#3
0
        private void signOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            refreshCustomer();
            refreshReservation();

            this.Hide();
            formSignIn si = new formSignIn();

            si.Show();
        }
示例#4
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure want to cancel?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            if (result == DialogResult.OK)
            {
                txtFullName.Text = "";
                txtUsername.Text = "";
                txtUsername.Text = "";

                this.Hide();
                formSignIn si = new formSignIn();
                si.Show();
            }
        }