コード例 #1
0
        private void btnHacerToma_Click(object sender, EventArgs e)
        {
            clsNeur.Cerrar  = false;
            picHuella.Image = Properties.Resources.huella;

            if (string.IsNullOrEmpty(txtNombre.Text.Trim()) == false && string.IsNullOrEmpty(txtApellidos.Text.Trim()) == false && string.IsNullOrEmpty(txtcedula.Text.Trim()) == false)
            {
                frmCapturando frm = new frmCapturando();

                ThreadStart delegado  = new ThreadStart(timer1_Tick2);
                Thread      _HiloToma = new Thread(delegado);
                _HiloToma.Start();

                frm.ShowDialog();

                if (enrollmentResult.engineStatus == NffvStatus.TemplateCreated)
                {
                    NffvUser engineUser = enrollmentResult.engineUser;
                    string   strUsuario = txtcedula.Text.Trim();
                    if (strUsuario.Length <= 0)
                    {
                        strUsuario = engineUser.Id.ToString();
                    }

                    clsBasedeDatos clsBasedeDatos = new clsBasedeDatos();

                    if (clsBasedeDatos.RegistroPersona(txtcedula.Text.Trim(), txtNombre.Text.Trim(), txtApellidos.Text.Trim(), Clases.clsProcedimientos.Session["strUsuario"], engineUser.Id.ToString(), txttelefono.Text, txtSexo.Text, txtDireccion.Text) == true)
                    {
                        _userDB.Add(new UserRecord(engineUser.Id, strUsuario));

                        try
                        {
                            _userDB.WriteToFile(_userDatabaseFile);
                        }
                        catch
                        {
                            clsBasedeDatos = null;
                        }

                        picHuella.Image = engineUser.GetBitmap();
                        lbDatabase.Items.Add(new CData(engineUser, strUsuario));
                        MessageBox.Show("Persona Matriculada Exitosamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        txtApellidos.Text = "";
                        txtcedula.Text    = "";
                        txtDireccion.Text = "";
                        txtNombre.Text    = "";
                        txtSexo.Text      = "";
                        txttelefono.Text  = "";
                    }
                    else
                    {
                        _userDB.Remove(_userDB.Lookup(engineUser.Id));
                        _userDB.WriteToFile(_userDatabaseFile);
                        _engine.Users.RemoveAt(engineUser.Id);
                        picHuella.Image = Properties.Resources.huella;

                        MessageBox.Show("Ha Ocurrido un error, es posible que la persona ya exista", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtApellidos.Text = "";
                        txtcedula.Text    = "";
                        txtDireccion.Text = "";
                        txtNombre.Text    = "";
                        txtSexo.Text      = "";
                        txttelefono.Text  = "";
                    }
                }
                else
                {
                    picHuella.Image = Properties.Resources.huella;
                    NffvStatus engineStatus = enrollmentResult.engineStatus;
                    MessageBox.Show(String.Format("el enrolamiento no pudo finalizar. motivo: {0}", engineStatus, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning));
                    txtApellidos.Text = "";
                    txtcedula.Text    = "";
                    txtDireccion.Text = "";
                    txtNombre.Text    = "";
                    txtSexo.Text      = "";
                    txttelefono.Text  = "";
                }
            }
            else
            {
                picHuella.Image = Properties.Resources.huella;

                MessageBox.Show("Debe llenar todos los campos requeridos para la matricula", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #2
0
 public JsonResult Add(userMaster ur)
 {
     return(Json(user.Add(ur), JsonRequestBehavior.AllowGet));
 }