示例#1
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();
        }