Exemplo n.º 1
0
    protected void Btnmodalprecio_Click(object sender, EventArgs e)
    {
        double number;
        double cantidad;
        bool   Isupdateprecio = false;
        bool   IsUpdateUnMed  = false;
        bool   IsUpdateCant   = false;
        string ErrorA         = "";
        string ErrorB         = "";
        string ErrorC         = "";

        ComponentesClass Comp = new ComponentesClass();

        if (Double.TryParse(TxtPrecio.Text, out number))
        {
            Isupdateprecio = Comp.UpdateComponente(HdnIdComp.Value, COT_MCOMPONENTES.Campos.PRECIO_UNIT(), number);
        }
        else
        {
            ErrorB = " Formato de precio no es correcto ";
        }

        if (Double.TryParse(TxtCant.Text, out cantidad))
        {
            IsUpdateCant = Comp.UpdateComponente(HdnIdComp.Value, COT_MCOMPONENTES.Campos.CANT_UNIT(), cantidad);
        }
        else
        {
            ErrorA = " Formato de cantidad no es correcto ";
        }

        IsUpdateUnMed = Comp.UpdateComponente(HdnIdComp.Value, COT_MCOMPONENTES.Campos.ID_MAGMED(), DDLUnidadmed.SelectedValue);


        if (!IsUpdateCant)
        {
            ErrorA = " Error en la cantidad ";
        }
        if (!Isupdateprecio)
        {
            ErrorB = " Error en el precio ";
        }
        if (!IsUpdateUnMed)
        {
            ErrorC = " Error en la unidad de medida ";
        }

        if (IsUpdateCant && Isupdateprecio && IsUpdateUnMed)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('La actualización ha sido exitosa.'); window.location='" +
                                                    Page.ResolveUrl("~/View/Comercial/AdmVentas/Productos/EdicionComponente.aspx?ID=" + HdnIdComp.Value + "&TOKEN=" + TOKEN) + "';", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script> $(document).ready(alert('Hubo un error al intentar actualizar , intentelo de nuevo. Errores " + ErrorA + ErrorB + ErrorC + "'));</script>", false);
        }
    }
Exemplo n.º 2
0
    protected void BtnEditImage_Click(object sender, EventArgs e)
    {
        string folio = DateTime.Now.ToLongTimeString().Replace(":", "");
        string path  = Path.Combine(Server.MapPath("~/Images/COT_COMPONENTES/"));

        if (!string.IsNullOrEmpty(FileUpFoto.FileName.ToString()))
        {
            string fileName  = folio + FileUpFoto.FileName.ToString();
            string path_foto = "http://" + HttpContext.Current.Request.Url.Authority + "/Images/COT_COMPONENTES/" + fileName;
            path = path + fileName;
            FileUpFoto.SaveAs(path);

            //hacer un update a la tabla con la foto
            ComponentesClass cOMPO      = new ComponentesClass();
            bool             Isinserted = cOMPO.UpdateComponente(HdnIdComp.Value, COT_MCOMPONENTES.Campos.IMG_PATH(), path_foto);
            if (!Isinserted)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script> $(document).ready(alert('Error al intentar Actualizar la información, intentelo nuevamente.'));</script>", false);
            }
            else
            {
                Response.Redirect("~/View/Comercial/AdmVentas/Productos/EdicionComponente.aspx?ID=" + HdnIdComp.Value + "&TOKEN=" + TOKEN);
            }
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script> $(document).ready(alert('No se seleccionó ningún archivo.'));</script>", false);
        }
    }
Exemplo n.º 3
0
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        ComponentesClass Comp     = new ComponentesClass();
        bool             IsDelete = Comp.UpdateComponente(HdnIDItem.Value, COT_MCOMPONENTES.Campos.ESTADO(), false);

        if (IsDelete)
        {
            Response.Redirect("~/View/Comercial/AdmVentas/Productos/AdministracionComponentes.aspx");
        }
    }
Exemplo n.º 4
0
    protected void LinkSelectAlfak_Click(object sender, EventArgs e)
    {
        ComponentesClass cOMPO        = new ComponentesClass();
        string           _CodigoAlfak = ((LinkButton)sender).Text;
        string           WGR          = DDLSubTipoProcAsocAlfak.SelectedValue;
        bool             IsEdited     = cOMPO.UpdateComponente(HdnIdbeforeCreate.Value, COT_MCOMPONENTES.Campos.COD_ALFAK(), _CodigoAlfak);
        bool             IsEdited2    = cOMPO.UpdateComponente(HdnIdbeforeCreate.Value, COT_MCOMPONENTES.Campos.KA_WGR(), WGR);

        if (WGR.Contains("B") || WGR.Contains("C") || WGR.Contains("D"))
        {
            cOMPO.UpdateComponente(HdnIdbeforeCreate.Value, "IsGlass", true);
        }

        if (IsEdited)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('El componente ha sido vinculado con el código " + _CodigoAlfak + " de Alfak'); window.location='" +
                                                    Page.ResolveUrl("~/View/Comercial/AdmVentas/Productos/EdicionComponente.aspx?ID=" + HdnIdbeforeCreate.Value + "&TOKEN=" + TOKEN) + "';", true);
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myalert", "alert('Se produjo un error al tratar de vincular el proceso con Alfak, por favor intentelo nuevamente.');", true);
        }
    }
Exemplo n.º 5
0
 protected void LinkBtnDescripcion_Click(object sender, EventArgs e)
 {
     if (TxtDescripcion.Enabled)
     {
         TxtDescripcion.Enabled  = false;
         LinkBtnDescripcion.Text = "Editar";
         //hacer un update a la tabla con la descripcion
         ComponentesClass cOMPO      = new ComponentesClass();
         bool             Isinserted = cOMPO.UpdateComponente(HdnIdComp.Value, COT_MCOMPONENTES.Campos.DESCRIPCION(), TxtDescripcion.Text);
         if (!Isinserted)
         {
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "none", "<script> $(document).ready(alert('Error al intentar Actualizar la información, intentelo nuevamente.'));</script>", false);
         }
     }
     else
     {
         TxtDescripcion.Enabled  = true;
         LinkBtnDescripcion.Text = "Actualizar";
     }
 }