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; } }
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); } }
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); }
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; } }