private void SearchAmbilKtm()
        {
            cQuery    qr = new cQuery();
            cDatabase db = new cDatabase();

            DataTable dtSearch = null;

            if (rbMahasiswa.Checked == true)
            {
                dtSearch = db.selectData(qr.qSearchMhsByNImNama(txt_cari_nik.Text, txt_cari_nama.Text), '2');
            }
            else
            {
                dtSearch = db.selectData(qr.qSearchPegByNikNama(txt_cari_nik.Text, txt_cari_nama.Text), '4');
            }

            cControl cnt = new cControl();

            foreach (DataRow rowSearch in dtSearch.Rows)
            {
                string[] row = null;

                if (rbMahasiswa.Checked == true)
                {
                    row = new string[] { rowSearch["STUDENTID"].ToString(), rowSearch["STUDENTID"].ToString(), rowSearch["FULLNAME"].ToString(), rowSearch["RFID"].ToString() };
                }
                else
                {
                    row = new string[] { rowSearch["id_pegawai"].ToString(), rowSearch["nik"].ToString(), rowSearch["nama"].ToString(), rowSearch["rfid"].ToString() };
                }

                DGList.Rows.Add(row);
            }

            dtSearch.Clear();
            dtSearch.Dispose();
        }
示例#2
0
        private void cariMhs()
        {
            cQuery    qr       = new cQuery();
            cDatabase db       = new cDatabase();
            DataTable dtSearch = db.selectData(qr.qSearchMhsByNImNama(txt_cari_nim.Text, txt_cari_nama.Text), '2');
            cControl  cnt      = new cControl();

            foreach (DataRow rowSearch in dtSearch.Rows)
            {
                string status    = string.Empty;
                String TglBlokir = string.Empty;
                //jika kode rfid kososng, cek dari table history blokir
                if (rowSearch["RFID"].ToString().Trim() == string.Empty)
                {
                    DataTable dtHistory = db.selectData(qr.qSearchHistoryByIdPenggunaTop1(rowSearch["STUDENTID"].ToString()), '3');
                    if (dtHistory.Rows.Count != 0)//jika ada data di dlm history blokir = terblokir
                    {
                        status = "Terblokir";
                    }
                    else
                    {//jika tidak ada data di dlm history blokir = Tidak Aktif
                        status = "Tidak Aktif";
                    }
                }
                else
                {//jika ada data rfidnya = akif
                    status = "Aktif";
                }

                string[] row = new string[] { rowSearch["STUDENTID"].ToString(), rowSearch["STUDENTID"].ToString(), rowSearch["FULLNAME"].ToString(), rowSearch["RFID"].ToString(), status };
                DGList.Rows.Add(row);
            }

            dtSearch.Clear();
            dtSearch.Dispose();
        }