protected void rptValoracionesCriterios_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { GestorVariable gestor = new GestorVariable(); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DropDownList ddlVariables = (DropDownList)e.Item.FindControl("ddlVariables"); Criterio criterio = ((Criterio)e.Item.DataItem); HiddenField txtIdCriterio = (HiddenField)e.Item.FindControl("txtIdCriterio"); txtIdCriterio.Value = criterio.idCriterio.ToString(); ddlVariables.DataSource = gestor.obtenerVariablesPorProyecto(); ddlVariables.DataTextField = "abreviacion"; ddlVariables.DataValueField = "idVariable"; ddlVariables.DataBind(); ListItem tituloCriterio = new ListItem(criterio.nombre, "", true); tituloCriterio.Selected = true; tituloCriterio.Attributes.Add("disabled", "disabled"); ddlVariables.Items.Insert(0, tituloCriterio); } } catch (Exception ex) { Label lblMensajeEdiciones = (Label)e.Item.FindControl("lblMensajeEdiciones"); lblMensajeEdiciones.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Proyecto proyecto = (Proyecto)Session["proyecto"]; if (proyecto == null) { Response.Redirect("mis-proyectos.aspx"); } litNombreProyecto.Text = proyecto.nombre; string thisURL = Request.Url.Segments[Request.Url.Segments.Count() - 1]; switch (thisURL) { case "criterios.aspx": barraProgreso.Attributes.Add("style", "width: 25%"); litProgreso.Text = "25% Completado"; break; case "variables.aspx": barraProgreso.Attributes.Add("style", "width: 50%"); litProgreso.Text = "50% Completado"; break; case "alternativas.aspx": barraProgreso.Attributes.Add("style", "width: 75%"); litProgreso.Text = "75% Completado"; break; case "generar-informe.aspx": barraProgreso.Attributes.Add("style", "width: 100%"); litProgreso.Text = "100% Completado"; break; } GestorCriterio gestorCritero = new GestorCriterio(); GestorAlternativa gestorAlternativa = new GestorAlternativa(); GestorVariable gestorVariables = new GestorVariable(); int cantVariables = gestorVariables.obtenerCantVariablesPorProyecto(); int cantAlterntivas = gestorAlternativa.obtenerCantAlternativasPorProyecto(); int cantCriterios = gestorCritero.obtenerCantCriteriosPorProyecto(); //if (cantCriterios == 0) //{ // lbVaribles.Attributes.Add("class", "list-group-item disabled"); // lbAlterntivas.Attributes.Add("class", "list-group-item disabled"); // lbGenerarInforme.Attributes.Add("class", "list-group-item disabled"); //} //else if (cantVariables == 0) //{ // lbAlterntivas.Attributes.Add("class", "list-group-item disabled"); // lbGenerarInforme.Attributes.Add("class", "list-group-item disabled"); //} //else if(cantAlterntivas==0) { // lbGenerarInforme.Attributes.Add("class", "list-group-item disabled"); //} litCantCriterios.Text = cantCriterios.ToString(); litCantAlternativas.Text = cantAlterntivas.ToString(); litCantVariables.Text = cantVariables.ToString(); } }
protected void cargarRepeaterVariables() { GestorVariable gestor = new GestorVariable(); rptVariables.DataSource = gestor.obtenerVariablesPorProyecto(); rptVariables.DataBind(); cargarGraficoVariables(); }
private void cargarGraficoVariables() { GestorVariable gestor = new GestorVariable(); if (gestor.obtenerCantVariablesPorProyecto() > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "variables", "drawVariables(" + gestor.obtenerGraficoVariables() + ");", true); } }
protected void btnSiguiente_Click(object sender, EventArgs e) { GestorVariable gestor = new GestorVariable(); if (gestor.obtenerCantVariablesPorProyecto() > 0) { Response.Redirect("alternativas.aspx"); } else { mostrarError(); litError.Text = "Debe cargar al menos una variable!"; } }
protected void btnModificar_Click(object sender, EventArgs e) { try { GestorVariable gestor = new GestorVariable(); gestor.modificarVariable(txtNombre.Value, txtAbreviacion.Value, txtColor.Value, decimal.Parse(txtA.Value, CultureInfo.InvariantCulture), decimal.Parse(txtB.Value, CultureInfo.InvariantCulture), decimal.Parse(txtC.Value, CultureInfo.InvariantCulture)); reestablecerPantalla(); cargarRepeater(); } catch (Exception ex) { mostrarError(); litError.Text = ex.Message; } }
protected void btnEliminar_Click(object sender, EventArgs e) { try { ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "closeModalEliminar();", true); GestorVariable gestor = new GestorVariable(); gestor.eliminarVariablePorId(); cargarRepeater(); reestablecerPantalla(); } catch (Exception ex) { mostrarError(); litError.Text = ex.Message; } }
protected void rptProyectos_ItemCommand(object source, RepeaterCommandEventArgs e) { try { reestablecerPantalla(); GestorVariable gestor = new GestorVariable(); if (e.CommandName == "editar") { int idVariable = int.Parse(e.CommandArgument.ToString()); Variable variable = gestor.obtenerVariablePorId(idVariable); Session["variable"] = variable; txtNombre.Value = variable.nombre; txtAbreviacion.Value = variable.abreviacion; txtColor.Value = variable.color; txtA.Value = variable.a.ToString(CultureInfo.InvariantCulture); txtB.Value = variable.b.ToString(CultureInfo.InvariantCulture); txtC.Value = variable.c.ToString(CultureInfo.InvariantCulture); btnAgregar.Visible = false; btnModificar.Visible = true; btnCancelar.Visible = true; } if (e.CommandName == "eliminar") { Variable variable = gestor.obtenerVariablePorId(int.Parse(e.CommandArgument.ToString())); Session["variable"] = variable; litNombreVariable.Text = variable.nombre; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalEliminar();", true); } cargarGrafico(); } catch (Exception ex) { mostrarError(); litError.Text = ex.Message; } }