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); }
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")); } } }