private void dataGridViewFP_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            if (dataGridViewFP.IsCurrentCellDirty &&
                dataGridViewFP.CurrentCell is DataGridViewCheckBoxCell)
            {
                var current = dataGridViewFP.CurrentCell;
                var enrollName = dataGridViewFP.Rows[current.RowIndex].Cells[0].Value.ToString();
                var finger = current.ColumnIndex - 2;
                var value = (bool)dataGridViewFP.Rows[current.RowIndex].Cells[current.ColumnIndex].Value;

                if (value)
                {
                    if (MessageBox.Show(@"¿Desea eliminar la huella digital capturada?", "", MessageBoxButtons.YesNo) ==
                        DialogResult.No)
                    {
                        dataGridViewFP.CancelEdit();

                    }
                    dataGridViewFP.CommitEdit(DataGridViewDataErrorContexts.Commit);
                    _service.UpdateUserFingerPrint(enrollName, finger, null, Service.FingerPrintOperation.Delete);
                }
                else
                {
                    var deviceId = long.Parse(cboDevices.SelectedValue.ToString());

                    var frm = new FrmEnroll();
                    frm.Show(this);
                    Work();

                    _service.ClearEvents();
                    _service.EnrollCompleted += (o, args) =>
                    {
                        frm.Close();
                        End();
                        if (!args.Result)
                        {
                            dataGridViewFP.CancelEdit();
                            return;
                        }
                        dataGridViewFP.CommitEdit(DataGridViewDataErrorContexts.Commit);
                        _service.UpdateUserFingerPrint(enrollName, args.Finger, args.FingerPrint, Service.FingerPrintOperation.Update);
                    };

                    _service.Enroll(deviceId, enrollName, finger);
                }
            }
        }
Exemplo n.º 2
0
        private void dataGridViewFP_CurrentCellDirtyStateChanged(object sender, EventArgs e)
        {
            if (dataGridViewFP.IsCurrentCellDirty &&
                dataGridViewFP.CurrentCell is DataGridViewCheckBoxCell)
            {
                var current    = dataGridViewFP.CurrentCell;
                var enrollName = dataGridViewFP.Rows[current.RowIndex].Cells[0].Value.ToString();
                var finger     = current.ColumnIndex - 2;
                var value      = (bool)dataGridViewFP.Rows[current.RowIndex].Cells[current.ColumnIndex].Value;

                if (value)
                {
                    if (MessageBox.Show(@"¿Desea eliminar la huella digital capturada?", "", MessageBoxButtons.YesNo) ==
                        DialogResult.No)
                    {
                        dataGridViewFP.CancelEdit();
                    }
                    dataGridViewFP.CommitEdit(DataGridViewDataErrorContexts.Commit);
                    _service.UpdateUserFingerPrint(enrollName, finger, null, Service.FingerPrintOperation.Delete);
                }
                else
                {
                    var deviceId = long.Parse(cboDevices.SelectedValue.ToString());

                    var frm = new FrmEnroll();
                    frm.Show(this);
                    Work();

                    _service.ClearEvents();
                    _service.EnrollCompleted += (o, args) =>
                    {
                        frm.Close();
                        End();
                        if (!args.Result)
                        {
                            dataGridViewFP.CancelEdit();
                            return;
                        }
                        dataGridViewFP.CommitEdit(DataGridViewDataErrorContexts.Commit);
                        _service.UpdateUserFingerPrint(enrollName, args.Finger, args.FingerPrint, Service.FingerPrintOperation.Update);
                    };

                    _service.Enroll(deviceId, enrollName, finger);
                }
            }
        }