Пример #1
0
        public override bool authenticate( )
        {
            if (base.authenticate() == false)
            {
                return(false);
            }

            Registry("authenticate exec_alteraCartao ");

            /// USER [ authenticate ]

            cart = new T_Cartao(this);

            cart.ExclusiveAccess();

            // ## Busca cartão específico

            if (!cart.select_rows_empresa_matricula(input_cont_dc.get_st_empresa(),
                                                    input_cont_dc.get_st_matricula()))
            {
                PublishError("Cartão inválido");
                return(false);
            }

            if (!cart.fetch())
            {
                return(false);
            }

            /// USER [ authenticate ] END

            Registry("authenticate done exec_alteraCartao ");

            return(true);
        }
        public override bool authenticate( )
        {
            if (base.authenticate() == false)
            {
                return(false);
            }

            Registry("authenticate ins_cartaoProprietario ");

            /// USER [ authenticate ]

            cart = new T_Cartao(this);
            prot = new T_Proprietario(this);

            string empresa   = input_cont_dc.get_st_empresa().PadLeft(6, '0');
            string matricula = input_cont_dc.get_st_matricula().PadLeft(6, '0');

            if (input_cont_dc.get_tg_tipoCartao() != TipoCartao.presente)
            {
                if (cart.select_rows_empresa_matricula(empresa, matricula))
                {
                    PublishError(Erro.CartaoExiste);
                    return(false);
                }
            }
            else
            {
                if (!cart.select_rows_empresa_matricula(empresa, matricula))
                {
                    PublishError("Cartão inexistente");
                    return(false);
                }

                if (!cart.fetch())
                {
                    return(false);
                }

                if (cart.get_tg_emitido() != StatusExpedicao.Expedido)
                {
                    PublishError("Cartão não expedido");
                    return(false);
                }

                if (cart.get_fk_dadosProprietario() != Context.NONE)
                {
                    PublishError("Cartão previamente adquirido");
                    return(false);
                }
            }

            /// USER [ authenticate ] END

            Registry("authenticate done ins_cartaoProprietario ");

            return(true);
        }