private Boolean addCustomer(BEID_EIDCard card) { try { byte[] bytesPicture = card.getPicture().getData().GetBytes(); BEID_EId data = card.getID(); string nationalNumber = data.getNationalNumber(); string firstname = data.getFirstName1().Contains(' ') ? data.getFirstName1().Split(' ')[0] : data.getFirstName1(); string lastname = data.getSurname(); string street = data.getStreet(); string postcode = data.getZipCode(); string city = data.getMunicipality(); ApplicationVM.customer = new Customer() { NationalNumber = nationalNumber, Firstname = firstname, Lastname = lastname, Street = street, Postcode = postcode, City = city, Picture = bytesPicture }; return(true); } catch (BEID_Exception ex) { IDReader.logError(ex); BEID_ReaderSet.releaseSDK(); return(false); } }
private void LoadEid() { BEID_ReaderSet.initSDK(); Registrated = false; try { BEID_ReaderSet readerSet = BEID_ReaderSet.instance(); BEID_ReaderContext reader = readerSet.getReader(); if (reader.isCardPresent()) { if (reader.getCardType() == BEID_CardType.BEID_CARDTYPE_EID) { BEID_EIDCard card = reader.getEIDCard(); BEID_EId doc = card.getID(); BEID_Picture picture = card.getPicture(); byte[] pictureBytes = picture.getData().GetBytes(); Customer.CustomerName = doc.getFirstName1() + " " + doc.getSurname(); Customer.Address = doc.getStreet() + ", " + doc.getZipCode() + " " + doc.getMunicipality(); Customer.Picture = pictureBytes; Customer.Balance = 0; FirstName = doc.getFirstName1(); LastName = doc.getSurname(); Address = doc.getStreet(); City = doc.getZipCode() + " " + doc.getMunicipality(); CheckIfCustomerExists(); } else { MakeErrorLog("Doesn't support this version", mname, "LoadEid"); } } else { MakeErrorLog("No E-ID was found", mname, "LoadEid"); } BEID_ReaderSet.releaseSDK(); } catch (Exception) { MakeErrorLog("Something went wrond with reading the E-ID", mname, "LoadEid"); } }