protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Text = "";
            lblError.Visible = false;

            dba = DataBaseAccess.getInstance();

            //si no es un evento de boton
            if (!Page.IsPostBack)
            {
                listDataSource = getListDataSource();

                if (listDataSource == null)
                {
                    try
                    {
                        List<Record> result = dba.executeQuery("select numero, fecha, cli.codigo, cli.cedula+' - '+cli.nombre+' '+cli.apellido, "
                                                             + "vend.codigo, vend.codigo+' - '+vend.nombre+' '+vend.apellido, observacion "
                                                             + "from dbo.tblPedido ped inner join tblClientes cli on cli.codigo = ped.cliente "
                                                             + "inner join tblVendedores vend on vend.codigo = ped.vendedor ", typeof(PedidoTDA));

                        if (result != null && result.Count > 0)
                        {
                            listDataSource = new List<PedidoTDA>();
                            PedidoTDA tmp;
                            for (int i = 0; i < result.Count; i++)
                            {
                                tmp = (PedidoTDA)result.ElementAt(i);
                                listDataSource.Add(tmp);
                            }

                            listadoOrder.DataSource = listDataSource;
                            listadoOrder.DataBind();
                            setListDataSource(listDataSource);
                        }
                    }
                    catch (Exception error)
                    {
                        lblError.Text = "Se presento un error no controlado [" + error + "].";
                        lblError.Visible = true;
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Text = "";
            lblError.Visible = false;
            dba = DataBaseAccess.getInstance();

            listDataSource = getListDataSource();

            if (listDataSource == null){
                try{
                    List<Record> result = dba.executeQuery("select codigo, cedula, nombre, apellido, email, direccion, celular from dbo.tblClientes", typeof(ClienteTDA));

                    if (result != null && result.Count > 0)
                    {
                        listDataSource = new List<ClienteTDA>();
                        ClienteTDA tmp;
                        for (int i = 0; i < result.Count; i++)
                        {
                            tmp = (ClienteTDA)result.ElementAt(i);
                            listDataSource.Add(tmp);
                        }

                        listadoClientes.DataSource = listDataSource;
                        listadoClientes.DataBind();
                        setListDataSource(listDataSource);
                    }
                }
                catch (Exception error)
                {
                    lblError.Text = "Se presento un error no controlado [" + error + "].";
                    lblError.Visible = true;
                }
            }//50
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         dba = DataBaseAccess.getInstance();
         List<Object[]> listTemp = dba.executeQuery("select codigo, descripcion from dbo.tblTipoArticulo");
         Object[] temp;
         ddlTipo.Items.Clear();
         for (int i = 0; i < listTemp.Count; i++)
         {
             temp = listTemp.ElementAt(i);
             ddlTipo.Items.Add(new ListItem(temp[1].ToString(), temp[0].ToString()));
         }
         lblError.Text = "";
         lblError.Visible = false;
         //se carga la informacion de la persona
         articuloTDA = (ArticuloTDA)Session["sellerSelect"];
         if (articuloTDA != null && !(bool)Session["Page_Load_Seller"])
         {
             txtCodigo.Text = articuloTDA.Code + "";
             txtDescripcion.Text = articuloTDA.Description;
             //ddlRol.SelectedItem.Value = usuarioTDA.Rol;
             Session["Page_Load_Seller"] = true;
         }
     }
     catch (Exception error)
     {
         lblError.Text = "Se presento un error no controlado [" + error + "].";
         lblError.Visible = true;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                //Cargamos la info del usuario que se selecciona en el listado de los usuarios para modificarla
                try
                {
                    lblError.Text = "";
                    lblError.Visible = false;
                    dba = DataBaseAccess.getInstance();

                    if (Session["Page_Load_Order"] == null || !(bool)Session["Page_Load_Order"])
                    {
                        List<Object[]> listTemp = dba.executeQuery("select codigo, descripcion, valor from dbo.tblArticulo ");
                        valoresArticulos = new Double[listTemp.Count];
                        Object[] temp;
                        ddlArticulosDisp.Items.Clear();
                        for (int i = 0; i < listTemp.Count; i++)
                        {
                            temp = listTemp.ElementAt(i);
                            ddlArticulosDisp.Items.Add(new ListItem(temp[0].ToString()+" - "+temp[1].ToString().Trim(), temp[0].ToString()));
                            valoresArticulos[i] = Double.Parse(temp[2].ToString());
                        }
                        Session["valoresArticulos"] = valoresArticulos;
                        setListDataSourceArticulos(new List<DetallePedidoTDA>(0));
                    }

                    //se carga la informacion de la persona
                    pedidoTDA = (PedidoTDA)Session["orderSelect"];
                    if (pedidoTDA != null && !(bool)Session["Page_Load_Order"])
                    {
                        txtCode.Text = pedidoTDA.Numero + "";
                        txtFecha.Text = pedidoTDA.Fecha.ToShortDateString();
                        txtCliente.Text = pedidoTDA.NombreCliente;
                        txtVendedor.Text = pedidoTDA.NombreVendedor;
                        txtObservacion.Text = pedidoTDA.Observacion;
                    }
                }
                catch (Exception error)
                {
                    lblError.Text = "Se presento un error no controlado [" + error + "].";
                    lblError.Visible = true;
                }

                Session["Page_Load_Order"] = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Text = "";
            lblError.Visible = false;
            dba = DataBaseAccess.getInstance();

            listDataSource = getListDataSource();

            if (listDataSource == null)
            {
                try
                {
                    List<Record> result = dba.executeQuery("select codigo, descripcion, referencia, color, peso, valor, tipo from dbo.tblArticulo", typeof(ArticuloTDA));

                    if (result != null && result.Count > 0)
                    {
                        listDataSource = new List<ArticuloTDA>();
                        ArticuloTDA tmp;
                        for (int i = 0; i < result.Count; i++)
                        {
                            tmp = (ArticuloTDA)result.ElementAt(i);
                            listDataSource.Add(tmp);
                        }

                        listadoArticulo.DataSource = listDataSource;
                        listadoArticulo.DataBind();
                        setListDataSource(listDataSource);
                    }
                }
                catch (Exception error)
                {
                    lblError.Text = "Se presento un error no controlado [" + error + "].";
                    lblError.Visible = true;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Text = "";
            lblError.Visible = false;
            dba = DataBaseAccess.getInstance();

            listDataSource = getListDataSource();

            if (listDataSource == null){
                try{
                    List<Record> result = dba.executeQuery("select usu.codigo, usu.usuario, usu.password, rol.descripcion "
                                                            + "from dbo.tblUsuario usu, dbo.tblRol rol where rol.codigo = usu.rol  ", typeof(UsuarioTDA));

                    if (result != null && result.Count > 0){
                        listDataSource = new List<UsuarioTDA>();
                        UsuarioTDA tmp;
                        for (int i = 0; i < result.Count; i++){
                            tmp = (UsuarioTDA)result.ElementAt(i);
                            listDataSource.Add(tmp);
                        }

                        listadoUser.DataSource = listDataSource;
                        listadoUser.DataBind();
                        setListDataSource(listDataSource);
                    }
                }
                catch (Exception error){
                    lblError.Text = "Se presento un error no controlado [" + error + "].";
                    lblError.Visible = true;
                }
            }
        }