Exemple #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");
            }
        }
Exemple #2
0
        public void ConnectLoop()
        {
            int tries = 10;

            Console.WriteLine("Tentando se conectar {0} vezes com REP no endereço {1}:{2}", tries, Config.repIP, Config.repPort);
            RepCid rep  = new RepCid();
            int    idle = 0;

            for (int i = 0; i < tries; i++)
            {
                rep.iDClassLogin    = Config.repLogin;
                rep.iDClassPassword = Config.repSenha;
                rep.ConnectTimeout  = 15000;
                var status = rep.Conectar(Config.repIP, Config.repPort);
                rep.Desconectar();
                switch (status)
                {
                case RepCid.ErrosRep.OK:
                    break;

                case RepCid.ErrosRep.ErroNaoOcioso:
                    Console.WriteLine("Tentativa {0}: não ocioso", i);
                    idle++;
                    break;

                default:
                    Assert.Fail("Tentativa {0}: erro inválido ({1})", i, status.ToString());
                    break;
                }
            }
            Console.WriteLine("Quantidade de tentativas com REP ocupado: {0}", idle);
        }
Exemple #3
0
 public void ConnectLoop()
 {
     int tries = 10;
     Console.WriteLine("Tentando se conectar {0} vezes com REP no endereço {1}:{2}", tries, Config.repIP, Config.repPort);
     RepCid rep = new RepCid();
     int idle = 0;
     for (int i = 0; i < tries; i++)
     {
         rep.iDClassLogin = Config.repLogin;
         rep.iDClassPassword = Config.repSenha;
         rep.ConnectTimeout = 15000;
         var status = rep.Conectar(Config.repIP, Config.repPort);
         rep.Desconectar();
         switch (status)
         {
             case RepCid.ErrosRep.OK:
                 break;
             case RepCid.ErrosRep.ErroNaoOcioso:
                 Console.WriteLine("Tentativa {0}: não ocioso", i);
                 idle++;
                 break;
             default:
                 Assert.Fail("Tentativa {0}: erro inválido ({1})", i, status.ToString());
                 break;
         }
     }
     Console.WriteLine("Quantidade de tentativas com REP ocupado: {0}", idle);
 }
Exemple #4
0
        public void Usuario_SaveTemplate()
        {
            if (rep.iDClassSession == null)
            {
                Assert.Inconclusive("iDClass não conectado");
            }

            //UserUpdateRequest uur = new UserUpdateRequest();
            UserAddRequest uur = new UserAddRequest();

            uur.Usuario[0].PIS  = 444;
            uur.Usuario[0].Nome = "Fabio 2";
            // Digital TXAI indicador direito
            //uur.Usuario[0].Templates = new string[] { "SUNSUzIxAAAMbAMBAAAAAMUAxQDwAJABAAAAhBIfXwAUAHwPrAA1AJcPSAA2AG4PfQA/ABQPogBeAJkPxgBjACUPhgBoAB0PewB2AIQPbgB9ABYPyACRACoPrgChAKkPDQCxAFUPowCyAKYPVwDbAPsP4wDmAKcPFgD2ANYPiQD/AKoPtwAUAaUPQQAVAdwPfAAZAYsOogAaAaIPygAlAZYPlQArAY8POQA3AVAOyAA9AY0PtgBCAYcPSQBTAfUP3QBbAYQPqwBeAXkPKwBvAe0PVAB3AXIPXhIvaRfnNgNjhBd17vYbXi9TpvtnfIt8WnzudbIH4o2b/AuRwZlWhMYIaXDZaefsVZRO+Fd/woAXBLuFMQXCgKuHZ4NDXxtDsf2/fYcno1PXI/cnOwcrE3cDx/1ng5/fKSP6CQ8cUQb5EkYa7o0/CatTyeMS/PrqORXV/oL5LQqJ8kYRze2OBAoKXlz6dX9naQ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v/+wMD+wf/BeBoAEK3WVDj+/P79/sD+/8DB/cDAwcDCcxQAnq+nwcHCwcTExMH/w2TAwMFsCgCltS1S/4nABgBb2O35+UEEAGTyWlUaABXz0EzB/kb9+/z//jtccYQZABr218DAU//+JjP+wFl4kAMAE/tWwAoAZ/5W/VlHwQkAbf4nwsDC/8NZDgCG/6T/wcjGxMDCPlsYELcQpP83wMDDmsPCwcB7Ul8WELQWnjVOwcTGxcLBwcDAwf7BVAUQbhd9xmwYEMcokP/+/U+AxsjCwsDAwf//wf/AxAwQkSqQm8Q3wlkDEMs/DP8XEOk/k21HNv/AysjAwcH9wMP8wBAQw0CJ/2rAxIRifA8QskKJaXXCWMLCwQ0QUFH3V//A/sP+/1UOENhYicL+fsL+c5QNEKRbfWhpcJcEEKxe/T4LEKVidET/wcFqERDtZ4PCUm3+wcDB/sJKDBDocoB7ZFv/BhDqfn3AcwMQ34p9wQBEQgEBAAAAFgAAAAACBQAAAAAAAEVC" };
            // Digital Fabio indicaro direito


            string template_iDX     = "SUNSUzIxAAAJwgMBAAAAAMUAxQDvADoBAAAAg0gUtgAWAJQPrwAhAJEPlABSAIwP0wBWABwPlQBcABcP4QB0AJ0PggCUAHsP5ACWABkOtgClACkPkgDDAJMPggDMAGcOQgDrAGAPqgD6AKYPeAD+AO0OogAIAZ8PbAAQAfcOmgATAYgPnwAfAYUMNAAnAekPugAoAYwORAdDCx97yP9HBht3MHfL/vtzloDjB+uTJI+7n2f/koAihUN3O+kTVkcWJn3f8B//v5hPEOeyWS3TbKMZBdVjfdvuP2ovdmt7MQgyICYi7fqqZp5TPRi5+CkeYQ6PcJd1KAfR6NLkrP/B6gn7i/dji4P/gQuOBpru19wMIDgBAk8eKgMAswYXwQYAbw2DwVwDAIgVDP4DAM4iGsAJAB4i8P/+U/3/CQCMIA9YQ8EFALMkEDgFACIq+l0NAFwgAC9LVmwTABo78MA+Nv1KRlQSAA9N6cD9wTVBRP9UDACQTYzAkHfAgwwAkFOJwMGQfowJAJhT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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
            string template_iDClass = RepCid.TemplateToiDClass(Convert.FromBase64String(template_iDX));

            uur.Usuario[0].Templates = new string[] { template_iDClass };

            StatusResult st = (StatusResult)RestJSON.SendJson(rep.IP, uur, typeof(StatusResult), rep.iDClassSession);

            if (!st.isOK)
            {
                Assert.Inconclusive(st.Status);
            }
        }
Exemple #5
0
        public static void TestRepUsers(object prm)
        {
            string cIP = (string)prm;
            int nREP = nTask;
            nTask++;
            RepCid rep = new RepCid();
            Controlid.RepCid.ErrosRep status = rep.Conectar(cIP, 1818);
            if (status == RepCid.ErrosRep.OK)
                Console.WriteLine("REP" + nREP + ": Conectado");
            else
            {
                Console.WriteLine(rep.LastLog());
                Assert.Fail("REP" + nREP + ": Erro ao conectar! " + status.ToString());
            }

            int qtd;
            if (!rep.CarregarUsuarios(true, out qtd))
                Assert.Fail("Erro ao carregar usuários do REP" + nREP);

            Console.WriteLine("REP" + nREP + ": Usuários: " + qtd);

            Int64 pis;
            string nome;
            int codigo;
            string senha;
            string barras;
            int rfid;
            int privilegios;
            int ndig;
            while (rep.LerUsuario(out pis, out nome, out codigo, out senha, out barras, out rfid, out privilegios, out ndig))
                Console.WriteLine(string.Format("REP" + nREP + ": {0}:{1} {2}:{3} {4}|{5} {6} {7}", pis, nome, codigo, senha, barras, rfid, privilegios, ndig));

        }
Exemple #6
0
        //public static RepCid ConectarREP(string ip, int port, uint @passcode, string user, string password)
        //{
        //    RepCid rep = null;
        //    if (rep == null)
        //    {
        //        rep = new RepCid();
        //        rep.iDClassLogin = user;
        //        rep.iDClassPassword = password;
        //        rep.iDClassPort = 8000;
        //        Controlid.RepCid.ErrosRep status = rep.Conectar(ip, port, @passcode);
        //        string Retorno = status == RepCid.ErrosRep.OK ? "Conectado" : "Erro ao Conectar";
        //    }
        //    return rep;
        //}

        private void Connect()
        {
            if (_rep != null)
            {
                _rep.Desconectar();
            }

            _rep = new RepCid();

            LogErro(_rep.Conectar(TerminalDados.IP, TerminalDados.Porta, Convert.ToUInt32(string.IsNullOrEmpty(TerminalDados.SupervisorCodigo) ? "0" : TerminalDados.SupervisorCodigo)));
        }
Exemple #7
0
        private void frmUser_Load(object sender, EventArgs e)
        {
            RepCid _rep = ((frmMain)this.Owner).REP;

            if (_rep != null)
            {
                string cNome, cSenha, cBarras;
                int    iCodigo, iRFID;
                int    privilegios;
                Int64  pis64;
                if (!Int64.TryParse(PIS, out pis64))
                {
                    pis64 = 0;
                }
                _rep.LerDadosUsuario(pis64, out cNome, out iCodigo, out cSenha, out cBarras, out iRFID, out privilegios);

                txtNome.Text   = cNome;
                txtPIS.Text    = PIS;
                txtSenha.Text  = cSenha;
                txtCodigo.Text = iCodigo.ToString();
                txtBarras.Text = cBarras;
                txtRFID.Text   = iRFID.ToString();
                if (privilegios < 0)
                {
                    ddlPermissao.SelectedIndex = 0;
                }
                else if (privilegios >= ddlPermissao.Items.Count)
                {
                    ddlPermissao.SelectedIndex = ddlPermissao.Items.Count - 1;
                }
                else
                {
                    ddlPermissao.SelectedIndex = privilegios;
                }

                int num_templates;
                if (_rep.CarregarTemplatesUsuario(Convert.ToInt64(PIS), out num_templates))
                {
                    string template_base64;
                    txtBiometria.Text = "";
                    while (_rep.LerTemplateStr(out template_base64))
                    {
                        txtBiometria.Text += template_base64 + "\r\n\r\n";
                    }
                }
            }
        }
Exemple #8
0
        public void Usuario_SaveTemplate()
        {
            UserAddRequest uur = new UserAddRequest();

            uur.Usuario[0].PIS  = (ulong)Config.pisTEST;
            uur.Usuario[0].Nome = "Fabio Teste";
            string template_iDX     = "SUNSUzIxAAAJwgMBAAAAAMUAxQDvADoBAAAAg0gUtgAWAJQPrwAhAJEPlABSAIwP0wBWABwPlQBcABcP4QB0AJ0PggCUAHsP5ACWABkOtgClACkPkgDDAJMPggDMAGcOQgDrAGAPqgD6AKYPeAD+AO0OogAIAZ8PbAAQAfcOmgATAYgPnwAfAYUMNAAnAekPugAoAYwORAdDCx97yP9HBht3MHfL/vtzloDjB+uTJI+7n2f/koAihUN3O+kTVkcWJn3f8B//v5hPEOeyWS3TbKMZBdVjfdvuP2ovdmt7MQgyICYi7fqqZp5TPRi5+CkeYQ6PcJd1KAfR6NLkrP/B6gn7i/dji4P/gQuOBpru19wMIDgBAk8eKgMAswYXwQYAbw2DwVwDAIgVDP4DAM4iGsAJAB4i8P/+U/3/CQCMIA9YQ8EFALMkEDgFACIq+l0NAFwgAC9LVmwTABo78MA+Nv1KRlQSAA9N6cD9wTVBRP9UDACQTYzAkHfAgwwAkFOJwMGQfowJAJhTEEDAWQ0AkFuMwcLAlMLAwnEIAJhbEP7AN8EUAA1c4jU4/sD+N/9EZAkAl2A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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
            string template_iDClass = RepCid.TemplateToiDClass(Convert.FromBase64String(template_iDX));

            uur.Usuario[0].Templates = new string[] { template_iDClass };

            StatusResult st = RestJSON.SendJson <StatusResult>(Config.repIP, uur, session);

            if (!st.isOK)
            {
                Assert.Inconclusive(st.Status);
            }
        }
Exemple #9
0
 public static RepCid ConectarREP()
 {
     if (rep == null)
     {
         rep = new RepCid();
         rep.iDClassLogin = repLogin;
         rep.iDClassPassword = repSenha;
         Controlid.RepCid.ErrosRep status = rep.Conectar(repIP, repPort, repiDXSenha);
         if (status == RepCid.ErrosRep.OK)
             Console.WriteLine("REP Conectado");
         else
         {
             Console.WriteLine(rep.LastLog());
             Assert.Fail("Erro ao conectar: " + status.ToString());
         }
     }
     return rep;
 }
Exemple #10
0
 public static RepCid ConectarREP()
 {
     if (rep == null)
     {
         rep = new RepCid();
         Controlid.RepCid.ErrosRep status = rep.Conectar(repIP, repPort);
         if (status == RepCid.ErrosRep.OK)
         {
             Console.WriteLine("REP Conectado");
         }
         else
         {
             Console.WriteLine(rep.LastLog());
             Assert.Fail("Erro ao conectar: " + status.ToString());
         }
     }
     return(rep);
 }
Exemple #11
0
        private void Connect()
        {
            if (_rep != null)
            {
                _rep.Desconectar();
            }

            _rep = new RepCid();
            //string con = "";
            //if (TerminalDados.IP.Replace(" ", "").Contains("dns:"))
            //{
            //    IPAddress[] ip = Dns.GetHostAddresses(TerminalDados.IP.Replace(" ", "").Replace("dns:", ""));
            //    con = ip[0].ToString();
            //}
            //else
            //    con = TerminalDados.IP;

            LogErro(_rep.Conectar(TerminalDados.IP, TerminalDados.Porta, 0));//, Convert.ToUInt32(string.IsNullOrEmpty(TerminalDados.SupervisorCodigo) ? "0" : TerminalDados.SupervisorCodigo)));
        }
Exemple #12
0
        public static void TestRepUsers(object prm)
        {
            string cIP  = (string)prm;
            int    nREP = nTask;

            nTask++;
            RepCid rep = new RepCid();

            Controlid.RepCid.ErrosRep status = rep.Conectar(cIP, 1818);
            if (status == RepCid.ErrosRep.OK)
            {
                Console.WriteLine("REP" + nREP + ": Conectado");
            }
            else
            {
                Console.WriteLine(rep.LastLog());
                Assert.Fail("REP" + nREP + ": Erro ao conectar! " + status.ToString());
            }

            int qtd;

            if (!rep.CarregarUsuarios(true, out qtd))
            {
                Assert.Fail("Erro ao carregar usuários do REP" + nREP);
            }

            Console.WriteLine("REP" + nREP + ": Usuários: " + qtd);

            Int64  pis;
            string nome;
            int    codigo;
            string senha;
            string barras;
            int    rfid;
            int    privilegios;
            int    ndig;

            while (rep.LerUsuario(out pis, out nome, out codigo, out senha, out barras, out rfid, out privilegios, out ndig))
            {
                Console.WriteLine(string.Format("REP" + nREP + ": {0}:{1} {2}:{3} {4}|{5} {6} {7}", pis, nome, codigo, senha, barras, rfid, privilegios, ndig));
            }
        }
        private void LoadUsuarios()
        {
            stInfo.Text = "Lendo REP...";
            Application.DoEvents();

            RepCid _rep = ((frmMain)this.Owner).REP;

            if (_rep != null)
            {
                int num_usuarios;
                if (_rep.CarregarUsuarios(false, out num_usuarios))
                {
                    gv.DataSource = tbUsuarios = _rep.Usuarios;
                    if (tbUsuarios != null)
                    {
                        stInfo.Text = "Lido " + tbUsuarios.Rows.Count + " Funcionários";
                    }
                }
            }
        }
Exemple #14
0
        public void Template_ExtractJoin()
        {
            byte[][] btResult = new byte[3][];
            for (int i = 1; i <= 3; i++)
            {
                Bitmap digital   = new System.Drawing.Bitmap(@"..\..\dedo" + i + ".bmp");
                byte[] btRequest = RepCid.GetBytes(digital);

                if (!rep.ExtractTemplate(btRequest, digital.Width, digital.Height, out btResult[i - 1]))
                {
                    Console.WriteLine(rep.LastLog());
                    Assert.Fail("Erro ao extrair Template " + i);
                }
                Console.WriteLine("LastQuality: " + RestJSON.LastQuality);
                Console.WriteLine("Template: " + Convert.ToBase64String(btResult[i - 1]));
            }
            byte[] btJoin;
            rep.JoinTemplates(btResult[0], btResult[1], btResult[2], out btJoin);
            Console.WriteLine("Template: " + Convert.ToBase64String(btJoin));
            //Console.WriteLine(string.Format("Código: {0}\nErro: {1}\nQualidade: {2}\nTemplate: {3}", tr.code, tr.error, tr.Qualidate, tr.Template));
        }
Exemple #15
0
    private bool conexao(bool conect, TBPontoEletronicoModel dados)
    {
        if (_rep != null)
        {
            _rep.Desconectar();
        }
        _rep = new RepCid();
        if (_rep.Conectar(dados.PontoEletronico_Ip.Trim(), dados.PontoEletronico_Porta, (uint)0) == RepCid.ErrosRep.OK)
        {
            if (!conect)
            {
                return(true);
            }
        }
        else
        {
            return(false);
        }

        return(true);
    }
Exemple #16
0
        public static Int64 pisTEST = 1; //012468202319;

        public static RepCid ConectarREP()
        {
            if (rep == null)
            {
                rep = new RepCid();
                rep.iDClassLogin    = repLogin;
                rep.iDClassPassword = repSenha;
                //rep.iDClassPort = 80; // Define o número da porta que deve ser considerado ser um iDClass (default 443)
                Controlid.RepCid.ErrosRep status = rep.Conectar(repIP, repPort, repiDXSenha); // Manda conectar na porta correta
                if (status == RepCid.ErrosRep.OK)
                {
                    Console.WriteLine("REP Conectado");
                }
                else
                {
                    Console.WriteLine(rep.LastLog());
                    Assert.Fail("Erro ao conectar: " + status.ToString());
                }
            }
            return(rep);
        }
Exemple #17
0
        public override bool Connect(int Terminal)
        {
            if (_rep != null)
            {
                _rep.Desconectar();
            }

            Controlid.RepCid.ErrosRep status;
            bool gravou;
            bool Retorno;

            _rep = new RepCid();
            _rep.iDClassLogin    = TerminalDados.OperadorLogin;
            _rep.iDClassPassword = TerminalDados.OperadorSenha;
            _rep.iDClassPort     = TerminalDados.Porta;
            status  = _rep.Conectar(TerminalDados.IP, TerminalDados.Porta, Convert.ToUInt32(string.IsNullOrEmpty(TerminalDados.SupervisorCodigo) ? "0" : TerminalDados.SupervisorCodigo));
            Retorno = status == RepCid.ErrosRep.OK ? true : false;

            LogErro(status);
            return(Retorno);
        }
Exemple #18
0
        private void Connect()
        {
            if (_rep != null)
            {
                _rep.Desconectar();
            }

            _rep = new RepCid();
            string con = "";

            if (TerminalDados.IP.Contains("www."))
            {
                IPAddress[] ip = Dns.GetHostAddresses(TerminalDados.IP);
                con = ip[0].ToString();
            }
            else
            {
                con = TerminalDados.IP;
            }

            LogErro(_rep.Conectar(con, TerminalDados.Porta, Convert.ToUInt32(string.IsNullOrEmpty(TerminalDados.SupervisorCodigo) ? "0" : TerminalDados.SupervisorCodigo)));
        }
        public void Template_ExtractJoin()
        {
            RepCid rep = Config.ConectarREP(); // Cria a conexão padrão (veja config.cs)

            byte[][] btResult = new byte[3][];
            for (int i = 1; i <= 3; i++)
            {
                Bitmap digital   = new Bitmap(@"..\..\dedo" + i + ".bmp");
                byte[] btRequest = RepCid.GetBytes(digital); // transforme o bitmap em bytes no padrão necessário para ser enviado ao equipamento

                if (!rep.ExtractTemplate(btRequest, digital.Width, digital.Height, out btResult[i - 1]))
                {
                    Console.WriteLine(rep.LastLog());
                    Assert.Fail("Erro ao extrair Template " + i);
                }
                Console.WriteLine("LastQuality: " + RestJSON.LastQuality); // somente se for iDClass
                Console.WriteLine("Template: " + Convert.ToBase64String(btResult[i - 1]));
            }
            byte[] btJoin;
            rep.JoinTemplates(btResult[0], btResult[1], btResult[2], out btJoin);
            Console.WriteLine("Template: " + Convert.ToBase64String(btJoin));
            //Console.WriteLine(string.Format("Código: {0}\nErro: {1}\nQualidade: {2}\nTemplate: {3}", tr.code, tr.error, tr.Qualidate, tr.Template));
        }
Exemple #20
0
 public void Conectar()
 {
     rep = Config.ConectarREP();
 }
Exemple #21
0
		private void frmConfig_Load(object sender, EventArgs e)
		{
			_rep = ((frmMain)this.Owner).REP;
			load.RunWorkerAsync(_rep);
		}
Exemple #22
0
 public void Conectar()
 {
     rep = Config.ConectarREP();
 }
Exemple #23
0
        // Tenta efetuar a conexão e define a váriável '_rep' que será encapsulada
        private bool Connect(bool lShowOK)
        {
            if (_rep != null)
                _rep.Desconectar();

            _rep = new RepCid();

            string ip = txtIP.Text;
            if (_rep.Conectar(ip, (int)nudPort.Value, (uint)nudPassCode.Value) == RepCid.ErrosRep.OK)
            {
                if (!lShowOK)
                    // Se não for para exibir os dialogos de confirmação de conexão já retorna a instancia da conexão
                    return true;
                string sn;
                uint tam_bobina;
                uint restante_bobina;
                uint uptime;
                uint cortes;
                uint papel_acumulado;
                uint nsr_atual;
                if (_rep.LerInfo(out sn, out tam_bobina, out restante_bobina, out uptime, out cortes, out papel_acumulado, out nsr_atual))
                {
                    if (sn == null) sn = "?";
                }
                else
                    sn = "(falhou)";

                if (txtIP.Text != TesteRepCid.Properties.Settings.Default.IP ||
                    nudPort.Value != TesteRepCid.Properties.Settings.Default.Porta)
                {
                    if (MessageBox.Show("Conexão Aceita\r\n" +
                        "SN: " + sn + "\r\n" +
                        "NSR: " + nsr_atual.ToString() + "\r\n" +
                        "Papel restante: " + (restante_bobina / 10.0f).ToString("0.0") + " m\r\n" +
                        "\r\nDeseja gravar esta conexão", "REP", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        Settings.Default.IP = txtIP.Text;
                        Settings.Default.Porta = (int)nudPort.Value;
                        Settings.Default.PassCode = (uint)nudPassCode.Value;
                        Settings.Default.Save();
                    }
                }
                else
                    MessageBox.Show("Sucesso na conexão com o REP!\r\n\r\n" +
                        "SN: " + sn + "\r\n" +
                        "NSR: " + nsr_atual.ToString() + "\r\n" +
                        "Papel restante: " + (restante_bobina / 10.0f).ToString("0.0") + " m",
                        "REP", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Conexão com o REP não está funcionando", "REP", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            return true;
        }
Exemple #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string cErro = "";

            try
            {
                _rep = ((frmMain)this.Owner).REP;
                if (_rep != null)
                {
                    Button btn = (Button)sender;

                    if (btn.Name == btnHorario.Name)
                    {
                        // Data e Horario de Verão
                        if (!_rep.GravarDataHora(DateTime.Parse(txtData.Text).Add(TimeSpan.Parse(txtHora.Text))))
                        {
                            cErro += "\r\nErro ao atualizar a Data e Hora";
                        }

                        int iano = 0, imes = 0, idia = 0;
                        int fano = 0, fmes = 0, fdia = 0;

                        if (chkVeraoIni.Checked)
                        {
                            iano = dtpVeraoInicio.Value.Year;
                            imes = dtpVeraoInicio.Value.Month;
                            idia = dtpVeraoInicio.Value.Day;
                        }
                        if (chkVeraoFim.Checked)
                        {
                            fano = dtpVeraoFim.Value.Year;
                            fmes = dtpVeraoFim.Value.Month;
                            fdia = dtpVeraoFim.Value.Day;
                        }

                        if (hVeraoIAno != iano ||
                            hVeraoIMes != imes ||
                            hVeraoIDia != idia ||
                            hVeraoFAno != fano ||
                            hVeraoFMes != fmes ||
                            hVeraoFDia != fdia)
                        {
                            bool gravou;
                            if (!_rep.GravarConfigHVerao(iano, imes, idia,
                                                         fano, fmes, fdia, out gravou) || !gravou)
                            {
                                cErro += "\r\nErro ao registrar o Horário de Verão";
                            }
                        }
                    }
                    else if (btn.Name == btnEmpresa.Name)
                    {
                        // Empregador (documento é só os digitos)
                        //  CPF: 19221149870    => 11 digitos
                        // CNPJ: 05343346000106 => 14 digitos
                        // ------12345678901234

                        // CIDFS.h (portaria)
                        int nTipo = 0;
                        if (txtCPFCNPJ.Text.Length == 14)
                        {
                            nTipo = 1;                             // CNPJ
                        }
                        else if (txtCPFCNPJ.Text.Length == 11)
                        {
                            nTipo = 2;                             // CPF
                        }
                        else
                        {
                            cErro += "\r\nNumero de documento invalido (não é CPF e nem CNPJ)";
                        }

                        bool gravou;
                        if (nTipo > 0 && !(_rep.GravarEmpregador(txtCPFCNPJ.Text, nTipo, txtCEI.Text, txtRazaoSocial.Text, txtEndereco.Text, out gravou) && gravou))
                        {
                            cErro += "\r\nErro ao atualizar os dados de Empregador";
                        }
                    }

                    else if (btn.Name == btnRede.Name)
                    {
                        // Ethernet
                        bool gravou;
                        if (!_rep.GravarConfigRede(txtIP.Text, txtMascara.Text, txtGateway.Text, Convert.ToUInt16(nudPort.Value), out gravou) || !gravou)
                        {
                            cErro += "\r\nErro ao atualizar as configurações de Rede";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                cErro += "\r\n" + "ERRO:" + ex.Message;
            }
            _rep.Desconectar();

            if (cErro != "")
            {
                MessageBox.Show("Hove erros ao registrar as configurações:" + cErro, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("REP ATUALIZADO", "Configurações", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #25
0
 private void frmConfig_Load(object sender, EventArgs e)
 {
     _rep = ((frmMain)this.Owner).REP;
     load.RunWorkerAsync(_rep);
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataRow row;
            int     nTotal = 0;

            for (int i = 0; i < tbUsuarios.Rows.Count; i++)
            {
                row = tbUsuarios.Rows[i];
                if (row.RowState == DataRowState.Deleted || row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added)
                {
                    nTotal++;
                }
            }
            if (nTotal == 0)
            {
                return;
            }

            frmMain m = (frmMain)this.Owner;

            stProgress.Value   = 0;
            stProgress.Maximum = nTotal;
            stProgress.Visible = true;

            nTotal = 0;
            bool   lOK;
            RepCid _rep = m.REP;

            string cPIS;
            string cNome;
            int    nCodigo;
            string cSenha;
            string cBarras;
            int    nRFID;
            int    priv;

            for (int i = 0; i < tbUsuarios.Rows.Count; i++)
            {
                row = tbUsuarios.Rows[i];
                if (row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added)
                {
                    stInfo.Text      = "Gravando PIS: " + row["PIS"].ToString();
                    stProgress.Value = ++nTotal;

                    cPIS  = row["PIS"].ToString();
                    cNome = (string)row["Nome"];

                    if (cPIS == "" || cNome == "")
                    {
                        row.Delete();
                        i--;
                        continue;
                    }

                    if (row["Codigo"] != DBNull.Value)
                    {
                        nCodigo = Convert.ToInt32(row["Codigo"]);
                    }
                    else
                    {
                        nCodigo = 0;
                    }

                    if (row["Senha"] != DBNull.Value)
                    {
                        cSenha = row["Senha"].ToString();
                    }
                    else
                    {
                        cSenha = "";
                    }

                    if (row["Barras"] != DBNull.Value)
                    {
                        cBarras = row["Barras"].ToString();
                    }
                    else
                    {
                        cBarras = "";
                    }

                    if (row["rfID"] != DBNull.Value)
                    {
                        nRFID = Convert.ToInt32(row["rfID"]);
                    }
                    else
                    {
                        nRFID = 0;
                    }

                    if (row["PRIV"] != DBNull.Value)
                    {
                        priv = Convert.ToByte(row["PRIV"]);
                    }
                    else
                    {
                        priv = 0;
                    }

                    _rep.GravarUsuario(Convert.ToInt64(cPIS), cNome, nCodigo, cSenha, cBarras, nRFID, priv, out lOK);
                    string log;
                    if (!_rep.GetLastLog(out log))
                    {
                        log = "";
                    }
                    stInfo.Text += " OK " + log;

                    row.AcceptChanges();
                    Application.DoEvents();
                }
                else if (row.RowState == DataRowState.Deleted)
                {
                    row.RejectChanges();
                    if (_rep.RemoverUsuario(Convert.ToInt64(row["PIS"]), out lOK))
                    {
                        stProgress.Value = ++nTotal;
                        string log;
                        if (!_rep.GetLastLog(out log))
                        {
                            log = "";
                        }
                        stInfo.Text += " REMOVIDO " + log;
                        row.Delete();
                        row.AcceptChanges();
                        i--;
                    }
                }
            }

            _rep.Desconectar();

            stInfo.Text = "Atualizado " + nTotal + " usuário" + (nTotal > 0 ? "s" : "");
            if (nTotal < stProgress.Maximum)
            {
                stInfo.Text += " Erros: " + (stProgress.Maximum - nTotal);
            }
            else
            {
                stProgress.Visible = false;
            }
        }
Exemple #27
0
		private void btnSave_Click(object sender, EventArgs e)
		{
			string cErro = "";
			try
			{
				_rep = ((frmMain)this.Owner).REP;
				if (_rep != null)
				{
					Button btn = (Button)sender;

					if (btn.Name == btnHorario.Name)
					{
						// Data e Horario de Verão
						if (!_rep.GravarDataHora(DateTime.Parse(txtData.Text).Add(TimeSpan.Parse(txtHora.Text))))
							cErro += "\r\nErro ao atualizar a Data e Hora";

						int iano = 0, imes = 0, idia = 0;
						int fano = 0, fmes = 0, fdia = 0;

						if (chkVeraoIni.Checked)
						{
							iano = dtpVeraoInicio.Value.Year;
							imes = dtpVeraoInicio.Value.Month;
							idia = dtpVeraoInicio.Value.Day;
						}
						if (chkVeraoFim.Checked)
						{
							fano = dtpVeraoFim.Value.Year;
							fmes = dtpVeraoFim.Value.Month;
							fdia = dtpVeraoFim.Value.Day;
						}

						if (hVeraoIAno != iano ||
							hVeraoIMes != imes ||
							hVeraoIDia != idia ||
							hVeraoFAno != fano ||
							hVeraoFMes != fmes ||
							hVeraoFDia != fdia)
						{
							bool gravou;
							if (!_rep.GravarConfigHVerao(iano, imes, idia,
								fano, fmes, fdia, out gravou) || !gravou)
								cErro += "\r\nErro ao registrar o Horário de Verão";
						}
					}
					else if (btn.Name == btnEmpresa.Name)
					{
						// Empregador (documento é só os digitos)
						//  CPF: 19221149870    => 11 digitos
						// CNPJ: 05343346000106 => 14 digitos
						// ------12345678901234

						// CIDFS.h (portaria)
						int nTipo = 0;
						if (txtCPFCNPJ.Text.Length == 14)
							nTipo = 1; // CNPJ
						else if (txtCPFCNPJ.Text.Length == 11)
							nTipo = 2; // CPF
						else
							cErro += "\r\nNumero de documento invalido (não é CPF e nem CNPJ)";

						bool gravou;
						if (nTipo > 0 && !(_rep.GravarEmpregador(txtCPFCNPJ.Text, nTipo, txtCEI.Text, txtRazaoSocial.Text, txtEndereco.Text, out gravou) && gravou))
							cErro += "\r\nErro ao atualizar os dados de Empregador";
					}

					else if (btn.Name == btnRede.Name)
					{
						// Ethernet
						bool gravou;
						if (!_rep.GravarConfigRede(txtIP.Text, txtMascara.Text, txtGateway.Text, Convert.ToUInt16(nudPort.Value), out gravou) || !gravou)
							cErro += "\r\nErro ao atualizar as configurações de Rede";
					}
				}
			}
			catch (Exception ex)
			{
				cErro += "\r\n" + "ERRO:" + ex.Message;
			}
			_rep.Desconectar();

			if (cErro != "")
				MessageBox.Show("Hove erros ao registrar as configurações:" + cErro, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
			else
				MessageBox.Show("REP ATUALIZADO", "Configurações", MessageBoxButtons.OK, MessageBoxIcon.Information);
		}
Exemple #28
0
        // Tenta efetuar a conexão e define a váriável '_rep' que será encapsulada
        private bool Connect(bool lShowOK)
        {
            if (_rep != null)
            {
                _rep.Desconectar();
            }

            _rep = new RepCid();

            string ip = txtIP.Text;

            if (_rep.Conectar(ip, (int)nudPort.Value, (uint)nudPassCode.Value) == RepCid.ErrosRep.OK)
            {
                if (!lShowOK)
                {
                    // Se não for para exibir os dialogos de confirmação de conexão já retorna a instancia da conexão
                    return(true);
                }
                string sn;
                uint   tam_bobina;
                uint   restante_bobina;
                uint   uptime;
                uint   cortes;
                uint   papel_acumulado;
                uint   nsr_atual;
                if (_rep.LerInfo(out sn, out tam_bobina, out restante_bobina, out uptime, out cortes, out papel_acumulado, out nsr_atual))
                {
                    if (sn == null)
                    {
                        sn = "?";
                    }
                }
                else
                {
                    sn = "(falhou)";
                }

                if (txtIP.Text != TesteRepCid.Properties.Settings.Default.IP ||
                    nudPort.Value != TesteRepCid.Properties.Settings.Default.Porta)
                {
                    if (MessageBox.Show("Conexão Aceita\r\n" +
                                        "SN: " + sn + "\r\n" +
                                        "NSR: " + nsr_atual.ToString() + "\r\n" +
                                        "Papel restante: " + (restante_bobina / 10.0f).ToString("0.0") + " m\r\n" +
                                        "\r\nDeseja gravar esta conexão", "REP", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        Settings.Default.IP       = txtIP.Text;
                        Settings.Default.Porta    = (int)nudPort.Value;
                        Settings.Default.PassCode = (uint)nudPassCode.Value;
                        Settings.Default.Save();
                    }
                }
                else
                {
                    MessageBox.Show("Sucesso na conexão com o REP!\r\n\r\n" +
                                    "SN: " + sn + "\r\n" +
                                    "NSR: " + nsr_atual.ToString() + "\r\n" +
                                    "Papel restante: " + (restante_bobina / 10.0f).ToString("0.0") + " m",
                                    "REP", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Conexão com o REP não está funcionando", "REP", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }