protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["fornecedor"] = new Fornecedor();
                DAOCombustivel daoCombustivel = new DAOCombustivel();
                ddCombustivel.DataSource = daoCombustivel.listar();
            }
            if (Session["buscaFornec"] != null)
            {
                txbID_Fornecedor.Text = (Session["buscaFornec"] as Fornecedor).ID.ToString();
                txbID_Fornecedor_TextChanged(sender, e);
                Session.Remove("buscaFornec");
            }

        }
        /******************************************************************************/

        #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;
            }
            if (Session["buscaFornec"] != null)
            {
                txbID_Fornecedor.Text = (Session["buscaFornec"] as Fornecedor).ID.ToString();
                txbID_Fornecedor_TextChanged(sender, e);
                Session.Remove("buscaFornec");
            }

            if (Session["buscaVeiculo"] != null)
            {
                txbPlaca.Text = (Session["buscaVeiculo"] as Veiculo).Placa;
                txbPlaca_TextChanged(sender, e);
                Session.Remove("buscaVeiculo");
            }
            if (Session["buscaFunc"] != null)
            {
                txbMatricula.Text = (Session["buscaFunc"] as Funcionario).Matricula;
                txbMatricula_TextChanged(sender, e);
                Session.Remove("buscaFunc");
            }


        }
Beispiel #3
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");
            }
        }