Ejemplo n.º 1
0
        public void getDados()
        {
            daoFrentista = new DAOFrentista();
            daoFornecedor = new DAOFornecedor();
            txbUsuario.Text = frentista.Login;
            daoFrentista.buscarFrentista(frentista);
            txbNomeUsuario.Text = frentista.Nome;

            txbId_fornecedor.Text = frentista.Fornecedor.ID.ToString();
            daoFornecedor.buscarID(frentista.Fornecedor);
            txbRazaoSocial.Text = frentista.Fornecedor.Razao_social;
        }
Ejemplo n.º 2
0
 private void getUsuario()
 {
     frentista = (Session["frentista"] as Frentista);
     frentista.Login = txbUsuario.Text;
     if (frentista.Login != "")
     {
         daoFrentista = new DAOFrentista();
         daoFrentista.buscarLogin(frentista);
         atualizaEstadoFrentista(frentista);
     }
     Session["frentista"] = frentista;
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                frentista = new Frentista();
                frentista.ID = Int32.Parse(Request.QueryString["ID"]);
                Session["frentista"] = frentista;
                if (frentista.ID != 0)
                {
                    daoFrentista = new DAOFrentista();
                    daoFrentista.buscarID(frentista);
                    getDados();
                    habilitarCtrl(false);
                    frentista.editar();
                }
                else
                {
                    frentista.novo();
                    habilitarCtrl(true);
                }
            }

            if (Session["buscaFornec"] != null)
            {
                txbId_fornecedor.Text = (Session["buscaFornec"] as Fornecedor).ID.ToString();
                txbId_fornecedor_TextChanged(sender, e);
                Session.Remove("buscaFornec");
            }

            if (Session["buscaUsuario"] != null)
            {
                txbUsuario.Text = (Session["buscaUsuario"] as Usuario).Login;
                txbUsuario_TextChanged(sender, e);
                Session.Remove("buscaUsuario");
            }
        }
Ejemplo n.º 4
0
 protected void ibtExcluir_Click(object sender, ImageClickEventArgs e)
 {
     frentista = (Session["frentista"] as Frentista);
     frentista.deletar();
     daoFrentista = new DAOFrentista();
     frentista.aplicar(daoFrentista);
     Response.Redirect("PesqFrentista.aspx");
 }
Ejemplo n.º 5
0
        /******************************************************************************/

        #region eventos do webforms ou webcontrols
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                abastecimento = new Abastecimento();
                daoCombustivel = new DAOCombustivel();
                ddTipoCombustivel.DataSource = daoCombustivel.listar();
                ddTipoCombustivel.DataBind();
                ddTipoCombustivel.Items[0].Selected = false;
                /*********************** Item vazio ****************************/
                Solucon.WebControls.WebFormat.addItemDefault(ddTipoCombustivel, new ListItem("Selecione", "0", true));
                ddTipoCombustivel.Enabled = true;
                /***************************************************************/
                limparCtrl();
                Session["abastecimento"] = abastecimento;
                /// <summary>
                /// Verificando se o usuário está associado à um fornecedor.
                /// </summary>
                frentista = new Frentista();
                frentista.ID = ((Usuario)Session["USUARIO_LOGADO"]).ID;
                daoFrentista = new DAOFrentista();
                if (daoFrentista.buscarID(frentista) && frentista.Fornecedor.ID != 0)
                {
                    txbID_Fornecedor.Text = frentista.Fornecedor.ID.ToString();
                    getFornecedor();
                    setFornecedor();
                }
                else
                {
                    Response.Redirect("usuarioSemFornecedor.aspx");
                }
                /***************************************************************/
                txbPlaca.Focus();
            }
            if (Session["buscaFunc"]!= null)
            {
                txbMatricula.Text = (Session["buscaFunc"] as Funcionario).Matricula;
                txbMatricula_TextChanged(sender, e);
                Session.Remove("buscaFunc");
            }
            if (Session["buscaVeiculo"]!= null)
            {
                txbPlaca.Text = (Session["buscaVeiculo"] as Veiculo).Placa;
                txbPlaca_TextChanged(sender, e);
                Session.Remove("buscaVeiculo");
            }
        }