private void CheckBoxAutoOn_CheckedChanged(object sender, EventArgs e) { if (CheckBoxAutoOn.Checked) { _mFpm.EnableAutoOnEvent(true, (int)this.Handle); } else { _mFpm.EnableAutoOnEvent(false, 0); } }
private void AutoReadFingerprint_chk_CheckedChanged(object sender, EventArgs e) { if (AutoReadFingerprint_chk.Checked == true) { m_FPM.EnableAutoOnEvent(true, (int)this.Handle); ReadFingerprintBtn.Enabled = false; } else { m_FPM.EnableAutoOnEvent(false, (int)this.Handle); ReadFingerprintBtn.Enabled = true; } }
private void btnSubmit_Click(object sender, EventArgs e) { DialogResult r = MessageBox.Show("Are you sure you want to SUBMIT?", "SEC LZO", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly); if (r == DialogResult.Yes) { if (IsValidateData()) { using (cnn = new SqlConnection(PatientManagementSystem.Properties.Settings.Default.PatientDBConn)) { cnn.Open(); string insert = "INSERT INTO DoctorRegistration(LastName,FirstName,Gender,Address,Nationality,EmailAddress," + "State,LGA,PhoneNo,Image,Finger1,Finger2,Finger3)" + "VALUES(@LastName,@FirstName,@Gender,@Address,@Nationality,@State,@LGA,@Email," + "@PhoneNo,@Image,@Finger1,@Finger2,@Finger3)"; int k = verify(m_RegMin1, m_RegMin2, m_RegMin3); if (k == -1) { using (cmd = new SqlCommand(insert, cnn)) { cmd.Parameters.AddWithValue("@LastName", txtLastName.Text); cmd.Parameters.AddWithValue("@FirstName", txtFirstName.Text); cmd.Parameters.AddWithValue("@Gender", cmbGender.Text); cmd.Parameters.AddWithValue("@Address", txtAddress.Text); cmd.Parameters.AddWithValue("@Email", txtEmail.Text); cmd.Parameters.AddWithValue("@Nationality", txtNationality.Text); cmd.Parameters.AddWithValue("@State", cmbState.Text); cmd.Parameters.AddWithValue("@LGA", txtLGA.Text); cmd.Parameters.AddWithValue("@PhoneNo", mskPhoneNumber.Text); cmd.Parameters.AddWithValue("@Finger1", m_RegMin1); cmd.Parameters.AddWithValue("@Finger2", m_RegMin2); cmd.Parameters.AddWithValue("@Finger3", m_RegMin3); MemoryStream ms = new MemoryStream(); picImage.Image.Save(ms, picImage.Image.RawFormat); byte[] data = ms.GetBuffer(); SqlParameter p = new SqlParameter("@Image", SqlDbType.Image); p.Value = data; cmd.Parameters.Add(p); cmd.ExecuteNonQuery(); MessageBox.Show("Data Submitted Successfully!", "Patient Registration", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); ClearControls(); } } else { StatusBars.Text = "You Have Registered Before"; m_FPM.EnableAutoOnEvent(false, 0); ClearControls(); } } } } }
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); }
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 btnSubmit_Click(object sender, EventArgs e) { var popup = new PopupNotifier(); popup.Image = Properties.Resources.email; popup.TitleText = "Email Notification"; if (ValidateChildren(ValidationConstraints.Enabled)) { var r = MetroMessageBox.Show(this, @"Are you sure you want to SUBMIT?", @"eVoting System", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (r == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; using (_cnn = new SqlConnection(Properties.Settings.Default.DbConn)) { _cnn.Open(); if (CheckVoter()) { var k = Verify(_mRegMin1, _mRegMin2, _mRegMin3); if (k == -1) { using (_cmd = new SqlCommand("spAddVoter", _cnn)) { _cmd.CommandType = CommandType.StoredProcedure; _cmd.Parameters.AddWithValue("@voterPin", voterPin); _cmd.Parameters.AddWithValue("@firstName", txtFirstname.Text); _cmd.Parameters.AddWithValue("@lastName", txtLastname.Text); _cmd.Parameters.AddWithValue("@gender", cmbGender.Text); _cmd.Parameters.AddWithValue("@phoneNumber", txtPhoneNumber.Text); _cmd.Parameters.AddWithValue("@email", txtEmail.Text); _cmd.Parameters.AddWithValue("m_reg1", _mRegMin1); _cmd.Parameters.AddWithValue("m_reg2", _mRegMin2); _cmd.Parameters.AddWithValue("m_reg3", _mRegMin3); var outParameter = new SqlParameter(); outParameter.ParameterName = "@voterId"; outParameter.SqlDbType = SqlDbType.UniqueIdentifier; outParameter.Direction = ParameterDirection.Output; _cmd.Parameters.Add(outParameter); var ms = new MemoryStream(); picImage.Image.Save(ms, ImageFormat.Bmp); byte[] data = ms.ToArray(); _cmd.Parameters.AddWithValue("@pic", data); try { _cmd.ExecuteNonQuery(); voterId = outParameter.Value.ToString(); var body = string.Format( "Hi, you are registered successfully. " + Environment.NewLine + "Your Security Key is {0}. Your Voter ID is {1}", voterId, voterPin); var emailReply = SendNotifications.SendEmail(txtEmail.Text, body); if (emailReply != null) { popup.ContentText = emailReply; } MetroMessageBox.Show(this, @"Data Submitted Successfully!", @"eVoting System", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); ClearAll(); popup.Popup(); } catch (SqlException ex) { MetroMessageBox.Show(this, @"Data unable to save due to " + ex.Message); } } } else { MetroMessageBox.Show(this, @"You have registered before", @"eVoting System", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); _mFpm.EnableAutoOnEvent(false, 0); } } else { MetroMessageBox.Show(this, @"Fingerprint does no match", @"eVoting System", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } Cursor.Current = Cursors.Default; } } }