Пример #1
0
        private void Btnloginfrmlogin_Click(object sender, EventArgs e)
        {
            koneksi kon = new koneksi();

            Data.Client dc = new Data.Client();
            dc.No_identity = tbxnoidentitylogin.Text;
            dc.Phone       = tbxphonelogin.Text;
            kon.openConnection();
            string query = "select no_identity, phone from tb_client where no_identity='" + dc.No_identity + "' and phone='" + dc.Phone + "'";

            if (kon.loginreader(query) == 1)
            {
                Client_Menu cp = new Client_Menu();
                MessageBox.Show("'" + dc.No_identity + "' Login berhasil!");
                cp.Show();
                cp.lemparidentity(tbxnoidentitylogin.Text);
                this.Hide();
            }
            else if (tbxnoidentitylogin.Text == "admin" && tbxphonelogin.Text == "admin")
            {
                Menu mn = new Menu();
                MessageBox.Show("Login sebagai admin berhasil!");
                mn.Show();
                this.Hide();
            }
            else if (tbxnoidentitylogin.Text == "" && tbxphonelogin.Text == "")
            {
                MessageBox.Show("Masukan No. Identity dan Phone!");
            }
            else
            {
                MessageBox.Show("No. Identity atau Phone salah!");
            }
            kon.closeConnection();
        }