Example #1
0
    protected void BtnAddCanal_Click(object sender, EventArgs e)
    {
        CanalDis dis     = new CanalDis();
        bool     IsAsign = dis.AsigModeltoChann(DDlSelectChanel.SelectedValue, HdnIdModel.Value, true);

        if (IsAsign)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Se asignó correctamente el canal seleccionado.'); window.location='" +
                                                    Page.ResolveUrl("~/View/Comercial/AdmVentas/Productos/EdicionModelos.aspx?ID=" + HdnIdModel.Value + "&TOKEN=" + TOKEN) + "';", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Se produjo un error al tratar asignar el canal seleccionado, por favor intentelo nuevamente.'); window.location='" +
                                                    Page.ResolveUrl("~/View/Comercial/AdmVentas/Productos/EdicionModelos.aspx?ID=" + HdnIdModel.Value + "&TOKEN=" + TOKEN) + "';", true);
        }
    }
Example #2
0
    protected void BtnMdlDeleteCanal_Click(object sender, EventArgs e)
    {
        CanalDis dis      = new CanalDis();
        bool     IsDelete = dis.DeleteAsign(HdnMdlDeleteCanalID.Value);

        if (IsDelete)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Se ha eliminado el canal'); window.location='" +
                                                    Page.ResolveUrl("~/View/Comercial/AdmVentas/Productos/EdicionModelos.aspx?ID=" + HdnIdModel.Value + "&TOKEN=" + TOKEN) + "';", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Se produjo un error al tratar de eliminar el canal, por favor intentelo nuevamente.'); window.location='" +
                                                    Page.ResolveUrl("~/View/Comercial/AdmVentas/Productos/EdicionModelos.aspx?ID=" + HdnIdModel.Value + "&TOKEN=" + TOKEN) + "';", true);
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string ID = Request.QueryString["ID"];

        TOKEN = Request.QueryString["TOKEN"];

        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(ID) && !string.IsNullOrEmpty(TOKEN))
            {
                Modelos Model   = new Modelos();
                bool    IsModel = Model.IsModel(ID, true, TOKEN);
                HdnIdModel.Value = ID;
                if (IsModel)
                {
                    //Llena el dropdown de las formulas predeterminadas
                    FillDDlFormulasPred(DDLFormulasPred);

                    //fill DDL piezas y copmponentes
                    FillDDLFirstPieceOrComp();

                    Imagen.ImageUrl = Model._modelo.IMAGE;

                    TxtNombre.Text      = Model._modelo.NOMBRE;
                    LblCreateDate.Text  = Model._modelo.F_Created.ToLongDateString();
                    LblEditDate.Text    = Model._modelo.F_Update.ToLongDateString();
                    TxtDescripcion.Text = Model._modelo.DESCRIPCION;

                    FillDDlFamilia();

                    BomModel bomModel = new BomModel(ID, true);
                    FILLtablaBOM(bomModel.Lista);

                    //Fill DDr canales no asignaDOS y tabla



                    CanalDis cdis = new CanalDis();
                    FillTablaCanales(cdis.GetCanalesAsign(ID, true));
                    FillDDL(DDlSelectChanel, "CHANNAME", "ID", "Seleccionar", cdis.GetCanalesNOAsign(ID, true));

                    // Habilita el ddl de la familia
                    if (string.IsNullOrEmpty(Model._modelo.Familia))
                    {
                        DDLFamilia.Enabled   = true;
                        DDLCategoria.Enabled = false;
                        LinkBtnFamCat.Text   = "Actualizar";
                    }
                    else
                    {
                        DDLFamilia.SelectedValue = Model._modelo.IdFamilia;
                    }
                    //habilita el ddl de categoria
                    if (string.IsNullOrEmpty(Model._modelo.Categoria))
                    {
                        DDLCategoria.Enabled = false;
                        LinkBtnFamCat.Text   = "Actualizar";
                        GetListVariables getList = new GetListVariables(6);
                        FillDDlCategoria(getList.Listavariables);
                    }
                    else
                    {
                        GetListVariables Get = new GetListVariables();
                        Get.GetListModelCategory(Model._modelo.IdFamilia);
                        FillDDlCategoria(Get.ListCompCategory);
                        DDLCategoria.SelectedValue = Model._modelo.ID_PASIGFAMCAT.ToString();
                    }
                }
                else
                {
                    Response.Redirect(Error404.Redireccion(MasterPageFile, "El componente no fue encontrado"));
                }
            }
            else
            {
                Response.Redirect(Error404.Redireccion(MasterPageFile, "Hubo un error al tratar de buscar el componente, intentelo nuevamente"));
            }
        }
    }