How to fetch and process the data recorded in Bio-Metric devices using .Net ?
Now a days Bio-Metric technology plays a pivotal Role in Software Industry.Bio-Metric devices Used as a Security for a company, Company Time attendance Management and Govt. Subsidiary schemes.Generally the Company will Provide a software/sample written code/SDK that is mainly sample written code in (VB/C++/VC++). For.Net Coders How to integrate these devices and program by using .net windows Application?. This is the one I want to discuss in this article.
Bio-Metric devices are in the form of finger,hand,retina(eye) e.t.c.So many companies manufactured this Bio-Metric Machines and develop a SDK for this. Companies like zicon ,spectra ,Pegasus versions are (T-5,T-7,T-8 readers and so on),Ingresoll rand for Hand Punch devices. Generally the Company will Provide a software/sample written code that is mainly written in (VB/C++/VC++). And this software/sample written code may not fulfill the client requirements . So we need enhance the software.
Generally Bio-Metric device software provided by the Company manufacturers will provide some basic sample written code. They may not have the following requirement like Ex:Late Nights Calculation of Punches,Calculation of in and out punches, generate the Punches in a text format (Ex: Note pad, Excel and csv)and to have a faster software Application than the original one.Company will provide a software development kit along with that a dll i.e written in (vb/c++/vc++ languages) for working in .Net first we need to add the dll in to your Project.But the Original dll will not work after adding as reference in your project.for that we need to follow some steps to use the original dll
1)The first step we need to create a strong Name in your .net windows application
2) For adding the dll(provided by the software vendor)(which is written in vb/c++/vc++)to use it in .Net. we need to type the following command Gacutil –i command from the Microsoft visual studio Command Prompt.
3)Software which is developed in vb technology do n't have the faster way of saving the transacted data or punch data in to your Database it saves one by one Record. So the Manufacturer Software or Application will stuck or will not respond if the transactions are larger in the Bio-Metric device. But .net has the advantage to save many transactions in your database at a time
Note:This dll works only in Windows Application
Now I will brief out the steps .
Create a Strong Name :
1.In Solution Explorer select the project and then right click choose Properties.
2.Click the Signing tab.
3.Select the Sign the assembly checkbox.
4.From that Choose a strong name key file: combo box, select
5.In the Create Strong Name Key dialog box, in the Key file name.
6.Close the Signing window.
8.From the Build menu, click Build Solution.
One More way of creating a strong name is from your .Net command prompt
sn -k dll name
After Creating the Strong name use your .Net Command prompt and type GacUtil as below shown in the Code
GacUtil –i and the path of the Original dll after pressing enter it will revert back with resulted dll .Now you want to add the reference of the Dll in your Applications. So right click the solution and add reference and go to .net tab select the dll and add in your application
Ex: GacUtil –i c:\\debug\bin\biometricoriginal name.dll
after adding it Use the import the namespace in your code.
C# using dllname vb: imports dll name
set the Connection of the Bio-metric devices through your .Net Coding: Bio-Metric devices are connected two types
1) serial port :Is by the USB connection we need to specify the port by using Bio metric device settings
2) parallel port :Is by Cable connection we need to set the ipaddress by using Bio metric device settings option
If the dll has a method setconnectdevice than the code look like this
Parllel Connection : cable type
Serial Connection Usb type
ddlname.setconnectdevice(Machinenumber,Port Number )
Fetching the Data: Each Manufacturer provided dll had got its own Methods to retrive the data. By studying the SDK we can know that the exact method that is to retrieve the data. With that method we have to write logic of our own of in and out and punches data according to the Client specifications
If the Dll has Fetchdata as a Method than that
dllname.Fetchdata(string fromdate,string todate,ref out punchdate)
Calculating In and Out punches
Calculation of in and Out Punches are done by first is In punch and second out punch of that particular date.We have to treat the even punches are in -punch and odd punches are Out-punch. If you are using a datatable loop upto rows count...
Than the snippet of the code is like that snippet of code look likes this
After filling the datatable then finally save the data into Database with sqlbulkcopy.So instead of hitting every time database for inserting data. you can hit the database only once and store all the transactions at a time.So with this we eliminate unresponsiveness of the software application for a longer period.