示例#1
0
        private void buttonMasuk_Click_1(object sender, EventArgs e)
        {
            Form5Biodata biodata = new Form5Biodata();
            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();

            builder.Server   = SERVER;
            builder.Database = DATABASE;
            builder.UserID   = UID;
            builder.Password = PASSWORD;
            String query      = string.Format("SELECT * FROM pendaftaran, admin");
            String connString = builder.ToString();

            dbConn = new MySqlConnection(connString);
            MySqlCommand cmd = new MySqlCommand(query, dbConn);

            dbConn.Open();
            MySqlDataReader reader = cmd.ExecuteReader();

            if (textBoxNmPnggnMasuk.Text == "admin" && textBoxSandiMasuk.Text == "admin123")
            {
                Form6Admin admin = new Form6Admin();
                MessageBox.Show("Login berhasil");
                panellogin.Visible = false;
                admin.TopLevel     = false;
                admin.Size         = panelContMasuk.Size;
                panelContMasuk.Controls.Add(admin);
                admin.Show();
                return;
            }
            else
            {
                while (reader.Read())
                {
                    if (textBoxNmPnggnMasuk.Text.Equals(reader["Username"]) && textBoxSandiMasuk.Text.Equals(reader["Sandi"]))
                    {
                        biodata = new Form5Biodata();
                        MessageBox.Show("Login berhasil");
                        panellogin.Visible = false;
                        biodata.TopLevel   = false;
                        biodata.Size       = panelContMasuk.Size;
                        panelContMasuk.Controls.Add(biodata);
                        biodata.textBoxUsername.Text = textBoxNmPnggnMasuk.Text;
                        biodata.Show();
                        return;
                    }
                }
            }
            MessageBox.Show("Nama pengguna atau sandi tidak sesuai");
            dbConn.Close();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form5Biodata form5 = new Form5Biodata();

            if ((textBoxUsernameDftr.Text == "user") && (textBoxSandi2Dftr.Text == "user"))
            {
                MessageBox.Show("Selamat Anda Sukses Registrasi");
                this.DialogResult = DialogResult.OK;
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Maaf, Anda Gagal Registrasi");
                this.DialogResult = DialogResult.OK;
                this.Dispose();
            }
        }
示例#3
0
 private void buttonRegisterDftr_Click(object sender, EventArgs e)
 {
     if ((textBoxUsernameMasuk.Text == "user") && (textBoxSandiMasuk.Text == "oke"))
     {
         this.DialogResult = DialogResult.OK;
         this.Dispose();
         Form5Biodata frm5 = new Form5Biodata();
         frm5.ShowDialog();
     }
     else if ((textBoxUsernameMasuk.Text == "") && (textBoxSandiMasuk.Text == ""))
     {
         MessageBox.Show("Silahkan Masukkan Username dan Password!");
     }
     else
     {
         MessageBox.Show("Username dan Password Tidak Sesuai!");
     }
 }