private void loginToolStripMenuItem_Click(object sender, EventArgs e) { fr_login log = new fr_login(); log.Owner = this; log.ShowDialog(); }
private void logoutToolStripMenuItem_Click(object sender, EventArgs e) { fr_login log = new fr_login(); log.Owner = this; loginToolStripMenuItem.Visible = true; logoutToolStripMenuItem.Visible = false; administrasiDataToolStripMenuItem.Visible = false; masterDataToolStripMenuItem.Visible = false; }
public void laporanToolStripMenuItem_Click(object sender, EventArgs e) { fr_login log = new fr_login(); log.Owner = this; }
public void administrasiDataToolStripMenuItem_Click(object sender, EventArgs e) { fr_login log = new fr_login(); log.Owner = this; }
private void masterDataToolStripMenuItem_Click(object sender, EventArgs e) { fr_login log = new fr_login(); log.Owner = this; }
private void proses() { /*SqlConnection con; * con = koneksi.conn; * con.Open(); * SqlCommand coman = new SqlCommand(); * coman.Connection = con; * coman.CommandType = CommandType.Text; * coman.CommandText = "select * from tb_login where username ='******'and password='******'"; * coman.ExecuteNonQuery(); * SqlDataReader dr = coman.ExecuteReader(); * if (dr.Read()) * { * MessageBox.Show("Login Berhasil", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); * this.Close(); * } * else * { * MessageBox.Show("Username atau Password salah !", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Warning); * tb_user.Focus(); * tb_pass.Text = ""; * } * con.Close();*/ //SqlConnection con = new SqlConnection(@"Data Source=hand;Initial Catalog=db_smkmm52; Integrated Security=true"); //SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) from tb_login where username='******' and password='******'", con); SqlConnection con; con = koneksi.conn; con.Open(); SqlCommand coman = new SqlCommand(); coman.Connection = con; coman.CommandType = CommandType.Text; SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) from tb_login where username='******' and password='******'", con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { fr_login lg = new fr_login(); this.Close(); tb_user.Focus(); (this.Owner as fr_utama).logoutToolStripMenuItem.Visible = true; (this.Owner as fr_utama).loginToolStripMenuItem.Visible = false; (this.Owner as fr_utama).masterDataToolStripMenuItem.Visible = true; (this.Owner as fr_utama).administrasiDataToolStripMenuItem.Visible = true; } else { if (tb_user.Text == "") { MessageBox.Show("Username Salah !", "Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (tb_pass.Text == "") { MessageBox.Show("Password Salah !", "Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } tb_user.Focus(); } }