private void Form1_Load(object sender, EventArgs e) { btnBack.Visible = false; label1.Visible = false; _obj = this; UCHome uc = new UCHome(); uc.Dock = DockStyle.Fill; panelContainer.Controls.Add(uc); }
/* * static String connectionString = "datasource = 127.0.0.1;port=3306;username=root;password=;database=penjualan;"; * static MySqlConnection db = new MySqlConnection(connectionString); * MySqlDataReader reader;*/ private void radButton1_Click(object sender, EventArgs e) { try { var client = new RestClient("http://localhost/web_sister/REST_API/api/admin?userId=" + user_login.Text); var request = new RestRequest(Method.GET); var response = client.Execute(request); var dump_data = response.Content; JObject objek = JObject.Parse(dump_data); bool status = (bool)objek.SelectToken("status"); string user = (string)objek.SelectToken("data[0].userId"); string password = (string)objek.SelectToken("data[0].password"); string nama = (string)objek.SelectToken("data[0].nama"); if (status == false) { MessageBox.Show((string)objek.SelectToken("pesan") + "\nPERIKSA KEMBALI DATA ANDA"); } else { if (pass_login.Text != password) { MessageBox.Show("PASSWORD YANG ANDA MASUKAN SALAH !", "PERINGATAN", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { MessageBox.Show("Selamat Datang " + nama + " ^_^", "LOGIN BERHASIL", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); FormUtama formutama = new FormUtama(); formutama.Show(); formutama.BringToFront(); this.Hide(); } } } catch (Exception eror) { MessageBox.Show(eror.ToString()); } }