Example #1
0
        /*
         *	Page_PreLoad()
         */
        protected void Page_PreLoad()
        {
            mensaje.Text = ("");
            // Cargar recursos
            try{
                opcion = Convert.ToString(Request.QueryString["op"]);
                string[] path  = url.Split('/');
                string   vista = (path[path.Length - 1]);
                view = vista.Split('.');

                switch (view[0])
                {
                // Peticiones de Vista "Producto.aspx"
                case "producto":
                    if (IsPostBack)
                    {
                        // ¡¡Registrar nuevo producto!!
                        errores = ValidarNuevoProducto();
                        if (errores.Count > 0)
                        {
                            ImprimirErrores();
                        }
                        else
                        {
                            p = RegistrarProducto();
                        }
                    }
                    else
                    {
                        // Cargar Elementos de Vista
                        tipo.Items.Clear();
                        familiaDP.Items.Clear();
                        subFamiliaDP.Items.Clear();

                        f        = new Familia();
                        familias = f.FindAllFamilias();

                        sf          = new SubFamilia();
                        subfamilias = sf.FindAllSubFamily();
                    }
                    break;

                // Peticiones de Vista "Productos.aspx"
                case "productos":


                    break;

                // Peticiones de Vista "Familias.aspx"
                case "familias":
                    // Guardar Familia
                    if (IsPostBack)
                    {
                        switch (opcion)
                        {
                        case "familia":
                            // Guardar Nueva Familia
                            break;

                        case "subFamilia":
                            // Guardar Nueva Sub-Familia
                            break;
                        }
                    }
                    else
                    {
                        f        = new Familia();
                        familias = f.FindAllFamilias();

                        sf          = new SubFamilia();
                        subfamilias = sf.FindAllSubFamily();
                    }
                    break;
                }
            }catch (Exception ex) {
                mensaje.Text += ("Error :" + ex.ToString() + "");
            }
        }