Пример #1
0
        public void sendDataHora()
        {
            StringBuilder MensagemErro = new StringBuilder(256);
            int           conta;
            string        DataHora = DateTime.Now.ToString(@"dd/MM/yyyy HH:mm:ss");

            log.AddLog(Consts.DATA_HORA_ENVIANDO);
            REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_AtualizaDataHora(REPZPM_DLL.Handle, DataHora);
            //REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_AtualizaDataHora(REPZPM_DLL.Handle, "15/03/2012 15:45");

            /*Houve sucesso no envio do comando*/
            if (REPZPM_DLL.ID_Comando > 0)
            {
                NRegistros = REPZPM_DLL.DLLREP_TotalRetornos(REPZPM_DLL.Handle);

                conta = 1;

                while (conta <= NRegistros)
                {
                    /*Obtém o código de erro do REP*/
                    REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemCodigoErro(REPZPM_DLL.Handle, conta);

                    /*Houve erro*/
                    if (REPZPM_DLL.Retorno != 0)
                    {
                        log.AddLog(REPZPM_DLL.Trata_Retorno_REP(REPZPM_DLL.Retorno), true);
                        return;
                    }

                    conta++;
                }

                /*Houve erro*/
                if (REPZPM_DLL.Retorno != 0)
                {
                    REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemMensagemErro(REPZPM_DLL.Handle, MensagemErro, 1);
                    log.AddLog(Convert.ToString(MensagemErro));
                    return;
                }
                else
                {
                    log.AddLog(Consts.DATA_HORA_ATUALIZADA_SUCESSO, true, true);
                    return;
                }
            }
            else
            {
                log.AddLog(REPZPM_DLL.Trata_Retorno_DLL(REPZPM_DLL.ID_Comando));
                return;
            }
        }
Пример #2
0
        private void initModoIp(string IP, int Porta)
        {
            REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_DefineModoIP(REPZPM_DLL.Handle, IP, Porta);
            string Mensagem;

            if (REPZPM_DLL.Retorno == 1)
            {
                Mensagem        = REPZPM_DLL.Trata_Retorno_DLL(REPZPM_DLL.Retorno);
                REPZPM_DLL.Modo = 0;
            }
            else
            {
                Mensagem = REPZPM_DLL.Trata_Retorno_DLL(REPZPM_DLL.Retorno);
            }

            log.AddLog(Mensagem);
        }
Пример #3
0
        public void sendEmpregador(string PessoaTipo, string Cnpj, string Nome, string Cei, string Endereco)
        {
            string tempPessoaTipo = "";
            string tempCnpj       = "";
            string tempNome       = "";
            string tempCei        = "";
            string tempEndereco   = "";

            int Operacao;

            getEmpregador(out tempPessoaTipo, out tempCnpj, out tempNome, out tempCei, out tempEndereco);

            Operacao = tempNome != "" ? opAlteracao : opInclusao;

            log.AddLog(Consts.EMPREGADOR_ENVIANDO);

            REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_Empregador(REPZPM_DLL.Handle, Operacao, PessoaTipo, Cnpj, Cei, Nome, Endereco);

            /*Sucesso na execução do comando*/
            if (REPZPM_DLL.ID_Comando > 0)
            {
                /*Retorna a quantidade de retornos do comando enviado*/
                NRegistros = REPZPM_DLL.DLLREP_TotalRetornos(REPZPM_DLL.Handle);

                REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemCodigoErro(REPZPM_DLL.Handle, NRegistros);

                /*Houve erro*/
                if (REPZPM_DLL.Retorno != 0)
                {
                    REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemMensagemErro(REPZPM_DLL.Handle, MensagemErro, 1);

                    log.AddLog(Convert.ToString(MensagemErro), true);
                }
                /*Houve sucesso no envio do comando*/
                else
                {
                    log.AddLog(Consts.EMPREGADOR_ENVIADO_SUCESSO, true, true);
                }
            }
            /*Trata o erro retornado pela DLL*/
            else
            {
                log.AddLog(REPZPM_DLL.Trata_Retorno_DLL(REPZPM_DLL.ID_Comando), true);
            }
        }
Пример #4
0
        private void getEmpregador(out string PessoaTipo, out string Cnpj, out string Nome, out string Cei, out string Endereco)
        {
            PessoaTipo = "";
            Cnpj       = "";
            Nome       = "";
            Cei        = "";
            Endereco   = "";

            StringBuilder Tipo          = new StringBuilder(1);
            StringBuilder Identificacao = new StringBuilder(14);
            StringBuilder CEI           = new StringBuilder(12);
            StringBuilder RazaoSocial   = new StringBuilder(150);
            StringBuilder LocalTrabalho = new StringBuilder(100);
            StringBuilder MensagemErro  = new StringBuilder(256);

            REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_BuscaEmpregador(REPZPM_DLL.Handle);

            if (REPZPM_DLL.ID_Comando > 0)
            {
                REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_RetornoEmpregador(REPZPM_DLL.Handle, Tipo, Identificacao, CEI, RazaoSocial, LocalTrabalho);

                /*Sucesso na leitura do empregador*/
                if (REPZPM_DLL.Retorno == 1)
                {
                    /*Mostra as informações do Empregador*/
                    PessoaTipo = Tipo.ToString();
                    Cnpj       = Identificacao.ToString();
                    Nome       = RazaoSocial.ToString();
                    Cei        = CEI.ToString();
                    Endereco   = LocalTrabalho.ToString();
                }
                else
                {
                    /*Houve erro na leitura do empregador*/
                    log.AddLog(REPZPM_DLL.Trata_Retorno_REP(REPZPM_DLL.Retorno), true);
                    return;
                }
            }
            else
            {
                /*Trata o erro na inicialização do Handle*/
                log.AddLog(REPZPM_DLL.Trata_Retorno_DLL(REPZPM_DLL.ID_Comando));
                return;
            }
        }
Пример #5
0
        private void getFuncionario(string Pis, out string FuncionarioNome, out string Cracha, out bool Teclado, out string CodigoTeclado,
                                    out string CodigoBarras, out string CodigoMifare, out string CodigoTag)
        {
            StringBuilder sPIS             = new StringBuilder(11);
            StringBuilder sMatricula       = new StringBuilder(20);
            StringBuilder sNomeFuncionario = new StringBuilder(52);
            StringBuilder sBiometrico      = new StringBuilder(20000); //Valor definido baseado na maior template possivel de ser gerada c/ 10 digitais cadastradas.
            StringBuilder sHabilitaTeclado = new StringBuilder(1);
            StringBuilder sCodigoTeclado   = new StringBuilder(16);
            StringBuilder sCodigoBarras    = new StringBuilder(20);
            StringBuilder sCodigoMIFARE    = new StringBuilder(20);
            StringBuilder sCodigoTAG       = new StringBuilder(20);
            StringBuilder MensagemErro     = new StringBuilder(256);

            Cracha          = String.Empty;
            FuncionarioNome = String.Empty;
            Teclado         = false;
            CodigoTeclado   = String.Empty;
            CodigoBarras    = String.Empty;
            CodigoMifare    = String.Empty;
            CodigoTag       = String.Empty;

            REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_BuscaFuncionario(REPZPM_DLL.Handle, Pis);

            /*Sucesso na execução do comando*/
            if (REPZPM_DLL.ID_Comando > 0)
            {
                /**************************************************************************************************************************
                 * MODO IP                                                                                                                  *
                 ***************************************************************************************************************************/
                if (REPZPM_DLL.Modo == 0)
                {
                    NRegistros = REPZPM_DLL.DLLREP_TotalRetornos(REPZPM_DLL.Handle);

                    /*Verifica se retornaram registros*/
                    if (NRegistros > 0)
                    {
                        /*Limpa a listagem*/
                        /*Executa a busca dos Funcionários*/
                        for (int i = 1; i <= NRegistros; i++)
                        {
                            REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_RetornoFuncionario(REPZPM_DLL.Handle, i, sPIS, sMatricula, sNomeFuncionario, sBiometrico, sHabilitaTeclado, sCodigoTeclado, sCodigoBarras, sCodigoMIFARE, sCodigoTAG);

                            /*Sucesso na execução do comando*/
                            if (REPZPM_DLL.Retorno == 1)
                            {
                                Cracha          = sMatricula.ToString();
                                FuncionarioNome = sNomeFuncionario.ToString();
                                Teclado         = sHabilitaTeclado.ToString() == "S" ? true : false;
                                CodigoTeclado   = sCodigoTeclado.ToString();
                                CodigoBarras    = sCodigoBarras.ToString();
                                CodigoMifare    = sCodigoMIFARE.ToString();
                                CodigoTag       = sCodigoTAG.ToString();
                            }
                            else
                            {
                                /*Trata o retorno de erro do REP*/
                                log.AddLog(REPZPM_DLL.Trata_Retorno_REP(REPZPM_DLL.Retorno), true);
                                return;
                            }
                        }
                    }
                    else
                    {
                        log.AddLog("Não há funcionário cadastrado no REP");
                        return;
                    }
                }
            }
            else
            {
                /*Houve erro no processamento do Handle*/
                log.AddLog(REPZPM_DLL.Trata_Retorno_DLL(REPZPM_DLL.ID_Comando));
                return;
            }
        }