Ejemplo n.º 1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.Text = this.Text + " - Patient Management System";
     m_LedOn   = false;
     m_FPM     = new SGFingerPrintManager();
     EnumerateBtn_Click(sender, e);
 }
Ejemplo n.º 2
0
        private void FrmElectionModule_Load(object sender, EventArgs e)
        {
            _mLedOn = false;

            _mRegMin1 = new Byte[400];
            _mRegMin2 = new Byte[400];

            _mFpm = new SGFingerPrintManager();
            EnumerateBtn_Click(sender, e);

            using (_cnn = new SqlConnection(Settings.Default.DbConn))
            {
                _cnn.Open();
                using (_cmd = new SqlCommand("Select ElectionId, ElectionPost, NoOfCandidates From AddNewElection", _cnn))
                {
                    using (_dr = _cmd.ExecuteReader())
                    {
                        while (_dr.Read())
                        {
                            cmbElectionId.Items.Add(_dr["ElectionPost"].ToString());
                            _electionList.Add(new Election()
                            {
                                ElectionId     = _dr["ElectionId"].ToString(),
                                Post           = _dr["ElectionPost"].ToString(),
                                NoOfCandidates = (int)_dr["NoOfCandidates"]
                            });
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public FormEnroll()
 {
     Application.EnableVisualStyles();
     InitializeComponent();
     fpm = new SGFingerPrintManager();
     fpm.Init(SGFPMDeviceName.DEV_FDU05);
     fpm.OpenDevice((Int32)SGFPMPortAddr.USB_AUTO_DETECT);
     fpm.SetTemplateFormat(SGFPMTemplateFormat.ANSI378);
     pictureBoxPicture.BackgroundImageLayout = ImageLayout.Zoom;
     Application.Idle += new EventHandler(delegate(object sender, EventArgs e)
     {
         if (picture != null || studentId == 0)
         {
             return;
         }
         if (capture == null)
         {
             capture = new VideoCapture(0, VideoCapture.API.DShow);
             capture.FlipHorizontal = true;
             // capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps, 10);
             // capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.Buffersuze, 1);
             // capture.Start();
         }
         if (capture.IsOpened)
         {
             Bitmap frame = capture.QueryFrame().Bitmap;
             pictureBoxPicture.BackgroundImage = frame;
         }
     });
 }
Ejemplo n.º 4
0
        private void TakeElection_Load(object sender, EventArgs e)
        {
            m_LedOn = false;

            m_RegMin1 = new Byte[400];
            m_RegMin2 = new Byte[400];
            m_VrfMin  = new Byte[400];
            m_FPM     = new SGFingerPrintManager();
            EnumerateBtn_Click(sender, e);
        }
Ejemplo n.º 5
0
        private void InitFingerPrint()
        {
            m_FPM = new SGFingerPrintManager();
            var iError = m_FPM.Init(SGFPMDeviceName.DEV_AUTO);

            if (iError != (int)SGFPMError.ERROR_NONE)
            {
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            EnableButtons(false);
            // Init Button
            m_RadioButton = new RadioButton[11];


            m_SecurityLevel  = SGFPMSecurityLevel.NORMAL;
            m_StoredTemplate = null;
            m_ImageWidth     = 260;
            m_ImageHeight    = 300;
            m_Dpi            = 500;

            m_FPM = new SGFingerPrintManager();
            Int32  iError;
            string enum_device;

            comboBox1.Items.Clear();

            // Enumerate Device
            iError = m_FPM.EnumerateDevice();

            // Get enumeration info into SGFPMDeviceList
            m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice];

            for (int i = 0; i < m_FPM.NumberOfDevice; i++)
            {
                m_DevList[i] = new SGFPMDeviceList();
                m_FPM.GetEnumDeviceInfo(i, m_DevList[i]);
                enum_device = m_DevList[i].DevName.ToString() + " : " + m_DevList[i].DevID;
                comboBox1.Items.Add(enum_device);
            }

            if (comboBox1.Items.Count > 0)
            {
                // Add Auto Selection
                enum_device = "Auto Selection";
                comboBox1.Items.Add(enum_device);

                comboBox1.SelectedIndex = 0;  //First selected one
            }

            StatusBar.Text = "Click Init Button";

            if (m_useAnsiTemplate)
            {
                StatusBar.Text = "Format used: ANSI 378 Format";
            }
            else
            {
                StatusBar.Text = "Format used: ISO 19794-2 Format";
            }
        }
Ejemplo n.º 7
0
 public FormTimeclock()
 {
     timer                     = new System.Timers.Timer(5000);
     timer.Elapsed            += Reset;
     timer.SynchronizingObject = this;
     Application.EnableVisualStyles();
     InitializeComponent();
     fpm = new SGFingerPrintManager();
     fpm.Init(SGFPMDeviceName.DEV_FDU05);
     fpm.OpenDevice((Int32)SGFPMPortAddr.USB_AUTO_DETECT);
     fpm.SetTemplateFormat(SGFPMTemplateFormat.ANSI378);
     fpm.EnableAutoOnEvent(true, (int)this.Handle);
 }
Ejemplo n.º 8
0
        private void InitializeDevice()
        {
            m_FPM = new SGFingerPrintManager();

            Int32           error;
            SGFPMDeviceName device_name = SGFPMDeviceName.DEV_AUTO;
            Int32           device_id   = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;

            m_SecurityLevel = SGFPMSecurityLevel.NORMAL;

            m_DeviceOpened = false;


            error = m_FPM.Init(device_name);
            if (error != (Int32)SGFPMError.ERROR_NONE)
            {
                error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi);
            }

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                m_FPM.CloseDevice();
                error = m_FPM.OpenDevice(device_id);
            }
            else
            {
                throw new ApplicationException("Unable to initialize scanner. Kindly check the connection");
            }

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
                m_FPM.GetDeviceInfo(pInfo);
                m_ImageWidth  = pInfo.ImageWidth;
                m_ImageHeight = pInfo.ImageHeight;
                m_Dpi         = pInfo.ImageDPI;
                serialNo      = pInfo.DeviceID;
            }

            error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ISO19794);
            error = m_FPM.GetMaxTemplateSize(ref max_template_size);

            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.OpenDevice(device_id);
                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    m_DeviceOpened = true;
                }
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            btnDelete.Enabled = false;
            btnUpdate.Enabled = false;
            EnablePanel(false);
            _mLedOn = false;
            _mFpm   = new SGFingerPrintManager();
            EnumerateBtn_Click(sender, e);

            tbRegistration.SelectedTab = tbVoterInfo;
            var voterRegistration = new VoterRegistration();

            voterPin = voterRegistration.GetVoterId();
        }
Ejemplo n.º 10
0
        public MatcherInitResult Initialize()
        {
            MatcherInitResult result = new MatcherInitResult();

            m_SecurityLevel    = SGFPMSecurityLevel.NORMAL;
            sourceMatch        = null;
            m_ImageWidth       = 260;
            m_ImageHeight      = 300;
            m_Dpi              = 500;
            fingerprintManager = new SGFingerPrintManager();

            //SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN;
            int error = fingerprintManager.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi);

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                result.Message = "Initialization Success";
                result.Success = true;
            }
            else
            {
                result.Message = "Init() Error " + error;
                return(result);
            }

            if (m_useAnsiTemplate)
            {
                // Set template format to ANSI 378
                error = fingerprintManager.SetTemplateFormat(SGFPMTemplateFormat.ANSI378);
            }
            else
            {
                // Set template format to ISO 19794-2
                error = fingerprintManager.SetTemplateFormat(SGFPMTemplateFormat.ISO19794);
            }

            Int32 max_template_size = 0;

            error = fingerprintManager.GetMaxTemplateSize(ref max_template_size);

            //m_RegMin1 = new Byte[max_template_size];
            //m_RegMin2 = new Byte[max_template_size];
            //m_VrfMin = new Byte[max_template_size];

            _isInitialized = true;
            return(result);
        }
Ejemplo n.º 11
0
        private void Attendance_Load(object sender, EventArgs e)
        {
            m_LedOn = false;

            m_SecurityLevel  = SGFPMSecurityLevel.NORMAL;
            m_StoredTemplate = null;
            m_ImageWidth     = 260;
            m_ImageHeight    = 300;
            m_Dpi            = 500;

            EnableButtons(false);


            m_FPM = new SGFingerPrintManager();
            Int32  iError;
            string enum_device;

            comboBox2.Items.Clear();

            // Enumerate Device
            iError = m_FPM.EnumerateDevice();

            // Get enumeration info into SGFPMDeviceList
            m_DevList = new SGFPMDeviceList[m_FPM.NumberOfDevice];

            for (int i = 0; i < m_FPM.NumberOfDevice; i++)
            {
                m_DevList[i] = new SGFPMDeviceList();
                m_FPM.GetEnumDeviceInfo(i, m_DevList[i]);
                enum_device = m_DevList[i].DevName.ToString() + " : " + m_DevList[i].DevID;
                comboBox2.Items.Add(enum_device);
            }

            if (comboBox2.Items.Count > 0)
            {
                // Add Auto Selection
                enum_device = "Auto Selection";
                comboBox2.Items.Add(enum_device);

                comboBox2.SelectedIndex = 0;  //First selected one
            }
        }
Ejemplo n.º 12
0
        /////////////////////////////////////
        private void Form1_Load(object sender, System.EventArgs e)
        {
            EnableButtons(false);
            // Init Button
            m_RadioButton     = new RadioButton[11];
            m_RadioButton[0]  = FPPosUnknown;
            m_RadioButton[1]  = FPPosRightThumb;
            m_RadioButton[2]  = FPPosRightIndex;
            m_RadioButton[3]  = FPPosRightMiddle;
            m_RadioButton[4]  = FPPosRightRing;
            m_RadioButton[5]  = FPPosRightLittle;
            m_RadioButton[6]  = FPPosLeftThumb;
            m_RadioButton[7]  = FPPosLeftIndex;
            m_RadioButton[8]  = FPPosLeftMiddle;
            m_RadioButton[9]  = FPPosLeftRing;
            m_RadioButton[10] = FPPosLeftLittle;

            comboBoxDeviceName.SelectedIndex = 0;
            comboBoxSelFinger.SelectedIndex  = 0;

            m_SecurityLevel  = SGFPMSecurityLevel.NORMAL;
            m_StoredTemplate = null;
            m_ImageWidth     = 260;
            m_ImageHeight    = 300;
            m_Dpi            = 500;
            m_FPM            = new SGFingerPrintManager();

            StatusBar.Text = "Click Init Button";

            if (m_useAnsiTemplate)
            {
                this.Text = "Matching Test: ANSI 378 Format";
            }
            else
            {
                this.Text = "Matching Test: ISO 19794-2 Format";
            }
        }
Ejemplo n.º 13
0
        private void button4_Click(object sender, EventArgs e)
        {
            m_ImageWidth  = 260;
            m_ImageHeight = 300;
            m_Dpi         = 500;
            m_FPM         = new SGFingerPrintManager();
            Int32           error;
            SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN;
            Int32           device_id   = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;

            device_name = SGFPMDeviceName.DEV_AUTO;

            m_DeviceOpened = false;

            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.Init(device_name);
            }
            else
            {
                error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi);
            }

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
                m_FPM.GetDeviceInfo(pInfo);
                m_ImageWidth         = pInfo.ImageWidth;
                m_ImageHeight        = pInfo.ImageHeight;
                StatusBar.Text       = "Initialization Success";
                pictureBox1.Visible  = true;
                progressBar1.Visible = true;
                button3.Visible      = true;
                button4.Visible      = false;
            }
            else
            {
                StatusBar.Text = "Init() Error " + error;
                return;
            }

            // Set template format to ANSI 378
            error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378);

            // Get Max template size
            Int32 max_template_size = 0;

            error = m_FPM.GetMaxTemplateSize(ref max_template_size);

            m_RegMin1 = new Byte[max_template_size];
            m_RegMin2 = new Byte[max_template_size];
            m_VrfMin  = new Byte[max_template_size];

            // OpenDevice if device is selected
            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.OpenDevice(device_id);
                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    m_DeviceOpened = true;
                }
                else
                {
                    StatusBar.Text = "OpenDevice() Error : " + error;
                }
            }
        }
        private void NuevaEntradaSalidaBitacora_Load(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            string appPath2 = Path.GetDirectoryName(Application.ExecutablePath);
            ///create the connection string
            string connString = @"Data Source= " + appPath2 + @"\DBBIT.s3db ;Version=3;";

            //create the database query
            string query = "SELECT * FROM Entradas";

            //create an OleDbDataAdapter to execute the query
            System.Data.SQLite.SQLiteDataAdapter dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString);

            //create a command builder
            System.Data.SQLite.SQLiteCommandBuilder cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter);

            //create a DataTable to hold the query results
            DataTable dTable = new DataTable();
            //fill the DataTable
            dAdapter.Fill(dTable);
            dAdapter.Update(dTable);

            if (dTable.Rows.Count != 0)
            {
                DataRow Row = dTable.Rows[dTable.Rows.Count - 1];
                string num = Row["Numero"].ToString();
                int autonum = Int32.Parse(num);
                label1.Text = (autonum + 1).ToString();
            }
            else
            {
                label1.Text = "1";
            }

            //create the database query
            query = "SELECT * FROM Salidas";

            //create an OleDbDataAdapter to execute the query
            dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString);

            //create a command builder
            cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter);

            //create a DataTable to hold the query results
            dTable = new DataTable();
            //fill the DataTable
            dAdapter.Fill(dTable);
            dAdapter.Update(dTable);

            if (dTable.Rows.Count != 0)
            {
                DataRow Row = dTable.Rows[dTable.Rows.Count - 1];
                string num = Row["Numero"].ToString();
                int autonum = Int32.Parse(num);
                label12.Text = (autonum + 1).ToString();
            }
            else
            {
                label12.Text = "1";
            }

            m_ImageWidth = 260;
            m_ImageHeight = 300;
            m_Dpi = 500;
            m_FPM = new SGFingerPrintManager();
            Int32 error;
            SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN;
            Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;
            device_name = SGFPMDeviceName.DEV_AUTO;

            m_DeviceOpened = false;

            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
                error = m_FPM.Init(device_name);
            else
                error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi);

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
                m_FPM.GetDeviceInfo(pInfo);
                m_ImageWidth = pInfo.ImageWidth;
                m_ImageHeight = pInfo.ImageHeight;
                StatusBar.Text = "Initialization Success";
                pictureBox1.Visible = true;
                progressBar1.Visible = true;
                button3.Visible = true;
                button4.Visible = false;
            }
            else
            {
                StatusBar.Text = "Init() Error " + error;
                return;
            }

            // Set template format to ANSI 378
            error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378);

            // Get Max template size
            Int32 max_template_size = 0;
            error = m_FPM.GetMaxTemplateSize(ref max_template_size);

            m_RegMin1 = new Byte[max_template_size];
            m_RegMin2 = new Byte[max_template_size];
            m_VrfMin = new Byte[max_template_size];

            // OpenDevice if device is selected
            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.OpenDevice(device_id);
                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    m_DeviceOpened = true;

                }
                else
                {
                    StatusBar.Text = "OpenDevice() Error : " + error;
                }
            }
        }
Ejemplo n.º 15
0
        public static bool Check(DashBoardForm dashboard)
        {
            // Creating directory objects for application folder
            DirectoryOps.DefaultApplicationDirectory defaultDir =
                new DirectoryOps.DefaultApplicationDirectory(Program.defaultApplicationDirName);
            DirectoryOps.DefaultApplicationDirectory defaultDatabaseDir =
                new DirectoryOps.DefaultApplicationDirectory(Program.defaultApplicationDatabaseDirName);
            DirectoryOps.DefaultApplicationDirectory defaultMatlabDir =
                new DirectoryOps.DefaultApplicationDirectory(Program.defaultMatlabFunctionDirName);
            DirectoryOps.DefaultApplicationDirectory defaultTempDir =
                new DirectoryOps.DefaultApplicationDirectory(Program.defaultApplicationTempDir);

            // Opening Operation Objects for each folder.
            DirectoryOps.DirectoryOperation dirOperations =
                new DirectoryOps.DirectoryOperation(defaultDir);
            DirectoryOps.DirectoryOperation dbDirOperations =
                new DirectoryOps.DirectoryOperation(defaultDatabaseDir);
            DirectoryOps.DirectoryOperation matlabDirOperations =
                new DirectoryOps.DirectoryOperation(defaultMatlabDir);
            DirectoryOps.DirectoryOperation tempDirOperations =
                new DirectoryOps.DirectoryOperation(defaultTempDir);

            // If application Folder and application database folder
            // do not exist create them.
            if (!dirOperations.Exists())
            {
                dirOperations.Create();
            }
            if (!dbDirOperations.Exists())
            {
                dbDirOperations.Create();
            }
            if (!matlabDirOperations.Exists())
            {
                matlabDirOperations.Create();
            }
            if (!tempDirOperations.Exists())
            {
                tempDirOperations.Create();
            }

            // Checking if Fingerprint Machine is Connected
            SGFingerPrintManager m_FPM       = new SGFingerPrintManager();
            SGFPMDeviceName      device_name = SGFPMDeviceName.DEV_FDU03;

            //...Initializing Port Address
            Int32 port_addr = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;

            m_FPM.Init(device_name);
            Int32 iError = m_FPM.OpenDevice(port_addr);

            if (iError != (Int32)SGFPMError.ERROR_NONE)
            {
                DialogResult res = MessageBox.Show(dashboard, "Are you sure you want to continue with out a fingerprint sensor?",
                                                   "Fingerprint Sensor not Connected", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                Console.WriteLine("Openning Device Error : " + iError);
                if (res == DialogResult.No)
                {
                    dashboard.Close();
                    return(false);
                }
                dashboard.fp_device_connected(false); // Tell dashboard sensor is not connected
            }
            dashboard.fp_device_connected(true);      // Tell dashboard sensor is connected
            return(true);
        }
Ejemplo n.º 16
0
 public FingerPrintHelper()
 {
     SecuGen.Loader.LoadAssemblies();
     m_FPM = new SGFingerPrintManager();
 }
Ejemplo n.º 17
0
 public void Initialize()
 {
     m_FPM = new SGFingerPrintManager();
     var err = m_FPM.InitEx(260, 300, 500);
 }
Ejemplo n.º 18
0
        private void frmCastVote_Load(object sender, System.EventArgs e)
        {
            _voterId = VoterId;
            positionToolStripTextBox.SelectedIndex = 0;
            fillToolStripButton_Click_2(null,null);

            _mLedOn = false;

            _mRegMin1 = new Byte[400];
            _mRegMin2 = new Byte[400];

            _mFpm = new SGFingerPrintManager();
            EnumerateBtn_Click(sender, e);
        }
Ejemplo n.º 19
0
        private void AccountForm_Load(object sender, EventArgs e)
        {
            // Adding AccountTypes to Selection ComboBox
            using (LeafSecurityEntities db = new LeafSecurityEntities())
            {
                // Populating ComboList with AccountType(s).
                foreach (AccountType aType in db.AccountTypes)
                {
                    accountTypeCombo.Items.Add(aType.TypeName);
                }

                if (m_accountInformation != null)
                {
                    // Gathering User Information
                    UserInformation userInfo = (from acc in db.UserInformations
                                                where acc.AccountID == m_accountInformation.AccountID
                                                select acc).First();
                    int accType = userInfo.AccountInformation.AccountType.TypeID;

                    // Setting up AccountForm()
                    // User Information
                    firstNameTxt.Text = userInfo.FirstName.ToString();
                    lastNameTxt.Text  = userInfo.LastName;
                    if (userInfo.Email != null)
                    {
                        emailTxt.Text = userInfo.Email;
                    }
                    if (userInfo.PhoneNumber != null)
                    {
                        phoneNumberTxt.Text = userInfo.PhoneNumber;
                    }
                    if (userInfo.Address != null)
                    {
                        addressTxt.Text = userInfo.Address;
                    }
                    // If Admin Account Selected
                    if (accType.Equals(1))
                    {
                        accountTypeCombo.SelectedItem = accountTypeCombo.Items[0];
                        passwordTxt.Text        = m_accountInformation.AccountUsername;
                        confirmPasswordTxt.Text = m_accountInformation.AccountUsername;
                        stringHashTxt.Text      = "Admin Account Doesn't Contain This Item.";
                    }
                    // If User Account Seleted
                    else
                    {
                        accountTypeCombo.SelectedIndex = 1;
                        passwordTxt.Text = m_accountInformation.AccountUsername;
                    }
                    // AccountInformation
                    usernameTxt.Text = userInfo.AccountInformation.AccountNumber;
                    // BiometricInformation
                    if (accType.Equals(2))
                    {
                        // Gathering Fingerprint Information
                        FingerprintTemplate fingerTemplate = (from acc in db.FingerprintTemplates
                                                              where acc.AccountID == m_accountInformation.AccountID
                                                              select acc).First();
                        // Only works for User Accounts
                        stringHashTxt.Text      = Path.GetFileName(fingerTemplate.MinutiaeTemplatePath.TemplatePath);
                        generateHashBtn.Enabled = false;
                    }
                }
            }

            // Enabling Sensor(s)
            m_FPM       = new SGFingerPrintManager();
            device_name = SGFPMDeviceName.DEV_FDU03;
            // ...Initializing Port Address
            port_addr = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;
            // ...Initializing Device (HSDUO03P)
            m_FPM.Init(device_name);
            iError = m_FPM.OpenDevice(port_addr);
            fingerprint_device_connected = true;
            if (iError != (Int32)SGFPMError.ERROR_NONE)
            {
                //DialogResult res = MessageBox.Show(this, "Are you sure you have a fingerprint sensor connected?",
                //    "Fingerprint Sensor not Connected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Console.WriteLine("OpenDevice() Error : " + iError);
                fingerprint_device_connected = false;
            }

            if (fingerprint_device_connected)
            {
                // Hiding Some Controls,
                // These controls are only used when fingerprint is not available.
                imageFilePath.Hide();
                templatePathLbl.Hide();
                openTempFileBtn.Hide();
                groupBox3.Height = 450;

                // ...Enabling Auto-On Feature
                m_FPM.EnableAutoOnEvent(true, (int)this.Handle);
                AutoReadFingerprint_chk.Checked = true;

                // Getting Device Info
                SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
                pInfo  = new SGFPMDeviceInfoParam();
                iError = m_FPM.GetDeviceInfo(pInfo);

                if (iError == (Int32)SGFPMError.ERROR_NONE)
                {
                    img_w   = pInfo.ImageWidth;
                    img_h   = pInfo.ImageHeight;
                    img_dpi = pInfo.ImageDPI;
                }
            }
            else
            {
                // Hiding Some Controls,
                // These controls are only used when fingerprint is available.
                FingerprintPreviewBox.Hide();
                AutoReadFingerprint_chk.Hide();
                ReadFingerprintBtn.Hide();
                fingerprint_preview_lbl.Hide();
            }

            // disabling buttons that are used afer selecting account type
            AutoReadFingerprint_chk.Checked = false;
            AutoReadFingerprint_chk.Enabled = false;
            FingerprintPreviewBox.Hide();
            copyHashBtn.Enabled        = false;
            ReadFingerprintBtn.Enabled = false;
            openTempFileBtn.Enabled    = false;
            imageFilePath.Enabled      = false;
        }
        private void frmVoterRegistration_Load(object sender, System.EventArgs e)
        {
            EnableButtons(false);
            _mLedOn = false;
            _mFpm = new SGFingerPrintManager();
            EnumerateBtn_Click(sender, e);

            using (_cnn = new SqlConnection(Settings.Default.DBConn))
            {
                _cnn.Open();
                using (_cmd = new SqlCommand("Select LevelID From Level", _cnn))
                {
                    using (_dr = _cmd.ExecuteReader())
                    {
                        while (_dr.Read())
                            cmbLevel.Items.Add(_dr["LevelID"].ToString());
                    }
                }
            }
        }
Ejemplo n.º 21
0
        private void NuevaEntradaSalidaBitacora_Load(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
            string appPath2 = Path.GetDirectoryName(Application.ExecutablePath);
            ///create the connection string
            string connString = @"Data Source= " + appPath2 + @"\DBBIT.s3db ;Version=3;";

            //create the database query
            string query = "SELECT * FROM Entradas";

            //create an OleDbDataAdapter to execute the query
            System.Data.SQLite.SQLiteDataAdapter dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString);

            //create a command builder
            System.Data.SQLite.SQLiteCommandBuilder cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter);

            //create a DataTable to hold the query results
            DataTable dTable = new DataTable();

            //fill the DataTable
            dAdapter.Fill(dTable);
            dAdapter.Update(dTable);


            if (dTable.Rows.Count != 0)
            {
                DataRow Row     = dTable.Rows[dTable.Rows.Count - 1];
                string  num     = Row["Numero"].ToString();
                int     autonum = Int32.Parse(num);
                label1.Text = (autonum + 1).ToString();
            }
            else
            {
                label1.Text = "1";
            }



            //create the database query
            query = "SELECT * FROM Salidas";

            //create an OleDbDataAdapter to execute the query
            dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString);

            //create a command builder
            cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter);

            //create a DataTable to hold the query results
            dTable = new DataTable();
            //fill the DataTable
            dAdapter.Fill(dTable);
            dAdapter.Update(dTable);


            if (dTable.Rows.Count != 0)
            {
                DataRow Row     = dTable.Rows[dTable.Rows.Count - 1];
                string  num     = Row["Numero"].ToString();
                int     autonum = Int32.Parse(num);
                label12.Text = (autonum + 1).ToString();
            }
            else
            {
                label12.Text = "1";
            }

            m_ImageWidth  = 260;
            m_ImageHeight = 300;
            m_Dpi         = 500;
            m_FPM         = new SGFingerPrintManager();
            Int32           error;
            SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN;
            Int32           device_id   = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;

            device_name = SGFPMDeviceName.DEV_AUTO;

            m_DeviceOpened = false;

            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.Init(device_name);
            }
            else
            {
                error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi);
            }

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
                m_FPM.GetDeviceInfo(pInfo);
                m_ImageWidth         = pInfo.ImageWidth;
                m_ImageHeight        = pInfo.ImageHeight;
                StatusBar.Text       = "Initialization Success";
                pictureBox1.Visible  = true;
                progressBar1.Visible = true;
                button3.Visible      = true;
                button4.Visible      = false;
            }
            else
            {
                StatusBar.Text = "Init() Error " + error;
                return;
            }

            // Set template format to ANSI 378
            error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378);

            // Get Max template size
            Int32 max_template_size = 0;

            error = m_FPM.GetMaxTemplateSize(ref max_template_size);

            m_RegMin1 = new Byte[max_template_size];
            m_RegMin2 = new Byte[max_template_size];
            m_VrfMin  = new Byte[max_template_size];

            // OpenDevice if device is selected
            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.OpenDevice(device_id);
                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    m_DeviceOpened = true;
                }
                else
                {
                    StatusBar.Text = "OpenDevice() Error : " + error;
                }
            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            m_SecurityLevel = SGFPMSecurityLevel.NORMAL;
            m_StoredTemplate = null;
            m_ImageWidth = 260;
            m_ImageHeight = 300;
            m_Dpi = 500;
            m_FPM = new SGFingerPrintManager();

            Int32 error;
            SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN;
            Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT;
            device_name = SGFPMDeviceName.DEV_AUTO;

            m_DeviceOpened = false;

            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
                error = m_FPM.Init(device_name);
            else
                error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi);

            if (error == (Int32)SGFPMError.ERROR_NONE)
            {
                SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
                m_FPM.GetDeviceInfo(pInfo);
                m_ImageWidth = pInfo.ImageWidth;
                m_ImageHeight = pInfo.ImageHeight;
                StatusBar.Text = "Initialization Success";

                this.Height = 453;
                this.Width = 820;

                pictureBox1.Enabled = true;
                pictureBox2.Enabled = true;
                PB1.Enabled = true;
                PB2.Enabled = true;
                button3.Enabled = true;
                button4.Enabled = true;

                button1.Enabled = false;
                textBox2.Enabled = false;

                button5.Enabled = false;
                button5.Visible = false;

                button6.Visible = true;
                button6.Enabled = true;
            }
            else
            {
                StatusBar.Text = "Init() Error " + error;
                return;
            }

            // Set template format to ANSI 378
            error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378);

            // Get Max template size
            Int32 max_template_size = 0;
            error = m_FPM.GetMaxTemplateSize(ref max_template_size);

            m_RegMin1 = new Byte[max_template_size];
            m_RegMin2 = new Byte[max_template_size];
            m_VrfMin = new Byte[max_template_size];

            // OpenDevice if device is selected
            if (device_name != SGFPMDeviceName.DEV_UNKNOWN)
            {
                error = m_FPM.OpenDevice(device_id);
                if (error == (Int32)SGFPMError.ERROR_NONE)
                {
                    m_DeviceOpened = true;
                }
                else
                {
                    StatusBar.Text = "OpenDevice() Error : " + error;
                }
            }
        }
Ejemplo n.º 23
0
 private void frmTestaBiometria_Load(object sender, EventArgs e)
 {
     GetUsuarios();
     m_FPM = new SGFingerPrintManager();
 }
        private void frmVoterVerification_Load(object sender, System.EventArgs e)
        {
            _mLedOn = false;

            _mRegMin1 = new Byte[400];
            _mRegMin2 = new Byte[400];

            _mFpm = new SGFingerPrintManager();
            EnumerateBtn_Click(sender, e);
        }