Пример #1
0
        private void btnDBRemove_Click(object sender, System.EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("Deseja realmente apagar o resgistro?", "Excluir registro", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);

            uint nUserID;
            byte nFingerID;

            if (listSearchDB.Items.Count <= 0)
            {
                return;
            }

            if (listSearchDB.SelectedItems.Count <= 0)
            {
                MessageBox.Show("Selecione um item ...", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            uint ret          = NBioAPI.Error.NONE;
            bool bIsRemoveAll = true;

            for (int i = listSearchDB.SelectedItems.Count - 1; i >= 0; i--)
            {
                nUserID   = Convert.ToUInt32(listSearchDB.SelectedItems[i].Text);
                nFingerID = Convert.ToByte(listSearchDB.SelectedItems[i].SubItems[i].Text);

                ret = m_IndexSearch.RemoveData(nUserID, nFingerID, Byte.MaxValue);
                if (ret != NBioAPI.Error.NONE)
                {
                    bIsRemoveAll = false;
                    break;
                }
            }

            if (confirm.ToString().ToUpper() == "YES" || listSearchDB.SelectedItems.Count <= 0)
            {
                if (bIsRemoveAll)
                {
                    for (int i = listSearchDB.SelectedItems.Count - 1; i >= 0; i--)
                    {
                        listSearchDB.SelectedItems[i].Remove();
                    }
                    MessageBox.Show("Usuário deletado com sucesso!");
                }
                else
                {
                    DisplayErrorMsg(ret);
                }
            }

            btnSaveFile_Click(sender, e);
        }
Пример #2
0
        private void btnDBRemove_Click(object sender, System.EventArgs e)
        {
            uint nUserID;
            byte nFingerID, nSampleNumber;

            if (listSearchDB.Items.Count <= 0)
            {
                return;
            }

            if (listSearchDB.SelectedItems.Count <= 0)
            {
                MessageBox.Show("Select item ...", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            uint ret          = NBioAPI.Error.NONE;
            bool bIsRemoveAll = true;

            for (int i = listSearchDB.SelectedItems.Count - 1; i >= 0; i--)
            {
                nUserID       = Convert.ToUInt32(listSearchDB.SelectedItems[i].Text);
                nFingerID     = Convert.ToByte(listSearchDB.SelectedItems[i].SubItems[1].Text);
                nSampleNumber = Convert.ToByte(listSearchDB.SelectedItems[i].SubItems[2].Text);

                ret = m_IndexSearch.RemoveData(nUserID, nFingerID, nSampleNumber);
                if (ret != NBioAPI.Error.NONE)
                {
                    bIsRemoveAll = false;
                    break;
                }
            }

            if (bIsRemoveAll)
            {
                for (int i = listSearchDB.SelectedItems.Count - 1; i >= 0; i--)
                {
                    listSearchDB.SelectedItems[i].Remove();
                }
                MessageBox.Show("Remove data success!");
            }
            else
            {
                DisplayErrorMsg(ret);
            }
        }