예제 #1
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);
        }
예제 #2
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);
        }