private void Btneditclient_Click(object sender, EventArgs e)
 {
     try
     {
         Data.Client dcl = new Data.Client();
         dcl.No_identity = tbxnoidentityadmin.Text;
         dcl.Firstname   = tbxfirstnameadmin.Text;
         dcl.Lastname    = tbxlastnameadmin.Text;
         dcl.Phone       = tbxphoneadmin.Text;
         dcl.Country     = tbxcountryadmin.Text;
         if (new Controller.RegisClient().updateclient(dcl))
         {
             MessageBox.Show("Data dengan id '" + dcl.No_identity + "' berhasil di edit!");
             binding();
             clearfieldcl();
         }
         else
         {
             MessageBox.Show("Data gagal di edit!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Pilih Client yang ingin di edit!");
     }
 }
 private void Btnaddnewclientadmin_Click(object sender, EventArgs e)
 {
     try
     {
         Data.Client dc = new Data.Client();
         dc.No_identity = tbxnoidentityadmin.Text;
         dc.Firstname   = tbxfirstnameadmin.Text;
         dc.Lastname    = tbxlastnameadmin.Text;
         dc.Phone       = tbxphoneadmin.Text;
         dc.Country     = tbxcountryadmin.Text;
         if (new Controller.RegisClient().registrasi(dc))
         {
             MessageBox.Show("Registrasi dengan ID '" + dc.No_identity + "' telah terdaftar!");
             binding();
             clearfieldcl();
         }
         else
         {
             MessageBox.Show("Registrasi gagal, isi form dengan benar!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("isi form dengan benar!");
     }
 }
예제 #3
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();
        }
        public void lemparidentity(string no_identity)
        {
            Data.Client dc    = new Data.Client();
            koneksi     konek = new koneksi();

            dc.No_identity = label6.Text;
            konek.openConnection();
            string          query = "select no_identity from tb_client where no_identity='" + no_identity + "'";
            MySqlDataReader dr    = konek.DataReader(query);

            dr.Read();
            label6.Text = dr["no_identity"].ToString();
            konek.closeConnection();
        }
 private void Btnaddnewclientregis_Click(object sender, EventArgs e)
 {
     Data.Client dc = new Data.Client();
     dc.No_identity = tbxnoidentityregis.Text;
     dc.Firstname   = tbxfirstnameregis.Text;
     dc.Lastname    = tbxlastnameregis.Text;
     dc.Phone       = tbxphoneregis.Text;
     dc.Country     = tbxcountryregis.Text;
     if (new Controller.RegisClient().registrasi(dc))
     {
         MessageBox.Show("Registrasi '" + dc.No_identity + "' berhasil!");
         Client_Page cp = new Client_Page();
     }
     else
     {
         MessageBox.Show("Registrasi gagal, isi form dengan benar atau ID sudah terpakai!");
     }
 }
        public void checkid()
        {
            bool stat = false;

            Data.Client dc  = new Data.Client();
            koneksi     kon = new koneksi();

            dc.No_identity = tbxnoidentityregis.Text;
            kon.openConnection();
            string query = "select no_identity from tb_client where no_identity = '" + dc.No_identity + "'";

            if (kon.checkidreader(query) == 1)
            {
                lblcheckidclient.Text = "'" + tbxnoidentityregis.Text + "' sudah terpakai!";
            }
            else
            {
                lblcheckidclient.Text = "'" + tbxnoidentityregis.Text + "' bisa digunakan!";
            }
            kon.closeConnection();
            //return stat;
        }
 private void Btnremoveclient_Click(object sender, EventArgs e)
 {
     try
     {
         Data.Client dcle = new Data.Client();
         dcle.No_identity = tbxnoidentityadmin.Text;
         koneksi kon = new koneksi();
         if (new Controller.RegisClient().deleteclient(dcle))
         {
             MessageBox.Show("Client dengan ID '" + dcle.No_identity + "' berhasil dihapus dari data!");
             binding();
             clearfieldcl();
         }
         else
         {
             MessageBox.Show("Client gagal di hapus!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Pilih Client yang ingin di hapus!");
     }
 }