示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            RepCid _rep = ((frmMain)this.Owner).REP;

            if (_rep != null)
            {
                byte privilegios = 0;
                if (ddlPermissao.SelectedIndex >= 0)
                {
                    privilegios = (byte)ddlPermissao.SelectedIndex;
                }

                bool lSave;
                _rep.GravarUsuario(Convert.ToInt64(txtPIS.Text), txtNome.Text, int.Parse(txtCodigo.Text), txtSenha.Text, txtBarras.Text, int.Parse(txtRFID.Text), privilegios, out lSave);

                bool apagou;
                _rep.ApagarTemplatesUsuario(Convert.ToInt64(txtPIS.Text), out apagou);
                if (txtBiometria.Text != "")
                {
                    string[] cItens = txtBiometria.Text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string item in cItens)
                    {
                        byte[] bt = Convert.FromBase64String(item);                         // apenas a primeira da sequencia
                        _rep.GravarTemplateUsuario(Convert.ToInt64(txtPIS.Text), bt, out lSave);
                    }
                }

                this.Close();
            }
            else
            {
                MessageBox.Show("Erro");
            }
        }