Пример #1
0
 protected void DDLmagnitud_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DDLmagnitud.SelectedIndex != 0)
     {
         GetMagnitudes Mag = new GetMagnitudes(DDLmagnitud.SelectedValue);
         LblMedida1.Visible   = true;
         DDLUnidadmed.Visible = true;
         FillDDLUnidadmed(Mag.AllMagnitudes);
         LblPrecioX.Visible  = false;
         TxtPrecio.Visible   = false;
         LblSimbolUn.Visible = false;
         LblCantX.Visible    = false;
         TxtCant.Visible     = false;
         LblCant2.Visible    = false;
     }
     else
     {
         LblPrecioX.Visible   = false;
         TxtPrecio.Visible    = false;
         LblSimbolUn.Visible  = false;
         DDLUnidadmed.Visible = false;
         LblMedida1.Visible   = false;
         LblCantX.Visible     = false;
         TxtCant.Visible      = false;
         LblCant2.Visible     = false;
     }
 }
Пример #2
0
    protected void DDLUnidadmed_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DDLUnidadmed.SelectedIndex != 0)
        {
            GetMagnitudes Mag   = new GetMagnitudes();
            bool          Ismag = Mag.IsMagnitud(DDLUnidadmed.SelectedValue);
            if (Ismag)
            {
                LblPrecioX.Visible  = true;
                TxtPrecio.Visible   = true;
                LblSimbolUn.Visible = true;
                LblPrecioX.Text     = "Precio por " + Mag._Magnitud.SIMBOLO + ":";

                LblCantX.Visible = true;
                TxtCant.Visible  = true;
                LblCant2.Visible = true;

                LblCantX.Text = Mag._Magnitud.SIMBOLO + " por unidad de entrega:";;
            }
        }
        else
        {
            LblCantX.Visible    = false;
            TxtCant.Visible     = false;
            LblCant2.Visible    = false;
            LblPrecioX.Visible  = false;
            TxtPrecio.Visible   = false;
            LblSimbolUn.Visible = false;
        }
    }
Пример #3
0
 protected void DDLMdlEditUnMed_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DDLMdlEditUnMed.SelectedIndex != 0)
     {
         GetMagnitudes mAG   = new GetMagnitudes();
         bool          IsMAG = mAG.IsMagnitud(DDLMdlEditUnMed.SelectedValue);
         if (IsMAG)
         {
             LblMdlEditSimbUnit.Text = "/" + mAG._Magnitud.SIMBOLO;
         }
     }
 }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetMagnitudes Mag = new GetMagnitudes();
            FillDDL(DDLmagnitud, "MAGNITUD", "MAGNITUD", "Seleccionar Magnitud", Mag.Magnitudes());

            //cargar los 30 default
            GetListProcesos procesos = new GetListProcesos();
            FillingTable(procesos.ListaProcesos);
        }
    }
Пример #5
0
    protected void BtnEditItem_Click(object sender, EventArgs e)
    {
        //cargar los valores y abrir el modal
        string _ID     = HdnIDItem.Value;
        string TokenId = HdnTokenIdItem.Value;

        ProcesosClass Proc = new ProcesosClass();

        ProcesosClass._Proceso proceso = Proc.GetProceso(_ID, TokenId, true);
        TxtMdlEditNombre.Text = proceso.Nombre;
        TxtMdlEditDescr.Text  = proceso.Descripcion;

        //cargar el DDLmag
        GetMagnitudes Mag = new GetMagnitudes();

        FillDDL(DDLMdlEditMag, "MAGNITUD", "MAGNITUD", "Seleccionar Magnitud", Mag.Magnitudes());
        DDLMdlEditMag.SelectedValue = proceso._Magnitud;

        //cargar el DDLUnidMed
        GetMagnitudes UnidMed = new GetMagnitudes(DDLMdlEditMag.SelectedValue);

        FillDDL(DDLMdlEditUnMed, "UNIDAD_MEDIDA", "_ID", "Seleccionar Unidad", UnidMed.AllMagnitudes);
        DDLMdlEditUnMed.SelectedValue = proceso.ID_Magmed;
        LblMdlEditSimbUnit.Text       = " /" + proceso._MagSimbolo;
        TxtMdlEditCosto.Text          = proceso.Costo_Unit.ToString();
        string mermax100 = (proceso.Merma * 100).ToString();

        if (string.IsNullOrEmpty(proceso._CodAlfak))
        {
            LblEditAsocAlfak.Text = "No tiene asociado Proceso de Alfak ";

            LinkTomdlAsocAlfak.InnerHtml = "Asociar";
        }
        else
        {
            ProductoAlfak             alfak       = new ProductoAlfak();
            ProductoAlfak.BA_PRODUKTE bA_PRODUKTE = alfak.GetByCod(proceso._CodAlfak);
            LblEditAsocAlfak.Text = "El código Alfak asociado es " + proceso._CodAlfak + " - " + bA_PRODUKTE.Descripcion;

            LinkTomdlAsocAlfak.InnerHtml = "Editar";
        }



        string Function = "OpenModalEdit('" + mermax100 + "');";

        ScriptManager.RegisterStartupScript(this, typeof(Page), "CallMyFunction", Function, true);

        GetListProcesos procesos = new GetListProcesos();

        FillingTable(procesos.ListaProcesos);
    }
Пример #6
0
 protected void DDLMdlEditMag_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DDLMdlEditMag.SelectedIndex != 0)
     {
         DDLMdlEditUnMed.Enabled = true;
         GetMagnitudes Mag = new GetMagnitudes(DDLMdlEditMag.SelectedValue);
         FillDDL(DDLMdlEditUnMed, "UNIDAD_MEDIDA", "_ID", "Seleccionar Unidad", Mag.AllMagnitudes);
     }
     else
     {
         DDLMdlEditUnMed.Enabled = false;
     }
 }
Пример #7
0
    protected void FillDDLMagnitud()
    {
        GetMagnitudes Mag = new GetMagnitudes();

        FillDDL(DDLmagnitud, "MAGNITUD", "MAGNITUD", "Seleccionar Magnitud", Mag.Magnitudes());
    }
Пример #8
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))
            {
                ComponentesClass CsC          = new ComponentesClass();
                bool             IsComponente = CsC.IsComponente(ID, TOKEN);
                HdnIdComp.Value = ID;
                if (IsComponente)
                {
                    Imagen.ImageUrl = CsC._Detalle.Path_Photo;

                    TxtNombre.Text      = CsC._Detalle.Nombre;
                    LblCreateDate.Text  = CsC._Detalle.F_Creacion.ToLongDateString();
                    LblEditDate.Text    = CsC._Detalle.F_Actualizacion.ToLongDateString();
                    TxtDescripcion.Text = CsC._Detalle.Descripcion;


                    FillDDLMagnitud();
                    FamiliasAlfak alfak = new FamiliasAlfak();
                    List <FamiliasAlfak.Familia> familias = alfak.familias;
                    FamiliasAlfak.Familia        Item1    = new FamiliasAlfak.Familia {
                        ID = "VI", Name = "VIDRIOS"
                    };
                    familias.Add(Item1);

                    FillDDL(DDLTipoProcAsocAlfak, "Name", "ID", "Seleccionar Tipo", familias);

                    if (string.IsNullOrEmpty(CsC._Detalle.COD_ALFAK))
                    {
                        LblEditAsocAlfak.Text        = "El componente no tiene asociado ningún código en Alfak";
                        LinkTomdlAsocAlfak.InnerHtml = "Asociar";
                        TitleMdlAsocAlfak1.InnerHtml = "Asociar Código Alfak";
                    }
                    else
                    {
                        ProductoAlfak             alfakP   = new ProductoAlfak();
                        ProductoAlfak.BA_PRODUKTE producto = alfakP.GetByCod(CsC._Detalle.COD_ALFAK);
                        LblEditAsocAlfak.Text        = "El componente tiene asociado el código Alfak \"" + producto.CodigoAlfak + "\" - " + producto.Descripcion;
                        lblFamilyAlfak.Text          = "Familia Alfak " + producto.Familia_Alfak;
                        LinkTomdlAsocAlfak.InnerHtml = "Editar";
                        TitleMdlAsocAlfak1.InnerHtml = "Editar Código Alfak";
                    }



                    //habilita el textbox si es que no tiene precio
                    if (CsC._Detalle.PrecioUn == 0)
                    {
                    }
                    //habilita el textbox para actualizar la cantidad del componente
                    if (CsC._Detalle.CantEmb == 0)
                    {
                    }



                    //verifica si tiene precio
                    if (CsC._Detalle.PrecioUn == 0)
                    {
                        BtnEditPrecio.InnerHtml = "Ingresar";
                        LblPrecioydim.Text      = "Debe ingresar precio y dimensión.";
                    }
                    else
                    {
                        BtnEditPrecio.InnerHtml = "Editar";
                        GetMagnitudes Mag = new GetMagnitudes();

                        LblPrecioydim.Text        = "Precio por " + CsC._Detalle.UnMedSimbolo + " : " + CsC._Detalle.PrecioUn.ToString("C0", CultureInfo.CurrentCulture);
                        LblCantEmb.Text           = CsC._Detalle.CantEmb + " " + CsC._Detalle.UnidadMedida + " por unidad de entrega.";
                        TxtPrecio.Text            = CsC._Detalle.PrecioUn.ToString();
                        TxtCant.Text              = CsC._Detalle.CantEmb.ToString();
                        DDLmagnitud.SelectedValue = CsC._Detalle.Magnitud;
                        DDLUnidadmed.Visible      = true;
                        GetMagnitudes Mag2 = new GetMagnitudes(CsC._Detalle.Magnitud);

                        FillDDLUnidadmed(Mag2.AllMagnitudes);

                        DDLUnidadmed.SelectedValue = CsC._Detalle.ID_Magnitud;
                        LblPrecioX.Visible         = true;
                        LblCantX.Visible           = true;
                        TxtCant.Visible            = true;
                        TxtPrecio.Visible          = true;
                        LblCant2.Visible           = true;

                        LblCantX.Text       = CsC._Detalle.UnidadMedida + " por unidad de entrega:";
                        LblMedida1.Visible  = true;
                        LblSimbolUn.Visible = true;
                        LblPrecioX.Text     = "Precio por " + CsC._Detalle.UnMedSimbolo + ":";
                    }

                    //verifica si tiene procesos asociados
                    ProcesosClass.GetProcNoAsign procesos = new ProcesosClass.GetProcNoAsign(ID, true);
                    FillDDlProcesos(procesos.Procesos);
                    if (!CsC._Detalle.HasProc)
                    {
                        LblProcesos.Text     = "No tiene procesos asociados";
                        LblMdltitleProc.Text = "Agregar Procesos";
                    }
                    else
                    {
                        LblMdltitleProc.Text = "Agregar Procesos";
                        LblProcesos.Visible  = false;
                        ProcesosClass.GetProcAsign procAsign = new ProcesosClass.GetProcAsign(ID, true);
                        FillingTable(procAsign.Procesos);
                    }
                }
                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"));
            }
        }
    }
Пример #9
0
    public List <_Componente> GetComponenteDetail(string ID)
    {
        List <_Componente> Componentes = new List <_Componente>();


        Conn = new Coneccion();
        bool Estado = true;



        string Select = "SELECT * FROM COT_MCOMPONENTES WHERE ESTADO=1 AND ID=@ID";

        DataTable TablaDetalle = new DataTable();

        using (Conn.ConnPlabal)
        {
            try
            {
                SqlDataAdapter adaptador = new SqlDataAdapter(Select, Conn.ConnPlabal);
                adaptador.SelectCommand.Parameters.AddWithValue("@ESTADO", Estado);
                adaptador.SelectCommand.Parameters.AddWithValue("@ID", ID);

                adaptador.Fill(TablaDetalle);
            }
            catch (Exception ex)
            {
            }
        }

        if (TablaDetalle.Rows.Count > 0)
        {
            foreach (DataRow dr in TablaDetalle.Rows)
            {
                _Componente Item = new _Componente
                {
                    _ID             = dr["ID"].ToString(),
                    Nombre          = dr["NOMBRE"].ToString(),
                    Descripcion     = dr["DESCRIPCION"].ToString(),
                    PrecioUn        = Convert.ToDouble(dr["PRECIO_UNIT"].ToString()),
                    CantEmb         = Convert.ToDouble(dr["CANT_UNIT"].ToString()),
                    F_Actualizacion = Convert.ToDateTime(dr["F_UPDATE"].ToString()),
                    F_Creacion      = Convert.ToDateTime(dr["F_CREATED"].ToString()),
                    HasProc         = Convert.ToBoolean(dr["HASPROC"].ToString()),
                    Path_Photo      = dr["IMG_PATH"].ToString(),
                    TokeId          = dr["TokenId"].ToString(),
                };
                GetVarLine Line = new GetVarLine(dr["ID_MTABMA"].ToString(), dr["ID_MTABCOL"].ToString(), dr["ID_MASIGFAMCAT"].ToString());
                if (Line.HasVarline)
                {
                    Item.ID_Familia     = Line.ID_Familia;
                    Item.Familia        = Line.Familia;
                    Item.ID_Categoria   = Line.ID_Categoria;
                    Item.Categoria      = Line.Categoria;
                    Item.ID_MASIGFAMCAT = dr["ID_MASIGFAMCAT"].ToString();
                }
                if (Line.HasMarca)
                {
                    Item.ID_Marca = Line._ID_MARCA;
                    Item.Marca    = Line._Nombre_Marca;
                }
                if (Line.HasColor)
                {
                    Item.ID_Color = Line.ID_Color;
                    Item.Color    = Line.Color;
                }
                GetMagnitudes Mag    = new GetMagnitudes();
                bool          HasMag = Mag.IsMagnitud(dr["ID_MAGMED"].ToString());
                if (HasMag)
                {
                    Item.ID_Magnitud  = Mag._Magnitud._ID;
                    Item.Magnitud     = Mag._Magnitud.MAGNITUD;
                    Item.UnMedSimbolo = Mag._Magnitud.SIMBOLO;
                }
                Componentes.Add(Item);
            }
        }



        return(Componentes);
    }