public ActionResult HorarioEstudiante(string strCursoParalelo = "") { HorarioEstudiante he = new Models.HorarioEstudiante(); if (!string.IsNullOrEmpty(strCursoParalelo)) { he = new Models.HorarioEstudiante(strCursoParalelo); } return(View("HorarioEstudiante", he)); }
public JsonResult createFileHorarioExamenes(string idTypeFile) { HorarioEstudiante he = new Models.HorarioEstudiante(); try { string reportPath = Path.Combine(Server.MapPath("~/Reports"), "rptHorarioExamenEstudiantes.rdlc"); LocalReport rptHorarios = he.getReporteHorariosExamenes(reportPath); string reportType = idTypeFile; string mimeType; string encoding; string fileNameExtension; string deviceInfo = " <DeviceInfo>" + " <OutputFormat>" + idTypeFile + "</OutputFormat>" + " </DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = rptHorarios.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); // Creo el nombre del archivo string nameFile = Language.es_ES.EST_TB_HORARIO_EXAMENES + "_" + he.UsuarioActual.Cedula.ToString() + ((idTypeFile == "PDF") ? ".pdf" : ".xls"); // Direcciono la creacion del archivo a una ubicacion temporal string fullPath = Path.Combine(Server.MapPath("~/Temp"), nameFile); // Creo el archivo en la ubicacion temporal System.IO.File.WriteAllBytes(fullPath, renderedBytes); return(Json(new { fileName = nameFile, errorMessage = "" })); } catch (Exception ex) { Errores err = new Errores(); err.SetError(ex, "createFileHorarioExamenes - " + he.UsuarioActual.Cedula.ToString() + " - " + he.UsuarioActual.CarreraActual.Codigo.ToString()); return(Json(new { fileName = "none", errorMessage = "Problema al momento de crear el archivo" })); } }