protected void Page_Load(object sender, EventArgs e) { IPedidoDAO pedidoDAO = new PedidoDAOSQLServer(ConexaoSingleton.Conexao); this.gerenciadorPedidos = new PedidoBLL(pedidoDAO); // Não seta os campos no PostBack para não perder as alterações do usuário if (!Page.IsPostBack) { int id = Convert.ToInt32(Request.QueryString["id"]); PedidoVO pedido = this.gerenciadorPedidos.BuscarPedido(id); this.clientTxt.Value = pedido.NomeCliente; this.dataTxt.Value = pedido.Data.ToShortDateString(); this.valorTxt.Value = pedido.Valor.ToString(); this.descricaoTxt.Value = pedido.Descricao; } }
protected void Page_Load(object sender, EventArgs e) { IClienteDAO clienteDAO = new ClienteDAOSQLServer(ConexaoSingleton.Conexao); this.gerenciadorClientes = new ClienteBLL(clienteDAO); IPedidoDAO pedidoDAO = new PedidoDAOSQLServer(ConexaoSingleton.Conexao); this.gerenciadorPedidos = new PedidoBLL(pedidoDAO); // A lista não deve ser recarregada no PostBack para não perder a seleção do usuário if (!Page.IsPostBack) { this.clienteSel.DataSource = this.gerenciadorClientes.BuscarClientes(); this.clienteSel.DataTextField = "Nome"; this.clienteSel.DataValueField = "Id"; this.clienteSel.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { IPedidoDAO pedidoDAO = new PedidoDAOSQLServer(ConexaoSingleton.Conexao); this.gerenciadorPedidos = new PedidoBLL(pedidoDAO); }