//METODOS PRINCIPAIS protected void Load() { boComando = new ComandoBO(); boDispositivo = new DispositivoBO(); boLeitor = new LeitorBO(); Leitor objLeitor = (Leitor)Session["objLeitor"]; Dispositivo objDispositivo = (Dispositivo)Session["objDispositivo"]; Comando objComando = (Comando)Session["objComando"]; if (!IsPostBack) { PreecherFormulario(objLeitor); if (objDispositivo != null) { PreecherDispositivo(objDispositivo); } if (objComando != null) { PreecherComando(objComando); } } else { Session["objLeitor"] = RecuperarObjeto(); } }
protected void Pesquisa() { LeitorBO boLeitor = new LeitorBO(); switch (ddlPesquisa.Text) { case "Geral": gvPesquisaLeitor.DataSource = boLeitor.BuscarGeral(txtPesquisa.Text); gvPesquisaLeitor.DataBind(); break; } }
//METODOS PRINCIPAIS protected void Selecionar() { LeitorBO bo = new LeitorBO(); Session["objLeitor"] = bo.BuscarId(Convert.ToInt32(gvPesquisaLeitor.SelectedValue)); if ((string)Session["Retorno"] != null) { Response.Redirect((string)Session["Retorno"]); } else { Response.Redirect(@"~\Forms\Tecnico\WFManterLeitor.aspx"); } }
protected void Gravar() { //FAZENDO INSTANCIA DAS CLASSES LeitorBO bo = new LeitorBO(); Leitor obj = RecuperarObjeto(); //VALIDANDO OS CAMPOS OBRIGATORIO if (!bo.ValidarCamposObrigatorio(obj)) { ExibirMensagem("a", "Preencha todos os campos necessarios"); } //VALIDANDO AS SENHAS else if (!boDispositivo.ValidarDispositivo(obj.ObjDispositivo)) { ExibirMensagem("a", "Dispositivo não encontrado"); } //FAZENDO ALTERAÇÃO else if (txtMatricula.Text != "" && !bo.ValidarDivisao(obj)) { ExibirMensagem("a", "Divisão não encontrado"); } //VALIDANDO LEITOR else if (txtMatricula.Text != "" && !bo.ValidarMatricula(obj)) { ExibirMensagem("a", "Leitor não encontrado"); } //VALIDANDO CPF else if (txtMatricula.Text != "" && bo.ValidarMatricula(obj)) { ExibirMensagem("s", bo.Alterar(obj)); } //VALIDANDO LOGIN else if (txtMatricula.Text == "") { ExibirMensagem("s", bo.Gravar(obj)); } Session["objLeitor"] = obj; PreecherFormulario(obj); }