Ejemplo n.º 1
0
        private void pictSave_Click(object sender, EventArgs e)
        {
            string noktpText    = boxKtp.Text.ToString();
            string namaPmsnText = cmbBoxNama.Text.ToString();
            string emailText    = boxEmail.Text.ToString();
            string tlpText      = boxTelp.Text.ToString();
            string JnsRntalText = cmbJnisSound.Text.ToString();
            string almtText     = boxAlmt.Text.ToString();
            string hargaText    = boxHrg.Text.ToString();
            string TglText      = boxDateTgl.Text.ToString();

            DialogResult rs = MessageBox.Show("Apakah anda yakin ingin menghapus?", "Peringatan!", MessageBoxButtons.YesNo);

            if (rs == DialogResult.Yes)
            {
                string namaText = cmbBoxNama.SelectedItem.ToString();

                admin cre = new admin();
                cre.delete(namaText);
                MessageBox.Show("Pesanan anda berhasil dihapus");
                Menu_Admin balik = new Menu_Admin();
                this.Hide();
                balik.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show("Silahkan pilih Data yang akan dihapus");
            }
        }
Ejemplo n.º 2
0
        private void btnPictBack_Click(object sender, EventArgs e)
        {
            Menu_Admin balik = new Menu_Admin();

            this.Hide();
            balik.ShowDialog();
            this.Close();
        }
Ejemplo n.º 3
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (BoxUser.Text == "")
            {
                MessageBox.Show("username harus diisi!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                BoxUser.Focus();
                return;
            }
            if (BoxPass.Text == "")
            {
                MessageBox.Show("password harus diisi!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                BoxPass.Focus();
                return;
            }

            try
            {
                SqlConnection con = new SqlConnection();
                con.ConnectionString = "Data Source=ASUS-X555U-TDC;Initial Catalog=Rental-sound;User ID=sa;Password=1976";
                con.Open();
                string         query = ("select * from Register where username = '******' and password = '******'");
                SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                DataTable      dtbl  = new DataTable();
                sda.Fill(dtbl);

                string         queryadmin = ("select * from LoginAdmin where username = '******' and password = '******'");
                SqlDataAdapter admin      = new SqlDataAdapter(queryadmin, con);
                DataTable      dataadmin  = new DataTable();
                admin.Fill(dataadmin);

                if (dtbl.Rows.Count == 1)
                {
                    MessageBox.Show("Login Sukses");
                    MENU go = new MENU();
                    this.Hide();
                    go.ShowDialog();
                    this.Close();
                }
                else if (dataadmin.Rows.Count == 1)
                {
                    MessageBox.Show("Login Admin Sukses");
                    Menu_Admin go = new Menu_Admin();
                    this.Hide();
                    go.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Username atau password salah!");
                }
            }
            catch (SqlException f)
            {
                Console.WriteLine(f.Message);
            }
        }