Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Object sesidioma = Session["idiomases"];

        try
        {
            L_AdministrarProducto logica = new L_AdministrarProducto();
            U_aux_AdminProd       resp   = logica.page_load(IsPostBack, Session["Sesion"], Session["IdProducto"]);
            Session["Productos"] = resp.Products;
            Prueba1.DataSource   = resp.Products;
            Prueba1.DataBind();
            idProducto.Text = resp.IdProducto.ToString();

            //Seteando Idiomas
            L_Idioma  idiot      = new L_Idioma();
            Int32     formulario = 13;
            Int32     idiom      = Convert.ToInt32(sesidioma);
            Hashtable compIdioma = new Hashtable();
            idiot.mostraridioma(formulario, idiom, compIdioma);
            try
            {
                this.header.InnerText         = compIdioma["header"].ToString();
                this.tbl_produ.InnerText      = compIdioma["tbl_produ"].ToString();
                this.nom.InnerText            = compIdioma["nom"].ToString();
                this.desc.InnerText           = compIdioma["desc"].ToString();
                this.cant.InnerText           = compIdioma["cant"].ToString();
                this.perc.InnerText           = compIdioma["perc"].ToString();
                this.cate.InnerText           = compIdioma["cate"].ToString();
                this.alert.InnerText          = compIdioma["alert"].ToString();
                this.modif.InnerText          = compIdioma["modif"].ToString();
                this.delete.InnerText         = compIdioma["delete"].ToString();
                this.mod_data.InnerText       = compIdioma["mod_data"].ToString();
                this.descri.InnerText         = compIdioma["descri"].ToString();
                this.nombr.InnerText          = compIdioma["nombr"].ToString();
                this.quant.InnerText          = compIdioma["quant"].ToString();
                this.price.InnerText          = compIdioma["price"].ToString();
                this.cat.InnerText            = compIdioma["cat"].ToString();
                this.img.InnerText            = compIdioma["img"].ToString();
                this.key_words.InnerText      = compIdioma["key_words"].ToString();
                this.add.InnerText            = compIdioma["add"].ToString();
                this.alr.InnerText            = compIdioma["alr"].ToString();
                this.BTN_Modificar.Text       = compIdioma["BTN_Modificar"].ToString();
                this.BTN_ModificarAlerta.Text = compIdioma["BTN_ModificarAlerta"].ToString();
                this.BTN_SubirFotos.Text      = compIdioma["BTN_SubirFotos"].ToString();
            }
            catch (Exception ex)
            { }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "scrti", "redireccionar('" + resp.Redir + "');", true);
        }
        catch (Exception ex)
        {
            //Significa que no se deben de recargar los controles
            String[] men = ex.Message.Split('/');
            idProducto.Text = men[0];
        }
    }
Exemple #2
0
        public U_aux_AdminProd page_load(bool postback, Object Session, Object id_producto)
        {
            //DDAOProducto DAO_Producto = new DDAOProducto();
            U_aux_AdminProd response = new U_aux_AdminProd();

            if (!postback)
            {
                if (Session == null)
                {
                    response.Redir = "LoginUsr.aspx";
                    return(response);
                    // Response.Redirect("LoginUsr.aspx");
                }
                DataTable Empresa = (DataTable)Session;
                if (Empresa.Rows[0]["idTipo"].ToString() != "2")
                {
                    response.Redir = "LoginUsr.aspx";
                    return(response);
                    //Response.Redirect("LoginUsr.aspx");
                }
                if (int.Parse(Empresa.Rows[0]["estadoEmpresa"].ToString()) != 1)
                {
                    response.Redir = "PerfilEmpresa.aspx";
                    return(response);
                    //Response.Redirect("PerfilEmpresa.aspx");
                }
                DB_Producto        daoProd  = new DB_Producto();
                List <UEUProducto> products = daoProd.traer_productos(int.Parse(Empresa.Rows[0]["idEmpresa"].ToString()));
                response.Products = products;
                //DataTable Productos = DAO_Producto.MostrarProducto(int.Parse(Empresa.Rows[0]["idEmpresa"].ToString()));
                //response.Productos = Productos;
            }
            else
            {
                if (id_producto != null)
                {
                    throw new System.ArgumentException(id_producto.ToString());
                }
                else
                {
                    throw new System.ArgumentException("0");
                }
            }
            if (id_producto != null)
            {
                response.IdProducto = id_producto.ToString();
            }
            return(response);
        }