public void copy(ref T_WebBlock cpy) { st_ip = cpy.st_ip; fk_cartao = cpy.fk_cartao; dt_expire = cpy.dt_expire; }
public override bool execute( ) { Registry("execute web_fetch_edu_inicial "); /// USER [ execute ] output_tg_resp = Context.FALSE; if (input_st_cpf.Length > 0) { T_Proprietario prot = new T_Proprietario(this); if (!prot.select_rows_cpf(input_st_cpf)) { PublishError("CPF inválido"); return(false); } if (!prot.fetch()) { return(false); } if (prot.get_st_senhaEdu() != input_st_senha) { PublishError("Senha de responsável inválida"); return(false); } output_tg_resp = Context.TRUE; LINK_ProprietarioCartao prop_cart = new LINK_ProprietarioCartao(this); if (!prop_cart.select_fk_proprietario(prot.get_identity())) { PublishError("Nenhum cartão educacional cadastrado"); return(false); } T_Cartao cart = new T_Cartao(this); bool found = false; while (prop_cart.fetch()) { if (!cart.selectIdentity(prop_cart.get_fk_cartao())) { return(false); } if (cart.get_tg_tipoCartao() == TipoCartao.educacional) { found = true; break; } Trace(input_st_senha); } if (!found) { PublishError("Nenhum cartão educacional encontrado"); return(false); } } else if (input_st_cartao.Length > 0) { input_st_cartao = input_st_cartao.PadLeft(14, '0'); T_Cartao cart = new T_Cartao(this); cart.ExclusiveAccess(); if (!cart.select_rows_tudo(input_st_cartao.Substring(0, 6), input_st_cartao.Substring(6, 6), input_st_cartao.Substring(12, 2))) { PublishError("Cartão inválido"); return(false); } if (!cart.fetch()) { return(false); } T_WebBlock ip_block = new T_WebBlock(this); if (ip_block.select_rows_ip(input_st_ip, GetDataBaseTime(), cart.get_identity())) { PublishError("Senha de aluno inválida"); return(false); } if (cart.get_st_senha() != input_st_senha) { long senhas_erradas = cart.get_int_nu_webSenhaErrada() + 1; if (senhas_erradas >= 4) { ip_block.set_dt_expire(GetDataBaseTime(DateTime.Now.AddDays(1))); ip_block.set_st_ip(input_st_ip); ip_block.set_fk_cartao(cart.get_identity()); if (!ip_block.create_T_WebBlock()) { return(false); } } cart.set_nu_webSenhaErrada(senhas_erradas.ToString()); if (!cart.synchronize_T_Cartao()) { return(false); } PublishError("Senha de aluno inválida"); return(false); } cart.set_nu_webSenhaErrada("0"); if (!cart.synchronize_T_Cartao()) { return(false); } output_tg_resp = Context.FALSE; } /// USER [ execute ] END Registry("execute done web_fetch_edu_inicial "); return(true); }