protected void btnLanzador_Click(object sender, EventArgs e) { int pT = 0; // primary total int pV = 0; // primary value int pP = 0; // primary percent int sT = 0; // secondary total int sV = 0; // secondary value int sP = 0; // secondary percent // this happens for every company RadProgressContext context = RadProgressContext.Current; sT = ctx.Empresas.Count(); context.SecondaryTotal = pT; context.CurrentOperationText = "Generando los informes y documentos..."; string repodir = ConfigurationManager.AppSettings["Repositorio"]; IList <NombreInforme> nombres = CntInforme.GetNombresDeInforme(); pT = nombres.Count; foreach (Empresa empresa in ctx.Empresas) { sV++; sP = (int)(decimal)((sV / sT) * 100.0); context.SecondaryValue = sV; context.SecondaryPercent = sP; // por cada instalacion hay que sacar el informe foreach (Instalacion instalacion in empresa.Instalaciones) { pV = 0; foreach (NombreInforme ninf in nombres) { pV++; pP = (int)(decimal)((pV / pT) * 100.0); context.PrimaryValue = pV; context.PrimaryPercent = pP; CntInforme.ElaborarInformesProgramados((DateTime)rdtFecha.SelectedDate, ninf.Informe, instalacion, repodir, ctx); } } } //Documentos de las Revisiones y Dispositivos por filtro foreach (Filtro filtro in usuario.Filtros) { if (filtro.Tipo == "Revision" || filtro.Tipo == "Dispositivo") { AplicarFiltro(filtro, filtro.Tipo); CrearInforme(filtro, repodir); } } }