private void getVeiculo() { abastecimento = (Session["abastecimento"] as Abastecimento); abastecimento.Veiculo.Placa = txbPlaca.Text; if (abastecimento.Veiculo.Placa != "") { daoVeiculo = new DAOVeiculo(); daoVeiculo.buscarPlaca(abastecimento.Veiculo); daoModelo = new DAOModelo(); daoModelo.buscarID(abastecimento.Veiculo.Modelo); daoMarca = new DAOMarca(); daoMarca.buscarID(abastecimento.Veiculo.Modelo.Marca); } Session["abastecimento"] = abastecimento; }
private void getFuncionario() { abastecimento = (Session["abastecimento"] as Abastecimento); abastecimento.Funcionario.Matricula = txbMatricula.Text; if (abastecimento.Funcionario.Matricula != "") { daoFuncionario = new DAOFuncionario(); daoFuncionario.buscarMatricula(abastecimento.Funcionario); daoFuncao = new DAOFuncao(); daoFuncao.buscarID(abastecimento.Funcionario.Funcao); } Session["abastecimento"] = abastecimento; }
protected void ibtGravar_Click(object sender, ImageClickEventArgs e) { abastecimento = (Session["abastecimento"] as Abastecimento); setDados(); try { abastecimento.aplicar(new DAOAbastecimento()); Response.Redirect("lancaAbastecAvulso.aspx"); } catch (Exception Ex) { lbMsgErro.Visible = true; lbMsgErro.Text = Ex.Message; } }
/******************************************************************************/ #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"); } }
private void getSaldo() { if (txbData.Text.Length==10 && Solucon.DataHora.DataLib.DateValid(txbData.Text)) { abastecimento = (Session["abastecimento"] as Abastecimento); DAOAbastecimento daoAbastecimento = new DAOAbastecimento(); saldo_funcionario=daoAbastecimento.verifSaldo(abastecimento.Funcionario, DateTime.Parse(txbData.Text).Month, DateTime.Parse(txbData.Text).Year); } }
private void getFornecedor() { abastecimento = (Session["abastecimento"] as Abastecimento); abastecimento.Fornecedor.ID = Int32.Parse(txbID_Fornecedor.Text); if (abastecimento.Fornecedor.ID != 0) { daoFornecedor = new DAOFornecedor(); daoFornecedor.buscarID(abastecimento.Fornecedor); } Session["abastecimento"] = abastecimento; }
/******************************************************************************/ #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"); } }