public Boolean statusCariUser2(string user) { DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd = db.CreateCommand(); string sql = "select user_login from user_system where user_login='******'"; dbcmd.CommandText = sql; MySqlDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { if ((reader.GetString(0).ToString() == user)) { return true; } } db.Close(); return false; }
public Boolean statuscariuser4(string nama) { DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd = db.CreateCommand(); string sql = "select nim,nama from data_peg where nama='" + nama + "'"; dbcmd.CommandText = sql; MySqlDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { if ((reader.GetString(0).ToString() == nama)) { return true; } } db.Close(); return false; }
private Boolean statuslogin(string user, string password) { user = user.ToLower(); password = password.ToLower(); DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd = db.CreateCommand(); string sql = "select user_login,password_login from user_system"; dbcmd.CommandText = sql; MySqlDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { if ((reader.GetString(0).ToString().ToLower() == user) && (reader.GetString(1).ToString().ToLower() == password)) { return true; } } db.Close(); return false; }
public Boolean statuscariuser(string nim) { string waktu_awal, waktu_akhir; waktu_awal = DateTime.Now.ToString("yyyy-MM-dd 01:00:00"); waktu_akhir = DateTime.Now.ToString("yyyy-MM-dd 23:00:00"); DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd = db.CreateCommand(); string sql = "select nim from absensi where nim='" + nim + "' and tgl_absen between '" + waktu_awal + "' and '" + waktu_akhir + "'"; dbcmd.CommandText = sql; MySqlDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { if ((reader.GetString(0).ToString() == nim)) { return true; } } db.Close(); return false; }
//private void input_absen(string identik) private void input_absen() { string sql; DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd = db.CreateCommand(); sql = "insert into absensi values (null,'" + Label_NIP.Text + "',now(),'" + Label_Nama.Text + "');"; dbcmd.CommandText = sql; MySqlDataAdapter sqladapter = new MySqlDataAdapter(sql, koneksi_db.koneksi()); DataSet mydataset = new DataSet(); sqladapter.Fill(mydataset); //id_pembayaran = Convert.ToInt32(dbcmd.ExecuteScalar()); db.Close(); }
void FrameGrabber(object sender, EventArgs e) { label3.Text = "0"; label4.Text = "Tidak Ada"; NamePersons.Add(""); //Get the current frame form capture device currentFrame = grabber.QueryFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //Convert it to Grayscale gray = currentFrame.Convert<Gray, Byte>(); //Face Detector MCvAvgComp[][] facesDetected = gray.DetectHaarCascade( face, 1.2, 10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(20, 20)); //Action for each element detected foreach (MCvAvgComp f in facesDetected[0]) { t = t + 1; result = currentFrame.Copy(f.rect).Convert<Gray, byte>().Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //draw the face detected in the 0th (gray) channel with blue color currentFrame.Draw(f.rect, new Bgr(Color.Red), 2); if (trainingImages.ToArray().Length != 0) { //TermCriteria for face recognition with numbers of trained images like maxIteration MCvTermCriteria termCrit = new MCvTermCriteria(ContTrain, 0.001); //Eigen face recognizer EigenObjectRecognizer recognizer = new EigenObjectRecognizer( trainingImages.ToArray(), labels.ToArray(), 3000, ref termCrit); name = recognizer.Recognize(result); //Draw the label for each face detected and recognized currentFrame.Draw(name, ref font, new Point(f.rect.X - 2, f.rect.Y - 2), new Bgr(Color.LightGreen)); } NamePersons[t - 1] = name; NamePersons.Add(""); //Set the number of faces detected on the scene label3.Text = facesDetected[0].Length.ToString(); } t = 0; //Names concatenation of persons recognized for (int nnn = 0; nnn < facesDetected[0].Length; nnn++) { //names = names + NamePersons[nnn] + ", "; names = names + NamePersons[nnn]; } //Show the faces procesed and recognized imageBoxFrameGrabber.Image = currentFrame; label4.Text = names; if (label4.Text != "") { Label_Nama.Text = label4.Text; //Label_NIP.Text = "test"; DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd = db.CreateCommand(); string sql = "select nim from data_peg where nama like'%" + label4.Text + "%'"; dbcmd.CommandText = sql; MySqlDataReader reader = dbcmd.ExecuteReader(); while (reader.Read()) { Label_NIP.Text = reader.GetString(0).ToString(); } db.Close(); //button_SimpanAbsen.Enabled = true; //label11.Visible = false; } else { //button_SimpanAbsen.Enabled = false; //label11.Visible = true; } names = ""; //ketemu = true; //Clear the list(vector) of names NamePersons.Clear(); }
private void button1_Click(object sender, EventArgs e) { try { DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd = db.CreateCommand(); string sql = "insert into data_peg values ('" + textBox_NIP.Text + "','" + textBox_Nama.Text + "','" + textBox_Alamat.Text + "','" + textBox_Jabatan.Text + "','" + textBox_TmpLhr.Text + "','" + dateTimePicker_TglLhr.Value.ToString("yyyy-MM-dd") + "','" + comboBox_PendAkhir.SelectedIndex.ToString() + "');"; dbcmd.CommandText = sql; MySqlDataAdapter sqladapter = new MySqlDataAdapter(sql, koneksi_db.koneksi()); DataSet mydataset = new DataSet(); sqladapter.Fill(mydataset); //id_pembayaran = Convert.ToInt32(dbcmd.ExecuteScalar()); db.Close(); MessageBox.Show("Data Pegawai Baru Berhasil Disimpan"); this.Close(); } catch { MessageBox.Show("Data Tidak Berhasil Disimpan"); } }
private void tampillogin() { this.Hide(); Login fmLogin = new Login(); DialogResult dr = fmLogin.ShowDialog(); if (dr != DialogResult.OK) { this.Close(); } else { //this.Text = "Input NIP : " + fmLogin.usernamelogin; usernamewelcome = fmLogin.usernamelogin; this.Show(); } if (usernamewelcome != "") { CariPengguna cp = new CariPengguna(); if (cp.statusCariUser2(usernamewelcome) == true) { DBConnect koneksi_db = new DBConnect(); MySqlConnection db = new MySqlConnection(koneksi_db.koneksi()); db.Open(); MySqlCommand dbcmd2 = db.CreateCommand(); string sql = "select user_login,Jab from user_system"; dbcmd2.CommandText = sql; MySqlDataReader reader = dbcmd2.ExecuteReader(); while (reader.Read()) { if ((reader.GetString(0).ToString().ToLower() == usernamewelcome)) { //label_Nama.Text = reader.GetString(1).ToString(); jabat = reader.GetString(1).ToString(); if (jabat == "Admin") { button_Daftar.Enabled = true; } } } db.Close(); } } }
private void Input_NIP_Load(object sender, EventArgs e) { //button_Daftar.Visible = false; button_Daftar.Enabled = false; DBConnect koneksi_db = new DBConnect(); MySqlConnection conn = new MySqlConnection(koneksi_db.koneksi()); try { conn.Open(); tampillogin(); } catch (Exception ex) { MessageBox.Show("Koneksi ke database gagal", "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(ex.Message); Close(); } }