Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
        public bool deleteFuncionario(string Pis)
        {
            bool Ok = false;

            /******************************************************************************************************************************
             * 'INCLUSÃO DE FUNCIONÁRIO                                                                                                      *
             * '******************************************************************************************************************************/
            /*Prepara o envio do cadastro do funcionário*/
            REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_Funcionario_Prepara(REPZPM_DLL.Handle, opExclusao, Pis, "", "", "", "", "", "", "", "");

            /*Comando executado*/
            if (REPZPM_DLL.Retorno == 1)
            {
                REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_Funcionario_Envia(REPZPM_DLL.Handle);

                /*Comando de cadastro de funcionário foi enviado com sucesso se for maior que 0*/
                if (REPZPM_DLL.ID_Comando > 0)
                {
                    if (REPZPM_DLL.Modo == 0)
                    {
                        /*Obtém o código de erro*/
                        REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemCodigoErro(REPZPM_DLL.Handle, 1);

                        /*Se Retorno for <> de 0, então houve erro na execução do comando de cadastro de funcionário*/
                        if (REPZPM_DLL.Retorno != 0)
                        {
                            REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemMensagemErro(REPZPM_DLL.Handle, MensagemErro, 1);
                            log.AddLog(Convert.ToString(MensagemErro), true);
                        }
                        else
                        {
                            log.AddLog(REPZPM_DLL.Trata_Retorno_REP(REPZPM_DLL.Retorno), true, true);
                            Ok = true;
                        }
                    }
                }
                else
                {
                    log.AddLog(Consts.ERRO_ENVIO_COMANDO, true);
                }
            }
            else
            {
                log.AddLog(Consts.ERRO_ENVIO_COMANDO, true);
            }

            return(Ok);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 4
0
        public bool getArquivoMarcacoes(string Arquivo, int Grupo, DateTime DataInicial, DateTime DataFinal)
        {
            bool Result = false;

            int NRegistrosLidos = 0;

            StringBuilder PIS          = new StringBuilder(11);
            StringBuilder DataHora     = new StringBuilder(19);
            StringBuilder NSR          = new StringBuilder(20);
            StringBuilder MensagemErro = new StringBuilder(256);

            Marcacoes marcacoes = new Marcacoes(Arquivo);

            log.AddLog(Consts.INICIALIZANDO_IMPORTACAO_ARQUIVO);
            REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_BuscaPonto(REPZPM_DLL.Handle, DataInicial.ToString("dd/MM/yyyy"), DataFinal.ToString("dd/MM/yyyy"));

            if (REPZPM_DLL.ID_Comando > 0)
            {
                /*Retorna a quantidade de registros*/
                NRegistros = REPZPM_DLL.DLLREP_TotalRetornos(REPZPM_DLL.Handle);

                log.AddLog(String.Format(Consts.TOTAL_MARCACOES, NRegistros));

                if (NRegistros > 0)
                {
                    for (int i = 1; i <= NRegistros; i++)
                    {
                        REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_RetornoPonto(REPZPM_DLL.Handle, i, PIS, DataHora, NSR);

                        if (REPZPM_DLL.Retorno == 1)
                        {
                            marcacoes.Add(PIS.ToString(), Convert.ToDateTime(DataHora.ToString()), Convert.ToInt32(NSR.ToString()));
                            log.AddLogUnformatted(PIS.ToString().PadRight(18) + DataHora + " " + NSR);
                            NRegistrosLidos++;
                        }
                        else
                        {
                            REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemMensagemErro(REPZPM_DLL.Handle, MensagemErro, 1);
                            log.AddLog(Convert.ToString(MensagemErro));
                        }
                    }
                }
                else
                {
                    log.AddLog(Consts.SEM_MARCACOES);
                }
            }

            Result = (NRegistrosLidos > 0);

            if (Result)
            {
                marcacoes.SaveToFile();
                log.AddLogUnformatted(String.Format(Consts.ARQUIVO_GERADO, Arquivo));
                log.AddLineBreak();
            }
            else
            {
                log.AddLog(Consts.SEM_MARCACOES);
            }

            return(Result);
        }
Ejemplo n.º 5
0
        public bool sendFuncionario(string Pis, string FuncionarioNome, string Cracha, bool Teclado, string CodigoTeclado,
                                    string CodigoBarras, string CodigoMifare, string CodigoTag)
        {
            int    Operacao;
            bool   Ok = false;
            string Habilitar_Teclado = Teclado ? "S" : "N";

            string tempFuncionarioNome = "";
            string tempCracha          = "";
            bool   tempTeclado         = false;
            string tempCodigoTeclado   = "";
            string tempCodigoBarras    = "";
            string tempCodigoMifare    = "";
            string tempCodigoTag       = "";

            getFuncionario(Pis, out tempFuncionarioNome, out tempCracha, out tempTeclado,
                           out tempCodigoTeclado, out tempCodigoBarras, out tempCodigoMifare, out tempCodigoTag);

            Operacao = tempFuncionarioNome != String.Empty ? opAlteracao : opInclusao;

            /******************************************************************************************************************************
             * 'INCLUSÃO DE FUNCIONÁRIO                                                                                                      *
             * '******************************************************************************************************************************/
            /*Prepara o envio do cadastro do funcionário*/
            REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_Funcionario_Prepara(REPZPM_DLL.Handle, Operacao, Pis, Cracha, FuncionarioNome, "", Habilitar_Teclado, CodigoTeclado, CodigoBarras, CodigoMifare, CodigoTag);

            /*Comando executado*/
            if (REPZPM_DLL.Retorno == 1)
            {
                REPZPM_DLL.ID_Comando = REPZPM_DLL.DLLREP_Funcionario_Envia(REPZPM_DLL.Handle);

                /*Comando de cadastro de funcionário foi enviado com sucesso se for maior que 0*/
                if (REPZPM_DLL.ID_Comando > 0)
                {
                    if (REPZPM_DLL.Modo == 0)
                    {
                        /*Obtém o código de erro*/
                        REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemCodigoErro(REPZPM_DLL.Handle, 1);

                        /*Se Retorno for <> de 0, então houve erro na execução do comando de cadastro de funcionário*/
                        if (REPZPM_DLL.Retorno != 0)
                        {
                            REPZPM_DLL.Retorno = REPZPM_DLL.DLLREP_ObtemMensagemErro(REPZPM_DLL.Handle, MensagemErro, 1);
                            log.AddLog(REPZPM_DLL.Trata_Retorno_REP(REPZPM_DLL.Retorno), true);
                        }
                        else
                        {
                            Ok = true;
                        }
                    }
                }
                else
                {
                    log.AddLog(Consts.ERRO_ENVIO_COMANDO);
                }
            }
            else
            {
                log.AddLog(Consts.ERRO_ENVIO_COMANDO);
            }

            return(Ok);
        }