protected void Page_Load(object sender, EventArgs e) { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); if (Request.IsAuthenticated) { CRoles objCRoles = new CRoles(); if (!Page.IsPostBack) { int idusuario = Convert.ToInt32(Session["idusuario"]); string rol = objCRoles.ObtenerRol(idusuario); if (rol == "Administrador" || rol == "MEN") { /*Cargo el control gridview con el data source obtenido de instituciones educativas*/ } else if (rol == "Consultor" || rol == "Revisor") { } else { Response.Write("<script>alert('Acceso Denagado!');</script>"); Response.Redirect("Login.aspx"); } modEESeleccion.Visible = true; } } else Response.Redirect("/Login.aspx"); }
protected void AlmacenarActorActa() { int idacta = Convert.ToInt32(Session["idactaSE"]); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); ESM.Model.AsociadoActaVisitaSE objAsociadosActaVisitaSE = null; objAsociadosActaVisitaSE = new Model.AsociadoActaVisitaSE { IdActaVisita = idacta, Cargo = txtCargo.Text, Telefono = txtTelefono.Text, Nombre = txtNombre.Text, CorreoElectronico = txtCorreo.Text }; db.AsociadoActaVisitaSEs.InsertOnSubmit(objAsociadosActaVisitaSE); try { db.SubmitChanges(); } catch (Exception) { Response.Write("<script>alert('Error en BD.');</script>"); //Alert.Show(""); } CargarActores(idacta); }
protected void AlmacenarActorActa() { int idacta = Convert.ToInt32(Session["idactasis"]); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); ESM.Model.AsociadoActaVisitaSistematizacion objAsociadosActaVisitasis = null; objAsociadosActaVisitasis = new Model.AsociadoActaVisitaSistematizacion { IdActaVisita = idacta, Cargo = txtCargo.Text, Telefono = txtTelefono.Text, Nombre = txtNombre.Text, CorreoElectronico = txtCorreo.Text, Institucion = txtinstitucion.Text, Identificacion = txtidentificacionasociado.Text.Trim().Length == 0 ? "" : txtidentificacionasociado.Text }; db.AsociadoActaVisitaSistematizacions.InsertOnSubmit(objAsociadosActaVisitasis); try { db.SubmitChanges(); } catch (Exception) { Response.Write("<script>alert('Error en BD.');</script>"); } CargarActores(idacta); }
protected void btnAlmacenarActa_Click(object sender, EventArgs e) { if (Session["idactasis"] != null) { int idacta = Convert.ToInt32(Session["idactasis"]); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var acsis = (from ase in db.ActaVisitaSistematizacions where ase.IdActaVisita == idacta select ase).Single(); acsis.Observaciones = txtObservacion.Text; acsis.Medicione.FechaMedicion = DateTime.Now.AddHours(2); try { db.SubmitChanges(); Response.Write("<script>alert('El proceso de almacenamiento finalizó correctamente.');</script>"); } catch (Exception) { Response.Write("<script>alert('El proceso de almacenamiento finalizó sin éxito.');</script>"); } } }
public static string AutenticacionUsuario(string usuario, string contrasena) { try { CCryptography objCCryptography = new CCryptography(); usuario = usuario.Trim(); contrasena = objCCryptography.Encrypt(contrasena,"{MD5/MGGROUP@Security}"); using (ESM.Model.ESMBDDataContext db = new ESM.Model.ESMBDDataContext()) { string idusuario = null; Table<Usuario> tUsuarios = db.GetTable<Usuario>(); var rUsuarios = from u in tUsuarios where u.Contrasena == contrasena && u.Usuario1 == usuario select new { u.IdUsuario }; foreach (var r in rUsuarios) { idusuario = r.IdUsuario.ToString(); } if (rUsuarios.Count() != 0) { var tkc = new FormsAuthenticationTicket(usuario, true, 15000); string encriptar = FormsAuthentication.Encrypt(tkc); HttpContext.Current.Response.Cookies.Add( new HttpCookie(FormsAuthentication.FormsCookieName, encriptar)); } return idusuario; } } catch (Exception) { return null; } }
protected void ReportDiligenciamientoSE() { try { IQueryable<ESM.Model.AsociadoActaVisitaSE> asistse = null; IQueryable<ESM.Model.AsignaDocumento> asigse = null; ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var ses = from s in db.Secretaria_Educacions select new { s, s.IdSecretaria, s.Nombre, Consultor = s.Consultore.Nombre }; gvdilise.DataSource = ses; gvdilise.DataBind(); for (int i = 0; i < gvdilise.Rows.Count; i++) { Label lblidse = (Label)gvdilise.Rows[i].FindControl("lblidse"); Label lblActaDocumento = (Label)gvdilise.Rows[i].FindControl("lblActaDocumento"); Label lblCantAsocioados = (Label)gvdilise.Rows[i].FindControl("lblCantAsocioados"); Label lblfechadili = (Label)gvdilise.Rows[i].FindControl("lblfechadili"); Label lblactaestado = (Label)gvdilise.Rows[i].FindControl("lblactaestado"); Label lbllcestado = (Label)gvdilise.Rows[i].FindControl("lbllcestado"); int idse = Convert.ToInt32(lblidse.Text); #region Verificación de Parametros ESM.Model.ActaVisitaSE ase = new ESM.Model.ActaVisitaSE(); try { ase = (from asec in db.ActaVisitaSEs where asec.IdSE == idse select asec).Single(); } catch (Exception) { ase = null; } if (ase != null) { lblfechadili.Text = ase.Medicione.FechaMedicion.ToShortDateString(); asigse = from asigsec in db.AsignaDocumentos where asigsec.IdMedicion == ase.IdMedicion select asigsec; foreach (var itemasigse in asigse) { if (itemasigse.IdDocumento == 14) { lblActaDocumento.Text = "Si"; break; } } int cantasis = (from aso in db.AsociadoActaVisitaSEs where aso.IdActaVisita == ase.IdActaVisita select aso).Count(); lblCantAsocioados.Text = cantasis.ToString(); } #endregion #region Validacion Lectura Contexto SE ESM.Model.LecturaContextoSE objLecturaContextoSE = new Model.LecturaContextoSE(); try { objLecturaContextoSE = (from lcse in db.LecturaContextoSEs where lcse.IdSecretaria == idse select lcse).Single(); } catch (Exception) { objLecturaContextoSE = null; } bool estadolcse = true; if (objLecturaContextoSE != null) { if (objLecturaContextoSE._2_1_.ToString().Trim().Length == 0) estadolcse = false; if ((bool)objLecturaContextoSE._2_2_) if (objLecturaContextoSE._2_2_1_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._2_2_2_.ToString().Trim().Length == 0) estadolcse = false; if ((bool)objLecturaContextoSE._2_2_3_EE_) { if (objLecturaContextoSE._2_2_3_EE_Cant == 0) estadolcse = false; } if ((bool)objLecturaContextoSE._2_2_3_EST_) { if (objLecturaContextoSE._2_2_3_EST_Cant == 0) estadolcse = false; } if ((bool)objLecturaContextoSE._2_2_3_EDU) { if (objLecturaContextoSE._2_2_3_EDU_Cant == 0) estadolcse = false; } if ((bool)objLecturaContextoSE._2_2_3_PAD_) { if (objLecturaContextoSE._2_2_3_PAD_Cant == 0) estadolcse = false; } if (objLecturaContextoSE._2_2_3_OTR_1.ToString().Trim().Length != 0) { if (objLecturaContextoSE._2_2_3_OTR_1_Cant == 0) estadolcse = false; } if (objLecturaContextoSE._2_2_3_OTR_2.ToString().Trim().Length != 0) { if (objLecturaContextoSE._2_2_3_OTR_2_Cant == 0) estadolcse = false; } if (objLecturaContextoSE._2_2_3_OTR_3_.ToString().Trim().Length != 0) { if (objLecturaContextoSE._2_2_3_OTR_3_Cant == 0) estadolcse = false; } if (objLecturaContextoSE._2_2_3_OTR_4_.ToString().Trim().Length != 0) { if (objLecturaContextoSE._2_2_3_OTR_4_Cant == 0) estadolcse = false; } if (objLecturaContextoSE._2_2_3_OTR_5_.ToString().Trim().Length != 0) { if (objLecturaContextoSE._2_2_3_OTR_5_Cant == 0) estadolcse = false; } if (objLecturaContextoSE._2_2_4_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._2_2_5_.ToString().Trim().Length == 0) estadolcse = false; if ((bool)objLecturaContextoSE._2_3_) if (objLecturaContextoSE._2_3_1_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._3_1_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._3_2_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._3_3_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._3_4_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._3_5_.ToString().Trim().Length == 0) estadolcse = false; if (objLecturaContextoSE._3_6_.ToString().Trim().Length == 0) estadolcse = false; if ((bool)objLecturaContextoSE._4_1_) if (objLecturaContextoSE._4_1_1_.ToString().Trim().Length == 0) estadolcse = false; if ((bool)objLecturaContextoSE._1_1_8_) if (objLecturaContextoSE._1_1_9_.ToString().Trim().Length == 0) estadolcse = false; if (estadolcse) lbllcestado.Text = "Diligenciada"; else if (!estadolcse) lbllcestado.Text = "Parcial"; } #endregion if (lblfechadili.Text != "No Asignada" && Convert.ToInt32(lblCantAsocioados.Text) > 0 && lblActaDocumento.Text == "Si") lblactaestado.Text = "Diligenciada"; else if (lblfechadili.Text != "No Asignada" && Convert.ToInt32(lblCantAsocioados.Text) >= 0) lblactaestado.Text = "Parcial"; else lblactaestado.Text = "Sin Diligenciar"; } } catch (Exception) { } }
protected void ReportEE() { try { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var ee = from eec in db.Establecimiento_Educativos where eec.Estado == true select new { eec.IdIE, eec.Secretaria_Educacion.Nombre, Consultor = eec.Secretaria_Educacion.Consultore.Nombre, eec.CodigoDane, EENombre = eec.Nombre, eec.Municipio }; gvDiliEE.DataSource = ee; gvDiliEE.DataBind(); gvcopyDiliEE.DataSource = ee; gvcopyDiliEE.DataBind(); for (short j = 0; j < gvDiliEE.Rows.Count; j++) { Label lblidie = (Label)gvDiliEE.Rows[j].FindControl("lblidie"); Label lblevalest = (Label)gvDiliEE.Rows[j].FindControl("lblevalest"); Label lblevalpad = (Label)gvDiliEE.Rows[j].FindControl("lblevalpad"); Label lblevalprof = (Label)gvDiliEE.Rows[j].FindControl("lblevalprof"); Label lblevaldir = (Label)gvDiliEE.Rows[j].FindControl("lblevaldir"); Label lblevaledu = (Label)gvDiliEE.Rows[j].FindControl("lblevaledu"); Label lblcantdir = (Label)gvDiliEE.Rows[j].FindControl("lblcantdir"); Label lblcantest = (Label)gvDiliEE.Rows[j].FindControl("lblcantest"); Label lblcantpad = (Label)gvDiliEE.Rows[j].FindControl("lblcantpad"); Label lblcantedu = (Label)gvDiliEE.Rows[j].FindControl("lblcantedu"); Label lblcantpro = (Label)gvDiliEE.Rows[j].FindControl("lblcantpro"); Label lblpei = (Label)gvDiliEE.Rows[j].FindControl("lblpei"); Label lblpmi = (Label)gvDiliEE.Rows[j].FindControl("lblpmi"); Label lblmaco = (Label)gvDiliEE.Rows[j].FindControl("lblmaco"); Label lblplan = (Label)gvDiliEE.Rows[j].FindControl("lblplan"); Label lblproy = (Label)gvDiliEE.Rows[j].FindControl("lblproy"); Label lblotros = (Label)gvDiliEE.Rows[j].FindControl("lblotros"); Label lblactaeecargada = (Label)gvDiliEE.Rows[j].FindControl("lblactaeecargada"); Label lblestadoactaee = (Label)gvDiliEE.Rows[j].FindControl("lblestadoactaee"); Label lblcita = (Label)gvDiliEE.Rows[j].FindControl("lblcita"); Label lblobservaciones = (Label)gvDiliEE.Rows[j].FindControl("lblobservaciones"); Label lblidiec = (Label)gvcopyDiliEE.Rows[j].FindControl("lblidie"); Label lblevalestc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblevalest"); Label lblevalpadc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblevalpad"); Label lblevalprofc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblevalprof"); Label lblevaldirc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblevaldir"); Label lblevaleduc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblevaledu"); Label lblcantdirc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblcantdir"); Label lblcantestc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblcantest"); Label lblcantpadc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblcantpad"); Label lblcanteduc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblcantedu"); Label lblcantproc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblcantpro"); Label lblpeic = (Label)gvcopyDiliEE.Rows[j].FindControl("lblpei"); Label lblpmic = (Label)gvcopyDiliEE.Rows[j].FindControl("lblpmi"); Label lblmacoc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblmaco"); Label lblplanc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblplan"); Label lblproyc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblproy"); Label lblotrosc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblotros"); Label lblactaeecargadac = (Label)gvcopyDiliEE.Rows[j].FindControl("lblactaeecargada"); Label lblestadoactaeec = (Label)gvcopyDiliEE.Rows[j].FindControl("lblestadoactaee"); Label lblcitac = (Label)gvcopyDiliEE.Rows[j].FindControl("lblcita"); Label lblobservacionesc = (Label)gvcopyDiliEE.Rows[j].FindControl("lblobservaciones"); int idmedicion = 0; for (short i = 0; i < 6; i++) { try { #region Seccion Consulta Evaluacion int Idactor = i + 1; var coleval = (from ev in db.Evaluacions where ev.IdActor == Idactor && ev.IdIE == Convert.ToInt32(lblidie.Text) select new { ev.IdMedicion, ev.EstadoEvaluacion.Estado }).Single(); string evalact = coleval.Estado; idmedicion = (int)coleval.IdMedicion; switch (Idactor) { case 1: lblevalest.Text = evalact; lblevalestc.Text = evalact; break; case 2: lblevalprof.Text = evalact; lblevalprofc.Text = evalact; break; case 3: lblevaledu.Text = evalact; lblevaleduc.Text = evalact; break; case 4: lblevalpad.Text = evalact; lblevalpadc.Text = evalact; break; case 6: lblevaldir.Text = evalact; lblevaldirc.Text = evalact; break; } #endregion } catch (Exception) { } } #region Documentos Establecimiento Educativo var docsaee = from deec in db.AsignaDocumentos where deec.IdMedicion == idmedicion select deec; foreach (var docsitem in docsaee) { switch (docsitem.IdDocumento) { //PEI case 1: lblpei.Text = "Diligenciado"; lblpeic.Text = "Diligenciado"; break; //PMI case 2: lblpmi.Text = "Diligenciado"; lblpmic.Text = "Diligenciado"; break; //Manual de Convivencia case 3: lblmaco.Text = "Diligenciado"; lblmacoc.Text = "Diligenciado"; break; //Plan de Estudios case 4: lblplan.Text = "Diligenciado"; lblplanc.Text = "Diligenciado"; break; //DPP case 9: lblproy.Text = "Diligenciado"; lblproyc.Text = "Diligenciado"; break; //Otros case 10: lblotros.Text = "Diligenciado"; lblotrosc.Text = "Diligenciado"; break; //ActaVisitaEE case 11: lblactaeecargada.Text = "Diligenciado"; lblactaeecargadac.Text = "Diligenciado"; break; } } #endregion #region Seccion Consulta Acta var acee = from aee in db.ActaVisitaEEs where aee.IdEE == Convert.ToInt32(lblidie.Text) select new { aee.AsociadosActaVisitaEEs, aee.Medicione.FechaMedicion }; #region Seccion Consulta Documentos foreach (var item in acee) { foreach (var asistitem in item.AsociadosActaVisitaEEs) { switch (asistitem.IdActor) { //Estudiante case 1: int cantest = (from c in item.AsociadosActaVisitaEEs where c.IdActor == 1 select c).Count(); lblcantest.Text = cantest.ToString(); lblcantestc.Text = cantest.ToString(); break; //Profesional case 2: int cantpro = (from c in item.AsociadosActaVisitaEEs where c.IdActor == 2 select c).Count(); lblcantpro.Text = cantpro.ToString(); lblcantproc.Text = cantpro.ToString(); break; //Educador case 3: int cantedu = (from c in item.AsociadosActaVisitaEEs where c.IdActor == 3 select c).Count(); lblcantedu.Text = cantedu.ToString(); lblcanteduc.Text = cantedu.ToString(); break; //Padre de Familia case 4: int cantpad = (from c in item.AsociadosActaVisitaEEs where c.IdActor == 4 select c).Count(); lblcantpad.Text = cantpad.ToString(); lblcantpadc.Text = cantpad.ToString(); break; //Directivos case 6: int cantdir = (from c in item.AsociadosActaVisitaEEs where c.IdActor == 6 select c).Count(); lblcantdir.Text = cantdir.ToString(); lblcantdirc.Text = cantdir.ToString(); break; } } } #endregion #endregion #region Seccion Consulta Lectura Contexto EE ESM.Model.LecturaContextoEE lcee = null; try { lcee = (from lceec in db.LecturaContextoEEs where lceec.IdIE == Convert.ToInt32(lblidie.Text) select lceec).Single(); } catch (Exception) { lcee = null; } if (lcee != null) { bool estadolcee = true; if (!(bool)lcee.f11 && !(bool)lcee.f12 && !(bool)lcee.f13 && !(bool)lcee.f14 && !(bool)lcee.f15) estadolcee = false; if (!(bool)lcee._1_2bRural && !(bool)lcee._1_2bUrbana) estadolcee = false; if (!(bool)lcee.C_1 && !(bool)lcee.C_2 && !(bool)lcee.C_3 && !(bool)lcee.C_4 && !(bool)lcee.C_5) estadolcee = false; int totalestrato = Convert.ToInt32(lcee._2_2_E1) + Convert.ToInt32(lcee._2_2_E2) + Convert.ToInt32(lcee._2_2_E3) + Convert.ToInt32(lcee._2_2_E4) + Convert.ToInt32(lcee._2_2_E5) + Convert.ToInt32(lcee._2_2_E6); if (totalestrato < 100) { if (lblobservaciones.Text == "Ninguna") lblobservaciones.Text = "La suma total de estratos no puede ser menor a 100%."; estadolcee = false; } else if (totalestrato > 100) { estadolcee = false; if (lblobservaciones.Text == "Ninguna") lblobservaciones.Text = "La suma total de estratos no puede ser mayor a 100%."; } int totalsisben = Convert.ToInt32(lcee._2_3_S1) + Convert.ToInt32(lcee._2_3_S2) + Convert.ToInt32(lcee._2_3_S3) + Convert.ToInt32(lcee._2_3_S4) + Convert.ToInt32(lcee._2_3_NoSabe) + Convert.ToInt32(lcee._2_3_NoTiene); if (totalsisben < 100) { if (lblobservaciones.Text == "Ninguna") lblobservaciones.Text = "La suma total de sisben no puede ser menor a 100%."; estadolcee = false; } else if (totalsisben > 100) { if (lblobservaciones.Text == "Ninguna") lblobservaciones.Text = "La suma total de sisben no puede ser mayor a 100%."; estadolcee = false; } if ((bool)lcee._2_4_Si) if (lcee._2_5_1.ToString().ToString().Trim() == "0" && lcee._2_5_2.ToString().ToString().Trim() == "0" && lcee._2_5_3.ToString().ToString().Trim() == "0") estadolcee = false; if (lcee._3_1.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_2.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_3.ToString().Trim().Length == 0) estadolcee = false; if ((bool)lcee._3_4_Si) if (lcee._3_4_1.ToString().Trim().Length == 0) estadolcee = false; if ((bool)lcee._3_5_Si) { if (lcee._3_5_1.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_5_2.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_5_3.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_5_4.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_5_5.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_5_6.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_5_7.ToString().Trim().Length == 0) estadolcee = false; } if (lcee._3_6.ToString().Trim().Length == 0) estadolcee = false; if (lcee._3_7.ToString().Trim().Length == 0) estadolcee = false; if ((bool)lcee._3_8_Si) if (lcee._3_8_1.ToString().Trim().Length == 0) estadolcee = false; if ((bool)lcee._3_9_Si) if (lcee._3_9_1.ToString().Trim().Length == 0) estadolcee = false; if (!(bool)lcee._4_1_Algunas && (bool)lcee._4_1_Si && (bool)lcee._4_1_No) estadolcee = false; else if ((bool)lcee._4_1_Si) if (lcee._4_2.ToString().Trim().Length == 0) estadolcee = false; if ((bool)lcee._4_3_Si) if (lcee._4_3_1.ToString().Trim().Length == 0) estadolcee = false; if ((bool)lcee._5_1_Si) if (lcee._5_1_1.ToString().Trim().Length == 0) estadolcee = false; //Validacion General para acta de establecimiento educativo if (estadolcee) { lblestadoactaee.Text = "Diligenciado"; lblestadoactaeec.Text = "Diligenciado"; } else { lblestadoactaee.Text = "Parcial"; lblestadoactaeec.Text = "Parcial"; } } #endregion #region Fecha Visita ESM.Model.Cita objCita = null; try { objCita = (from c in db.Citas where c.IdEE == Convert.ToInt32(lblidie.Text) select c).Take(1).Single(); } catch (Exception) { objCita = null; } if (objCita != null) { lblcita.Text = objCita.FechaInicio.ToShortDateString(); lblcitac.Text = objCita.FechaInicio.ToShortDateString(); } #endregion } //DataTable dt = new DataTable(); //dt = ConvertToDataTable(gvDiliEE); //string filename = Server.MapPath("/Excel/Diligenciamiento_EE_v01.xlsx"); //ExportDataTable(dt, filename); } catch (Exception) { ProcesoFinalizado = false; } }
protected int InsertarActaVisita() { try { int idmedicion = Convert.ToInt32(Session["idmedAccsis"]); int idusuario = Convert.ToInt32(Session["idusuario"]); int idee = Convert.ToInt32(Session["idieaccsis"]); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); ESM.Model.ActaVisitaSistematizacion objActaVisitaSis = new Model.ActaVisitaSistematizacion { IdUsuario = idusuario, IdEE = idee, IdMedicion = idmedicion, }; db.ActaVisitaSistematizacions.InsertOnSubmit(objActaVisitaSis); db.SubmitChanges(); return objActaVisitaSis.IdActaVisita; } catch (Exception) { return 0; } }
protected void CargarIndicadoresGroupActividades() { ESMBDDataContext db = new Model.ESMBDDataContext(); var indicadores_col = from ind in db.Indicadores where ind.Actividade.Subproceso.Causas_Efecto.Proyecto_id == proyecto_id select ind; string json_to_return = "{\"page\":\"1\",\"total\":1,\"records\":\"1\",\"rows\": ["; foreach (var item in indicadores_col) { json_to_return = json_to_return + "{\"id\":\"" + item.Id.ToString() + "\",\"cell\":[\"" + item.Id + "\",\"" + item.Actividade.Actividad + "\", \"" + item.Indicador + "\"]} ,"; } json_to_return = json_to_return.Trim(','); json_to_return = json_to_return + "]}"; Response.Write(json_to_return); }
protected void CargarActores(int idacta) { try { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var sisacc = from s in db.AsociadoActaVisitaSistematizacions where s.IdActaVisita == idacta select new { s.Nombre, s.Telefono, s.CorreoElectronico, s.Cargo, s.Institucion }; gvIndividuos.DataSource = sisacc; gvIndividuos.DataBind(); gvIndividuos.RowHeaderColumn.Replace("Telefono", "Teléfono"); gvIndividuos.RowHeaderColumn.Replace("CorreoElectronico", "Correo Electrónico"); var ob = (from o in db.ActaVisitaSistematizacions where o.IdActaVisita == idacta select new { o.Observaciones }).Single(); if (ob != null) txtObservacion.Text = ob.Observaciones; } catch { } }
protected bool Filtro(string texto) { try { /*Instancio*/ Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var rFiltro = from i in db.Secretaria_Educacions where i.Nombre.Contains(texto) select i; gvResultados.DataSourceID = null; gvResultados.DataSource = rFiltro; gvResultados.DataBind(); return true; } catch (Exception) { return false; } }
protected void gvResultados_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow _objRow = gvResultados.SelectedRow; Label lblIdIe = (Label)_objRow.Cells[4].FindControl("IDIE"); Session.Remove("idseacc"); Session.Add("idseacc", lblIdIe.Text); lblNombrese.Text = _objRow.Cells[1].Text; lblTelefonose.Text = _objRow.Cells[3].Text; lblMunicipio.Text = _objRow.Cells[2].Text; int idse = Convert.ToInt32(lblIdIe.Text); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var seinfo = (from se in db.Secretaria_Educacions where se.IdSecretaria == idse select se).Single(); txtNombreEE.Text = seinfo.Nombre; txtNombreEE.Enabled = false; txtDireccion.Text = seinfo.Direccion; txtDireccion.Enabled = false; txtTelefonoEE.Text = seinfo.Telefono; txtTelefonoEE.Enabled = false; var medse = (from lc in db.LecturaContextoSEs where lc.IdSecretaria == idse select new { lc.IdMedicion, Fecha = lc.Medicione.FechaMedicion }).Distinct(); if (medse != null) { gvMediciones.DataSource = medse; gvMediciones.DataBind(); ObtenerTema(gvMediciones); #region Visualizacion de Controles modEESeleccion.Visible = false; ModMediciones.Visible = true; gvMediciones.Visible = true; modEESeleccion.Visible = false; //for (int i = 0; i < gvMediciones.Rows.Count; i++) //{ // if (i == gvMediciones.Rows.Count - 1) // gvMediciones.Rows[i].Visible = true; // else // gvMediciones.Rows[i].Visible = false; //} #endregion } else { #region Visualizacion de Controles modEESeleccion.Visible = false; ModMediciones.Visible = true; gvMediciones.Visible = true; modEESeleccion.Visible = false; #endregion Response.Write("<script>alert('No existen mediciones existentes para la SE.');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { Page.MaintainScrollPositionOnPostBack = true; if (Request.IsAuthenticated) { if (!Page.IsPostBack) { if (Session["idusuario"] != null) { int idusuario = Convert.ToInt32(Session["idusuario"]); string rol = _objCRoles.ObtenerRol(idusuario); if (rol == "Administrador") { gvSE.DataSource = _objLecturaContextoSECRE.ObtenerSE(); gvSE.DataBind(); ObtenerTema(gvSE); } else if (rol == "Consultor" || rol == "MEN" || rol == "Revisor") { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var se = from s in db.Secretaria_Educacions where s.IdConsultor == _objCRoles.IdConsultor select s; gvSE.DataSource = se; gvSE.DataBind(); ObtenerTema(gvSE); } } else Response.Redirect("/Login.aspx"); } } else Response.Redirect("Login.aspx"); }
protected string generateMarcoLogico(int Proyecto_id) { if (Proyecto_id != 0) { Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var procesos = from p in db.Causas_Efectos where p.Proyecto_id == Proyecto_id select p; var proyecto_info = (from py in db.Proyectos where py.Id == Proyecto_id select py).Single(); string html = "<table border='1' cellspacing='0' style='border: 1px solid #000; width: 100%;'><caption style='border: 1px solid #000;'>MARCO LÓGICO</caption>"; html += "<tr><td style='border: 1px solid #000;'>" + proyecto_info.Finalidad + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'>INDICADOR</td><td style='border: 1px solid #000;'>MEDIOS DE VERIFICACIÓN</td><td style='border: 1px solid #000;'>SUPUESTOS</td></tr>"; int color = 0; string color_cadena = "D6D6D6"; foreach (var procesos_item in procesos) { if (color == 0) { color_cadena = "E0E0E0"; color++; } else { color_cadena = "ffffff"; color = 0; } html += "<tr style='background: #" + color_cadena + "'><td style='border: 1px solid #000;'><b>PROCESO/OBJETIVO:</b></td><td style='border: 1px solid #000;'>" + procesos_item.Proceso + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td></tr>"; var subprocesos = from sp in db.Subprocesos where sp.Causas_Efecto.Proyecto_id == proyecto_id && sp.Proceso_id == procesos_item.Id select sp; foreach (var subprocesos_item in subprocesos) { var actividades = from a in db.Actividades where a.Subproceso.Causas_Efecto.Proyecto_id == proyecto_id && a.Subproceso_id == subprocesos_item.Id select a; html += "<tr style='background: #" + color_cadena + "'><td style='border: 1px solid #000;'><b>SUBPROCESO:</b></td><td style='border: 1px solid #000;'>" + subprocesos_item.Subproceso1 + "</td><td style='border: 1px solid #000;'>" + subprocesos_item.Indicador + "</td><td style='border: 1px solid #000;'>" + subprocesos_item.Medios + "</td><td style='border: 1px solid #000;'>" + subprocesos_item.Supuestos + "</td></tr>"; int count_actividades = 0; foreach (var actividades_item in actividades) { if (count_actividades == 0) { if (actividades.Count() <= 1) html += "<tr style='background: #" + color_cadena + "'><td style='vertical-align: middle; text-align: center; border: 1px solid #000;' rowspan='" + actividades.Count() + "'><b>ACTIVIDAD:</b></td><td style='border: 1px solid #000;'>" + actividades_item.Actividad + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td></tr>"; else html += "<tr style='background: #" + color_cadena + "'><td style='vertical-align: middle; text-align: center; border: 1px solid #000;' rowspan='" + actividades.Count() + "'><b>ACTIVIDAD:</b></td><td style='border: 1px solid #000;'>" + actividades_item.Actividad + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td></tr>"; } else html += "<tr style='background: #" + color_cadena + "'><td style='border: 1px solid #000;'>" + actividades_item.Actividad + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td></tr>"; count_actividades++; } } } html = html + "</table>"; return html; } else return ""; }
protected void AgregarIndicadores() { bool metaIsNumeric = true; int actividad = Convert.ToInt32(Session["actividad"].ToString()); int verbo = Convert.ToInt32(Session["verbo"].ToString()); for (int i = 0; i < Session["meta"].ToString().Length; i++) { bool IsNumber = char.IsNumber(Session["meta"].ToString(), i); if (!IsNumber) metaIsNumeric = false; } int meta = 0; if (metaIsNumeric) meta = Convert.ToInt32(Session["meta"].ToString()); int unidad = Convert.ToInt32(Session["unidad"].ToString()); string medios = Session["medios"].ToString(); string supuestos = Session["supuestos"].ToString(); string descripcion = Session["descripcion"].ToString(); bool ssp = false; if (Session["ssp"].ToString() == "Si") ssp = true; DateTime fechainicial = Convert.ToDateTime(Session["fechainicial"].ToString()); DateTime fechafinal = Convert.ToDateTime(Session["fechafinal"].ToString()); Model.ESMBDDataContext db = new ESMBDDataContext(); string verbo_text = (from v in db.Verbos where v.Id == verbo select v.Verbo1).Single(); string unidad_text = (from u in db.Unidades where u.Id == unidad select u.Unidad).Single(); string indicador = ""; if (Session["tiporedaccion"].ToString() == "entre") { indicador = verbo_text + " " + meta + " " + descripcion + " entre " + fechainicial.ToShortDateString() + " y " + fechafinal.ToShortDateString(); } else if (Session["tiporedaccion"].ToString() == "hasta") { indicador = "A " + fechainicial.ToShortDateString() + " " + verbo_text + " " + meta + " " + descripcion; } if (objCActividades.AddIndicador(actividad, indicador, verbo, unidad, fechainicial, fechafinal, meta, ssp, medios, supuestos, descripcion)) { Session.Remove("ind_id"); Session.Remove("actividad"); Session.Remove("verbo"); Session.Remove("meta"); Session.Remove("unidad"); Session.Remove("ssp"); Session.Remove("fechainicial"); Session.Remove("fechafinal"); Session.Remove("operacion"); Session.Remove("medios"); Session.Remove("supuestos"); Session.Remove("descripcion"); Session.Remove("tiporedaccion"); } }
protected void EditarIndicadores() { int ind_id = Convert.ToInt32(Session["ind_id"].ToString()); int verbo = Convert.ToInt32(Session["verbo"].ToString()); int meta = Convert.ToInt32(Session["meta"].ToString()); int unidad = Convert.ToInt32(Session["unidad"].ToString()); DateTime fechainicial = Convert.ToDateTime(Session["fechainicial"].ToString()); DateTime fechafinal = Convert.ToDateTime(Session["fechafinal"].ToString()); string medios = Session["medios"].ToString(); string supuestos = Session["supuestos"].ToString(); string descripcion = Session["descripcion"].ToString(); bool ssp = false; if (Session["ssp"].ToString() == "Si") ssp = true; Model.ESMBDDataContext db = new ESMBDDataContext(); string verbo_text = (from v in db.Verbos where v.Id == verbo select v.Verbo1).Single(); string unidad_text = (from u in db.Unidades where u.Id == unidad select u.Unidad).Single(); string indicador = ""; if (Session["tiporedaccion"].ToString() == "entre") { indicador = verbo_text + " " + meta + " " + descripcion + " entre " + fechainicial + " y " + fechafinal; } else if (Session["tiporedaccion"].ToString() == "hasta") { indicador = "A " + fechainicial + " " + verbo_text + " " + meta + " " + descripcion; } if (objCActividades.UpdateIndicador(ind_id, indicador, verbo, unidad, fechainicial, fechafinal, meta, ssp, medios, supuestos, descripcion)) { Session.Remove("ind_id"); Session.Remove("actividad"); Session.Remove("verbo"); Session.Remove("meta"); Session.Remove("unidad"); Session.Remove("ssp"); Session.Remove("fechainicial"); Session.Remove("fechafinal"); Session.Remove("operacion"); Session.Remove("medios"); Session.Remove("supuestos"); Session.Remove("descripcion"); Session.Remove("tiporedaccion"); } }
protected void deleteFile(int file_id) { try { var db = new ESM.Model.ESMBDDataContext(); var proyectoFile = (from dp in db.Documentos_Proyectos where dp.Id == file_id select dp).Single(); proyectoFile.Estado = false; db.SubmitChanges(); Response.Write("Proceso Completado!"); } catch (Exception) { Response.Write("Proceso sin éxito."); } }
protected void CargarPlanOperativo() { ESMBDDataContext db = new Model.ESMBDDataContext(); var subproceso_col = from subprocesos in db.Subprocesos where subprocesos.Causas_Efecto.Proyecto_id == proyecto_id select subprocesos; string json_to_return = "{\"page\":\"1\",\"total\":1,\"records\":\"1\",\"rows\": ["; foreach (var item in subproceso_col) { json_to_return = json_to_return + "{\"id\":\"" + item.Id.ToString() + "\",\"cell\":[\"" + item.Id + "\",\"" + item.Causas_Efecto.Causa + "\",\"" + item.Subproceso1 + "\"]} ,"; } json_to_return = json_to_return.Trim(','); json_to_return = json_to_return + "]}"; Response.Write(json_to_return); }
private void ObtenerMunicipios() { if (Request.QueryString["ObtenerMunicipios"] != null && Convert.ToBoolean(Request.QueryString["ObtenerMunicipios"])) { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var municipio_regs = from m in db.municipios where m.departamento_id == Convert.ToInt32(Request.QueryString["idDepartamento"]) select m; string optMunicipios = ""; foreach (var key in municipio_regs) { optMunicipios += "<option value='" + key.idmunicipio + "'>" + key.nombre + "</option>"; } Response.Write(optMunicipios); } }
protected int InsertarActaVisita() { try { int idmedicion = Convert.ToInt32(Session["idmedAcc"]); int idusuario = Convert.ToInt32(Session["idusuario"]); int idse = Convert.ToInt32(Session["idseacc"]); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); ESM.Model.ActaVisitaSE objActaVisitaSE = new Model.ActaVisitaSE { IdUsuario = idusuario, IdSE = idse, IdMedicion = idmedicion, }; db.ActaVisitaSEs.InsertOnSubmit(objActaVisitaSE); db.SubmitChanges(); return objActaVisitaSE.IdActaVisita; } catch (Exception) { return 0; } }
protected int RegistrarEvaluacion(int idie, int idmedicion, int idactor, int idusuario, bool estado, int tipo) { try { ESM.Model.ESMBDDataContext db = new ESM.Model.ESMBDDataContext(); Evaluacion objEvaluacion = null; if (tipo == 1) { #region Estado SE switch (estado) { case true: objEvaluacion = new Evaluacion { IdActor = idactor, IdSE = idie, Fecha = DateTime.Now, IdUsuario = idusuario, IdMedicion = idmedicion, IdEstado = 2 }; break; case false: objEvaluacion = new Evaluacion { IdActor = idactor, IdSE = idie, Fecha = DateTime.Now, IdUsuario = idusuario, IdMedicion = idmedicion, IdEstado = 1 }; break; } #endregion } else { #region Estado IE switch (estado) { case true: objEvaluacion = new Evaluacion { IdActor = idactor, IdIE = idie, Fecha = DateTime.Now, IdUsuario = idusuario, IdMedicion = idmedicion, IdEstado = 2 }; break; case false: objEvaluacion = new Evaluacion { IdActor = idactor, IdIE = idie, Fecha = DateTime.Now, IdUsuario = idusuario, IdMedicion = idmedicion, IdEstado = 1 }; break; } #endregion } db.Evaluacions.InsertOnSubmit(objEvaluacion); db.SubmitChanges(); _idEvaluacion = objEvaluacion.IdEvaluacion; return objEvaluacion.IdEvaluacion; } catch (Exception) { return 0; } }
protected void ReemplazarControles() { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var a = from asig in db.Caracterizacions where asig.IdCaracterizacion == idcaracterizacion select asig; lknActaVisitaSis.Visible = true; brnCargar.Text = "Reemplazar"; FActaVisitaSis.Visible = false; }
protected void ReemplazarControles() { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var a = from asig in db.AsignaDocumentos where asig.IdMedicion == idmedicion select asig; foreach (var item in a) { if (item.IdDocumento == 1) { lknPEI.Visible = true; btnUpPEIS.Text = "Reemplazar"; FPEI.Visible = false; } if (item.IdDocumento == 2) { lknPMI.Visible = true; btnUpPMI.Text = "Reemplazar"; FPMI.Visible = false; } if (item.IdDocumento == 3) { lknMC.Visible = true; btnUpMC.Text = "Reemplazar"; FMC.Visible = false; } } }
protected void btnAlmacenarActa_Click(object sender, EventArgs e) { if (Session["idactaEE"] != null) { int idacta = Convert.ToInt32(Session["idactaEE"]); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var acee = (from aee in db.ActaVisitaEEs where aee.IdActaVisita == idacta select aee).Single(); acee.Observaciones = txtObservacion.Text; try { db.SubmitChanges(); Response.Write("<script>alert('Acta almacenada Correctamente.');</script>"); } catch (Exception) { Response.Write("<script>alert('Error de almacenamiento.');</script>"); } } }
protected int ExistActa(int medicion) { try { ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var ac = from a in db.ActaVisitaSistematizacions where a.IdMedicion == medicion select a; if (ac.Count() != 0) return ac.First().IdActaVisita; else return 0; } catch (Exception) { return 0; } }
protected bool Filtro(string texto, int idconsultor) { try { /*Instancio*/ Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var rFiltro = from i in db.Establecimiento_Educativos where i.Nombre.Contains(texto) && i.Estado == true && i.Secretaria_Educacion.IdConsultor == idconsultor select i; gvResultados.DataSourceID = null; gvResultados.DataSource = rFiltro; gvResultados.DataBind(); ObtenerTema(gvResultados); return true; } catch (Exception) { return false; } }
protected void AlmacenarActorActa() { int idacta = Convert.ToInt32(Session["idactaEE"]); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); ESM.Model.AsociadosActaVisitaEE objAsociadosActaVisitaEE = null; if (cboActores.SelectedItem.Value == "1") { objAsociadosActaVisitaEE = new Model.AsociadosActaVisitaEE { IdActor = Convert.ToInt32(cboActores.SelectedItem.Value), IdActaVisita = idacta, Grado = txtGrado.Text, Telefono = txtTelefono.Text, Nombre = txtNombre.Text, CorreoElectronico = txtCorreo.Text, Identificacion = txtidentificacionasociado.Text.Trim().Length == 0 ? "" : txtidentificacionasociado.Text }; } else if (cboActores.SelectedItem.Value == "3") { objAsociadosActaVisitaEE = new Model.AsociadosActaVisitaEE { IdActor = Convert.ToInt32(cboActores.SelectedItem.Value), IdActaVisita = idacta, AreasEnseñansa = txtGensenanza.Text, GradosEnseñansa = txtGradosEnsenanza.Text, Telefono = txtTelefono.Text, Nombre = txtNombre.Text, CorreoElectronico = txtCorreo.Text, Identificacion = txtidentificacionasociado.Text.Trim().Length == 0 ? "" : txtidentificacionasociado.Text }; } else if (cboActores.SelectedItem.Value == "4") { objAsociadosActaVisitaEE = new Model.AsociadosActaVisitaEE { IdActor = Convert.ToInt32(cboActores.SelectedItem.Value), IdActaVisita = idacta, GradoHijos = txtGradoHijos.Text, Telefono = txtTelefono.Text, Nombre = txtNombre.Text, CorreoElectronico = txtCorreo.Text, IdNivelEducativo = Convert.ToInt32(cboNivelesEducativos.SelectedValue), Identificacion = txtidentificacionasociado.Text.Trim().Length == 0 ? "" : txtidentificacionasociado.Text }; } else if (cboActores.SelectedItem.Value == "6") { objAsociadosActaVisitaEE = new Model.AsociadosActaVisitaEE { IdActor = Convert.ToInt32(cboActores.SelectedItem.Value), IdActaVisita = idacta, Cargo = txtCargo.Text, Telefono = txtTelefono.Text, Nombre = txtNombre.Text, CorreoElectronico = txtCorreo.Text, Identificacion = txtidentificacionasociado.Text.Trim().Length == 0 ? "" : txtidentificacionasociado.Text }; } db.AsociadosActaVisitaEEs.InsertOnSubmit(objAsociadosActaVisitaEE); try { db.SubmitChanges(); } catch (Exception) { Response.Write("<script>alert('Error en BD.');</script>"); } CargarActores(idacta); }
protected void gvResultados_SelectedIndexChanged(object sender, EventArgs e) { modEESeleccion.Visible = false; ModMediciones.Visible = true; //LC.Visible = true; Session.Add("codie", gvResultados.SelectedRow.Cells[1].Text); string codie = Session["codie"].ToString(); Label objIDIE = (Label)gvResultados.SelectedRow.FindControl("IDIE"); int idie = Convert.ToInt32(objIDIE.Text); Session.Add("ideelc", idie); ESM.Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var ie = from ies in db.Establecimiento_Educativos where ies.IdIE == idie select ies; foreach (var item in ie) { txtNombre.Text = item.Nombre; txtTelefonos.Text = item.Telefono; txtDireccion.Text = item.Direccion; txtCodigo.Text = item.CodigoDane; txtCorreoElectronico.Text = item.Email; txtNombre.Enabled = false; txtTelefonos.Enabled = false; txtDireccion.Enabled = false; txtCorreoElectronico.Enabled = false; txtCodigo.Enabled = false; txtMunicipio.Text = item.Municipio; txtMunicipio.Enabled = false; } IQueryable<ESM.Model.LecturaContextoEE> mediciones = CEE.ObtenerMedicionesEE(idie); if (mediciones.Count() != 0 && mediciones != null) { var med = from m in mediciones select new { IdMedicion = m.IdMedicion, Fecha = m.Medicione.FechaMedicion }; gvMediciones.DataSource = med; gvMediciones.DataBind(); gvMediciones.Visible = true; ObtenerTema(gvMediciones); btnRegistrar.Visible = true; } else btnRegistrar.Visible = true; }
protected string generatePlanOperativoReport(int Proyecto_id) { Model.ESMBDDataContext db = new Model.ESMBDDataContext(); var procesos = from p in db.Causas_Efectos where p.Proyecto_id == Proyecto_id select p; string html = "<table border='1' cellspacing='0' style='border: 1px solid #000; width: 900px; font-size: 0.8em;'>"; html += "<tr><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000; width: 500px;'></td><td style='border: 1px solid #000; width: 50px;'>INDICADOR</td><td style='border: 1px solid #000; width: 50px;'>MEDIOS DE VERIFICACIÓN</td><td style='width: 50px; border: 1px solid #000;'>SUPUESTOS</td><td style=' width: 50px; border: 1px solid #000;'>META</td><td style='border: 1px solid #000; width: 50px;'>FECHA</td><td style='border: 1px solid #000; width: 50px;'>UNIDAD</td><td style='border: 1px solid #000; width: 50px;'>VERBO</td><td style='border: 1px solid #000;'>SSP</td></tr>"; int color = 0; string color_cadena = "D6D6D6"; foreach (var procesos_item in procesos) { if (color == 0) { color_cadena = "E0E0E0"; color++; } else { color_cadena = "ffffff"; color = 0; } html += "<tr style='background: #" + color_cadena + "'><td style='border: 1px solid #000;'><b>PROCESO:</b></td><td style='width: 500px; border: 1px solid #000;'>" + procesos_item.Causa + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td></tr>"; var subprocesos = from sp in db.Subprocesos where sp.Causas_Efecto.Proyecto_id == proyecto_id && sp.Proceso_id == procesos_item.Id select sp; foreach (var subprocesos_item in subprocesos) { var actividades = from a in db.Actividades where a.Subproceso.Causas_Efecto.Proyecto_id == proyecto_id && a.Subproceso_id == subprocesos_item.Id select a; html += "<tr style='background: #" + color_cadena + "'><td style='border: 1px solid #000;'><b>SUBPROCESO:</b></td><td style='width: 500px; border: 1px solid #000;'>" + subprocesos_item.Subproceso1 + "</td><td style='border: 1px solid #000;'>" + subprocesos_item.Indicador + "</td><td style='border: 1px solid #000;'>" + subprocesos_item.Medios + "</td><td style='border: 1px solid #000;'>" + subprocesos_item.Supuestos + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td></tr>"; foreach (var actividades_item in actividades) { html += "<tr style='background: #" + color_cadena + "'><td style='vertical-align: middle; text-align: center; border: 1px solid #000;' ><b>ACTIVIDAD:</b></td><td style='width: 500px; border: 1px solid #000;'>" + actividades_item.Actividad + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'></td></tr>"; var indicadores = from i in db.Indicadores where i.Actividade.Subproceso.Causas_Efecto.Proyecto_id == proyecto_id && i.Actividad_id == actividades_item.Id select i; int count_indicadores = 0; foreach (var indicadores_item in indicadores) { string ssp = ""; if ((bool)indicadores_item.SSP) ssp = "Si"; else if (!(bool)indicadores_item.SSP) ssp = "No"; if (count_indicadores == 0) { if (indicadores.Count() <= 1) html += "<tr style='background: #" + color_cadena + "'><td style='vertical-align: middle; text-align: center; border: 1px solid #000;' rowspan='" + indicadores.Count() + "'><b>INDICADOR:</b></td><td style='width: 500px; border: 1px solid #000;'>" + indicadores_item.Indicador + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'>" + indicadores_item.medios + "</td><td style='border: 1px solid #000;'>" + indicadores_item.supuestos + "</td><td style='border: 1px solid #000;'>" + indicadores_item.meta + "</td><td style='border: 1px solid #000;'>" + Convert.ToDateTime(indicadores_item.fecha_indicador_inicial).ToShortDateString() + "</td><td style='border: 1px solid #000;'>" + indicadores_item.Unidade.Unidad + "</td><td style='border: 1px solid #000;'>" + indicadores_item.Verbo.Verbo1 + "</td><td style='border: 1px solid #000;'>" + ssp + "</td></tr>"; else html += "<tr style='background: #" + color_cadena + "'><td style='vertical-align: middle; text-align: center; border: 1px solid #000;' rowspan='" + indicadores.Count() + "'><b>INDICADOR:</b></td><td style='width: 500px; border: 1px solid #000;'>" + indicadores_item.Indicador + "</td><td style='border: 1px solid #000;'></td><td style='border: 1px solid #000;'>" + indicadores_item.medios + "</td><td style='border: 1px solid #000;'>" + indicadores_item.supuestos + "</td><td style='border: 1px solid #000;'>" + indicadores_item.meta + "</td><td style='border: 1px solid #000;'>" + Convert.ToDateTime(indicadores_item.fecha_indicador_inicial).ToShortDateString() + "</td><td style='border: 1px solid #000;'>" + indicadores_item.Unidade.Unidad + "</td><td style='border: 1px solid #000;'>" + indicadores_item.Verbo.Verbo1 + "</td><td style='border: 1px solid #000;'>" + ssp + "</td></tr>"; } else html += "<tr style='background: #" + color_cadena + "'><td style='border: 1px solid #000;'>" + indicadores_item.Indicador + "</td><td style='width: 500px; border: 1px solid #000;'></td><td style='border: 1px solid #000;'>" + indicadores_item.medios + "</td><td style='border: 1px solid #000;'>" + indicadores_item.supuestos + "</td><td style='border: 1px solid #000;'>" + indicadores_item.meta + "</td><td style='border: 1px solid #000;'>" + Convert.ToDateTime(indicadores_item.fecha_indicador_inicial).ToShortDateString() + "</td><td style='border: 1px solid #000;'>" + indicadores_item.Unidade.Unidad + "</td><td style='border: 1px solid #000;'>" + indicadores_item.Verbo.Verbo1 + "</td><td style='border: 1px solid #000;'>" + ssp + "</td></tr>"; count_indicadores++; } } } } html = html + "</table>"; return html; }
protected void CargarIndicadores() { ESMBDDataContext db = new Model.ESMBDDataContext(); int actividad_id = Request.QueryString["actividad_id"] == null || Request.QueryString["actividad_id"] == "" ? 0 : Convert.ToInt32(Request.QueryString["actividad_id"]); var indicadores_col = from ind in db.Indicadores where ind.Actividade.Id == actividad_id select ind; string json_to_return = "{\"page\":\"1\",\"total\":1,\"records\":\"1\",\"rows\": ["; foreach (var item in indicadores_col) { string ssp_val = item.SSP.ToString() == "True" ? "Si" : "No"; json_to_return = json_to_return + "{\"id\":\"" + item.Id.ToString() + "\",\"cell\":[\"" + item.Id + "\",\"" + item.Actividade.Actividad + "\", \"" + item.Verbo.Verbo1 + "\", \"" + item.meta + "\",\"" + item.Unidade.Unidad + "\",\"" + item.descripcion + "\",\"" + ssp_val + "\",\"" + Convert.ToDateTime(item.fecha_indicador_inicial).ToShortDateString() + "\",\"" + Convert.ToDateTime(item.fecha_indicador_final).ToShortDateString() + "\",\"" + item.Indicador + "\",\"" + item.medios + "\",\"" + item.supuestos + "\"]} ,"; } json_to_return = json_to_return.Trim(','); json_to_return = json_to_return + "]}"; Response.Write(json_to_return); }