private void BtnCekKartu_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                sp.isoReaderInit();
                //card = new MifareCard(isoReader);

                var msg = "";
                var id  = sp.ReadBlock(Msb, BlockId);
                if (id != null)
                {
                    msg += "ID: " + Util.ToASCII(id, 0, 16);
                }

                var nama = sp.ReadBlockRange(Msb, BlockNamaFrom, BlockNamaTo);
                if (nama != null)
                {
                    msg += "\nNama: " + Util.ToASCII(nama, 0, 48);
                }

                var telp = sp.ReadBlock(Msb, BlockTelp);
                if (telp != null)
                {
                    msg += "\nTelp: " + Util.ToASCII(telp, 0, 16);
                }

                var alamat = sp.ReadBlockRange(Msb, BlockAlamatFrom, BlockAlamatTo);
                if (alamat != null)
                {
                    msg += "\nAlamat: " + Util.ToASCII(alamat, 0, 64);
                }

                var jenisK = sp.ReadBlock(Msb, BlockJenisKelamin);
                if (jenisK != null)
                {
                    msg += "\nJenis Kelamin: " + Util.ToASCII(jenisK, 0, 16);
                }

                var pass = sp.ReadBlockRange(Msb, BlockPasswordFrom, BlockPasswordTo);
                if (pass != null)
                {
                    msg += "\nPassword: "******"Informasi Kartu", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception)
            {
                MessageBox.Show("Terjadi kesalahan, pastikan kartu sudah berada pada jangkauan reader.", "Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                sp.isoReaderInit();
            }
        }
Пример #2
0
        private void onNext(MonitorEvent ev)
        {
            try
            {
                sp.isoReaderInit();

                if (ev.ToString() == "PCSC.Reactive.Events.CardInserted")
                {
                    var user = sp.ReadBlock(0x00, BlockId);
                    var pass = sp.ReadBlockRange(0x00, BlockPasswordFrom, BlockPasswordTo);

                    if (cmd.Login(Util.ToASCII(user, 0, user.Length, false), Util.ToASCII(pass, 0, pass.Length, false)))
                    {
                        Dispatcher.Invoke(() => { sh(); });
                    }
                    else
                    {
                        MessageBox.Show("Staf Pendaftaran tidak terdaftar, hubungi administrator untuk mendaftar.",
                                        "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Pastikan reader sudah terpasang dan kartu sudah berada pada jangkauan reader.",
                                "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                sp.isoReaderInit();
            }
        }
Пример #3
0
        private void onNext(MonitorEvent ev)
        {
            try
            {
                if (ev.ToString() == "PCSC.Reactive.Events.CardInserted")
                {
                    //Debug.WriteLine(ev.ToString());
                    var user  = sp.ReadBlock(0x00, BlockId);
                    var user2 = sp.ReadBlock(0x00, BlockId2);
                    var pass  = sp.ReadBlockRange(0x00, BlockPasswordFrom, BlockPasswordTo);
                    var pass2 = sp.ReadBlockRange(0x00, BlockPasswordFrom2, BlockPasswordTo2);


                    //MessageBox.Show(Utils.Util.ToASCII(user2, 0, user.Length, false));
                    //MessageBox.Show(Utils.Util.ToASCII(pass2, 0, pass2.Length, false));

                    if (cmd.Login(Util.ToASCII(user, 0, user.Length), Util.ToASCII(pass, 0, pass.Length)))
                    {
                        Settings.Default.role = "admin";
                        Dispatcher.Invoke(() => { sh(); });
                    }
                    else
                    {
                        if (cmd.LoginK(Util.ToASCII(user2, 0, user2.Length), Util.ToASCII(pass2, 0, pass2.Length)))
                        {
                            Settings.Default.role = "keuangan";
                            Dispatcher.Invoke(() => { sh(); });
                        }
                        else
                        {
                            MessageBox.Show("Admin tidak terdaftar, hubungi administrator untuk mendaftar.", "Error",
                                            MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Pastikan reader sudah terpasang dan kartu sudah berada pada jangkauan reader.",
                //    "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                MessageBox.Show(ex.Message);
                sp.isoReaderInit();
            }
        }
Пример #4
0
        private void Btn_cekData_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                sp.isoReaderInit();
                //card = new MifareCard(isoReader);

                var msg = "";
                var rm  = sp.ReadBlock(Msb, blockNoRekamMedis);
                if (rm != null)
                {
                    msg += "Nomor Rekam Medis \t: " + Util.ToASCII(rm, 0, 16, false);
                }

                var nId = sp.ReadBlock(Msb, blockIdPasien);
                if (rm != null)
                {
                    msg += "\nNomor ID Pasien \t\t: " + Util.ToASCII(nId, 0, 16, false);
                }

                var jId = sp.ReadBlock(Msb, blockJenisId);
                if (jId != null)
                {
                    msg += "\nJenis ID Pasien \t\t: " + Util.ToASCII(jId, 0, 16, false);
                }

                var namaP = sp.ReadBlockRange(Msb, blockNamaFrom, blockNamaTo);
                if (namaP != null)
                {
                    msg += "\nNama Pasien \t\t: " + Util.ToASCII(namaP, 0, 48, false);
                }

                var nTelp = sp.ReadBlock(Msb, blockNoTelp);
                if (nTelp != null)
                {
                    msg += "\nNomor Telepon Pasien \t: " + Util.ToASCII(nTelp, 0, 16, false);
                }

                var alamatP = sp.ReadBlockRange(Msb, blockAlamatForm, blockAlamatTo);
                if (alamatP != null)
                {
                    msg += "\nAlamat Pasien \t\t: " + Util.ToASCII(alamatP, 0, 64, false);
                }

                var jk = sp.ReadBlock(Msb, blockJenisKelamin);
                if (jk != null)
                {
                    msg += "\nJenis Kelamin \t\t: " + Util.ToASCII(jk, 0, 16, false);
                }

                var gol = sp.ReadBlock(Msb, blockGolDarah);
                if (gol != null)
                {
                    msg += "\nGolongan Darah \t\t: " + Util.ToASCII(gol, 0, 16, false).TrimStart();
                }

                var tglHarie = sp.ReadBlock(Msb, blockTglLahir);
                if (tglHarie != null)
                {
                    msg += "\nTanggal Lahir \t\t: " + Util.ToASCII(tglHarie, 0, 16, false);
                }

                MessageBox.Show(msg, "Informasi Kartu Pasien", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception)
            {
                MessageBox.Show("Terjadi kesalahan, pastikan kartu sudah berada pada jangkauan reader.",
                                "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                sp.isoReaderInit();
            }
        }