Example #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;
            }
        }