public IActionResult Registro() { List <TipoExamen> tiposExamenes = new List <TipoExamen>(); var query = "SELECT * FROM TipoExamen;"; var connectionString = "Data Source=LAPTOP-R88EAA98\\SQLEXPRESS;Initial Catalog=Laboratorio;User ID=sa;Password=fnsp;Pooling=False"; using (var connection = new SqlConnection(connectionString)) { var command = new SqlCommand(query, connection); connection.Open(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { TipoExamen nuevoTipoExamen = new TipoExamen(); nuevoTipoExamen.Id = (int)reader[0]; nuevoTipoExamen.Nombre = reader[1].ToString(); nuevoTipoExamen.Costo = (int)reader[2]; tiposExamenes.Add(nuevoTipoExamen); } } ViewBag.tiposExamenes = tiposExamenes; } return(View()); }
public ActionResult DeleteConfirmed(int id) { TipoExamen tipoExamen = db.TipoExamen.Find(id); db.TipoExamen.Remove(tipoExamen); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IdTipoExamen,Descripcion")] TipoExamen tipoExamen) { if (ModelState.IsValid) { db.Entry(tipoExamen).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tipoExamen)); }
public ActionResult Create([Bind(Include = "IdTipoExamen,Descripcion")] TipoExamen tipoExamen) { if (ModelState.IsValid) { db.TipoExamen.Add(tipoExamen); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tipoExamen)); }
// GET: TipoExamen/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TipoExamen tipoExamen = db.TipoExamen.Find(id); if (tipoExamen == null) { return(HttpNotFound()); } return(View(tipoExamen)); }
public static TipoExamen guardarTipoExamen(TipoExamen tipoExamen) { try { using (SqlCommand sentencia = new SqlCommand()) { sentencia.Connection = PrincipalUI.Cnxion; sentencia.CommandType = System.Data.CommandType.StoredProcedure; sentencia.CommandText = Sentencias.TIPO_EXAMEN_CREAR; sentencia.Parameters.Add(new SqlParameter("@pIdTipoExamen", SqlDbType.Int)).Value = tipoExamen.idTipoExamen; sentencia.Parameters.Add(new SqlParameter("@pDescripcion", SqlDbType.NVarChar)).Value = tipoExamen.descripcion; sentencia.Parameters.Add(new SqlParameter("@pAgrupable", SqlDbType.Bit)).Value = tipoExamen.ckAgrupable; sentencia.Parameters.Add(new SqlParameter("@pTipo", SqlDbType.Int)).Value = tipoExamen.tipo; tipoExamen.idTipoExamen = (int)sentencia.ExecuteScalar(); } } catch (Exception ex) { throw ex; } return(tipoExamen); }
/* * Genera datos automáticamente dentro de la base de * datos (UsuariosUABC) en caso de encontrarse vacía */ public async Task GeneraDatosSemilla() { // Checa si las tablas de la base de dato se encuentran vacía if (!_context.Roles.Any()) { var rolAmin = new Rol() { Nombre = "Administrador" }; var rolUsuario = new Rol() { Nombre = "Docente" }; _context.Roles.Add(rolAmin); _context.Roles.Add(rolUsuario); await _context.SaveChangesAsync(); } if (!_context.Carreras.Any()) { var Civil = new Carrera() { Nombre = "Ingeniería Civil" }; var Electronica = new Carrera() { Nombre = "Ingeniería Electrónica" }; var Computacion = new Carrera() { Nombre = "Ingeniería en Computación" }; var Industrial = new Carrera() { Nombre = "Ingeniería Industrial" }; var Bioingenieria = new Carrera() { Nombre = "Bioingeniería" }; var Nanotecnologia = new Carrera() { Nombre = "Nanotecnología" }; var Arquitectura = new Carrera() { Nombre = "Arquitectura" }; _context.Carreras.Add(Civil); _context.Carreras.Add(Electronica); _context.Carreras.Add(Computacion); _context.Carreras.Add(Industrial); _context.Carreras.Add(Bioingenieria); _context.Carreras.Add(Nanotecnologia); _context.Carreras.Add(Arquitectura); await _context.SaveChangesAsync(); } if (!_context.Materias.Any()) { var EstucIso = new Materia() { Id = 11934, Nombre = "Estructuras Isostáticas", Carrera = "Ingeniería Civil" }; var Dinamica = new Materia() { Id = 11347, Nombre = "Dinámica", Carrera = "Ingeniería Civil" }; var CircElec = new Materia() { Id = 11675, Nombre = "Circuitos Electrónicos", Carrera = "Ingeniería Electrónica" }; var Mecanismos = new Materia() { Id = 11896, Nombre = "Mecanismos", Carrera = "Ingeniería Electrónica" }; var IngSoft = new Materia() { Id = 12119, Nombre = "Ingeniería de Software", Carrera = "Ingeniería en Computación" }; var AdmRedes = new Materia() { Id = 12117, Nombre = "Admon. y Seguridad en Redes", Carrera = "Ingeniería en Computación" }; var ApWeb = new Materia() { Id = 12146, Nombre = "Desarrollo de Aplicaciones Web", Carrera = "Ingeniería en Computación" }; var TermoCienc = new Materia() { Id = 4357, Nombre = "Termociencia", Carrera = "Ingeniería Industrial" }; var MetodNum = new Materia() { Id = 5311, Nombre = "Métodos Numéricos", Carrera = "Ingeniería Industrial" }; var CircLineal = new Materia() { Id = 11789, Nombre = "Circuitos Lineales", Carrera = "Bioingeniería" }; var QuimOrg = new Materia() { Id = 11788, Nombre = "Química Orgánica", Carrera = "Bioingeniería" }; var TermDin = new Materia() { Id = 13177, Nombre = "Termodinámica", Carrera = "Nanotecnología" }; var BioGen = new Materia() { Id = 13179, Nombre = "Biología General", Carrera = "Nanotecnología" }; var MatSis = new Materia() { Id = 9761, Nombre = "Materiales y Sistemas Constructivos", Carrera = "Arquitectura" }; var Estructuras = new Materia() { Id = 9757, Nombre = "Estructuras", Carrera = "Arquitectura" }; _context.Materias.Add(EstucIso); _context.Materias.Add(Dinamica); _context.Materias.Add(CircElec); _context.Materias.Add(Mecanismos); _context.Materias.Add(IngSoft); _context.Materias.Add(AdmRedes); _context.Materias.Add(ApWeb); _context.Materias.Add(TermoCienc); _context.Materias.Add(MetodNum); _context.Materias.Add(CircLineal); _context.Materias.Add(QuimOrg); _context.Materias.Add(TermDin); _context.Materias.Add(BioGen); _context.Materias.Add(MatSis); _context.Materias.Add(Estructuras); await _context.SaveChangesAsync(); } if (!_context.SubtiposExamen.Any()) { var Complementaria = new SubtipoExamen() { Nombre = "Complementaria" }; var Equivalencia = new SubtipoExamen() { Nombre = "Equivalencia" }; var Correccion = new SubtipoExamen() { Nombre = "Corrección" }; _context.SubtiposExamen.Add(Complementaria); _context.SubtiposExamen.Add(Equivalencia); _context.SubtiposExamen.Add(Correccion); await _context.SaveChangesAsync(); } if (!_context.TiposExamen.Any()) { var Ordinario = new TipoExamen() { Nombre = "Ordinario" }; var Extraordinario = new TipoExamen() { Nombre = "Extraordinario" }; var Regularizacion = new TipoExamen() { Nombre = "Regularizacion" }; var OrdinarioInter = new TipoExamen() { Nombre = "Ordinario Intersemestral" }; var ExtraInter = new TipoExamen() { Nombre = "Extraordinario intersemestral" }; var RegInter = new TipoExamen() { Nombre = "Regularización Intersemestral" }; var EvalPerm = new TipoExamen() { Nombre = "Evaluación Permanente" }; _context.TiposExamen.Add(Ordinario); _context.TiposExamen.Add(Extraordinario); _context.TiposExamen.Add(Regularizacion); _context.TiposExamen.Add(OrdinarioInter); _context.TiposExamen.Add(ExtraInter); _context.TiposExamen.Add(RegInter); _context.TiposExamen.Add(EvalPerm); await _context.SaveChangesAsync(); } if (!_context.Estados.Any()) { var Pendiente = new Estado() { FechaModificacion = DateTime.Now, Nombre = "Pendiente" }; var Aceptado = new Estado() { FechaModificacion = DateTime.Now, Nombre = "Aceptado" }; var Rechazado = new Estado() { FechaModificacion = DateTime.Now, Nombre = "Rechazado" }; _context.Estados.Add(Pendiente); _context.Estados.Add(Aceptado); _context.Estados.Add(Rechazado); await _context.SaveChangesAsync(); } if (!_context.Usuarios.Any()) { var usuarioA = new Usuario() { Id = 338323, Nombre = "José Ramón", ApellidoP = "López", ApellidoM = "Madueño", Correo = "*****@*****.**", RolId = 1 }; var usuarioB = new Usuario() { Id = 335127, Nombre = "César Samuel", ApellidoP = "Parra", ApellidoM = "Salas", Correo = "*****@*****.**", RolId = 1 }; var usuarioC = new Usuario() { Id = 331364, Nombre = "Celso", ApellidoP = "Figueroa", ApellidoM = "Jacinto", Correo = "*****@*****.**", RolId = 1 }; _context.Usuarios.Add(usuarioA); _context.Usuarios.Add(usuarioB); _context.Usuarios.Add(usuarioC); await _context.SaveChangesAsync(); } }
public JsonResult listarTipoExamen(int idComprobante) { log.Info("Function: [listarTipoExamen(" + idComprobante + ")]"); return(Json(TipoExamen.listarTipoExamen(idComprobante), JsonRequestBehavior.AllowGet)); }
static void Main(string[] args) { Console.WriteLine("*****Menu*****"); Console.WriteLine("Usuarios"); Console.WriteLine("1.- Alta usuario"); //login Console.WriteLine("2.- Baja usuario"); //administraci[on(superusuario) Console.WriteLine("3.- Login (Solo estatus de si o no)"); Console.WriteLine("4.- Perfil (login -> mostrar datos del usuario)"); Console.WriteLine("Roles"); Console.WriteLine("5.- Alta rol"); //administraci[on superusuario Console.WriteLine("6.- Baja usuario"); //administraci[on superusuario Console.WriteLine("7.- Mostrar roles"); //administracion, alta usuario Console.WriteLine("8.- Mostrar rol de un usuario (numerico)"); //Definir que pantallas se van a mostrar, si es gratuito o no Console.WriteLine("Pantallas"); Console.WriteLine("9.- Alta pantalla"); //administraci[on superusuario Console.WriteLine("10.- Baja pantalla"); //administraci[on superusuario Console.WriteLine("11.- Mostrar pantallas por rol (arreglo numerico)"); //Definir que pantallas se van a mostrar Console.WriteLine("Preguntas"); Console.WriteLine("12.- Alta pregunta"); Console.WriteLine("13.- Baja pregunta"); Console.WriteLine("14.- Pregunta aleatoria(solo mostrar)"); //no la va a poder contestar Console.WriteLine("15.- Contestar pregunta sin dato (Mostrar -> validar respuesta -> Guardar respuesta usuario)"); //para todos los tipos de examen//se va a validar el tipo de pregunta y con esto es la forma en que se muestra Console.WriteLine("16.- Contestar pregunta con dato (Mostrar -> validar respuesta -> Guardar respuesta usuario -> mostrar ayuda)"); //para todos los tipos de examen Console.WriteLine("17.- Alta tipo pregunta"); Console.WriteLine("18.- Baja tipo pregunta"); Console.WriteLine("19.- Alta tema pregunta"); Console.WriteLine("20.- Baja tema pregunta"); Console.WriteLine("21.- ver temas pregunta"); // en configuraci[on de examen poder seleccionar unicamente de que tema se quieren preguntas Console.WriteLine("22.- Mostrar tabla respuestas usuarios"); // solo como muestra de que funciona Console.WriteLine("Examenes"); Console.WriteLine("23.- Insertar tipo examen"); Console.WriteLine("24.- Baja tipo examen"); Console.WriteLine("25.- Insertar examen"); Console.WriteLine("26.- Baja examen"); Console.WriteLine("27.- Insertar certificador"); Console.WriteLine("28.- eliminar certificador"); Console.WriteLine("29.- Mostrar tipos examenes");//para configuraci[on de examen poder filtrar mejor los examenes Console.WriteLine("30.- Mostrar todos los examenes"); Console.WriteLine("31.- Mostrar examenes por tipo de examen"); Console.WriteLine("30.- Mostrar todos los certificadores"); Console.WriteLine("31.- Mostrar examenes por certificador"); Console.WriteLine("32.- Mostrar todas Las preguntas de un examen"); Console.WriteLine("33.- Mostrar una pregunta de un examen"); int opc = Convert.ToInt32(Console.ReadLine()); switch (opc) { case 1: Console.WriteLine("Ingresa el Nombre"); string Nombre = Console.ReadLine(); Console.WriteLine("Ingresa el Apellido Parteno"); string Apellido_Parterno = Console.ReadLine(); Console.WriteLine("Ingresa el Apellido Materno"); string Apellido_Materno = Console.ReadLine(); Console.WriteLine("Ingresa el Fecha Nacimiento"); DateTime Fecha_Nacimiento = Convert.ToDateTime(Console.ReadLine()); Console.WriteLine("Ingresa la contraseña"); string Password_Hash = Console.ReadLine(); Console.WriteLine("Ingresa el Correo"); string Correo = Console.ReadLine(); Console.WriteLine("Ingresa 1 = Hombre 0 = Mujer"); int Genero = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa el Rol en numero"); int ID_Rol = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa el Estatus en numero"); int ID_Estatus = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa el Hash de la foto"); string Hash_Foto = Console.ReadLine(); Console.WriteLine(API0.User.InsertUser(Nombre, Apellido_Parterno, Apellido_Materno, Fecha_Nacimiento, Password_Hash, Correo, Genero, ID_Rol, ID_Estatus, Hash_Foto)); break; case 2: Console.WriteLine("Ingresa el ID a eliminar"); int ID = Convert.ToInt32(Console.ReadLine()); User.DeleteUser(ID); Console.WriteLine("Usuario eliminado"); break; case 3: Console.WriteLine("Ingresa el correo del usuario"); string correo = Console.ReadLine(); Console.WriteLine("Ingresa el pass del usuario"); string pass = Utilities.encrypt(Console.ReadLine()); Console.WriteLine("Hola usuario "); User.login(correo, pass); break; case 4: Console.WriteLine("Ingresa el ID del usuario"); int IDUsuario = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Hola usuario "); User.SelectAlUsers(IDUsuario); break; case 5: Console.WriteLine("Ingresa el Id del rol"); int IDRol = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa la descripcion del rol"); string desc = Console.ReadLine(); Console.WriteLine(Roles.InsertRol(IDRol, desc)); break; case 6: Console.WriteLine("Ingresa el Id del rol que deseas eliminar"); int IDRolE = Convert.ToInt32(Console.ReadLine()); Roles.DeleteRol(IDRolE); Console.WriteLine("Rol eliminado"); break; case 7: Console.WriteLine("Estos son los roles"); Roles.SelectAllRoles(); break; case 8: Console.WriteLine("Ingresa el ID del Usuario"); IDUsuario = Convert.ToInt32(Console.ReadLine()); Roles.RolUsuario(IDUsuario); break; case 9: Console.WriteLine("Ingresa el ID de la pantalla"); int IDPantalla = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa la descripcion de la pantalla"); string descPantalla = Console.ReadLine(); Console.WriteLine(Pantalla.InsertPantalla(IDPantalla, descPantalla)); break; case 10: Console.WriteLine("Ingresa el ID de la pantalla"); IDPantalla = Convert.ToInt32(Console.ReadLine()); Pantalla.DeletePantalla(IDPantalla); Console.WriteLine("Pantalla eliminada"); break; case 11: Console.WriteLine("Ingresa el rol"); foreach (int pantalla in Pantalla.PantallasPorRol(Convert.ToInt32(Console.ReadLine()))) { Console.WriteLine(pantalla + ""); } break; case 12: Console.WriteLine("Ingresa el n[umero de opciones"); String[] opciones = new string[Convert.ToInt32(Console.ReadLine())]; Console.WriteLine("pregunta: "); String pregunta = Console.ReadLine(); for (int i = 0; i < opciones.Length; i++) { Console.WriteLine("Opcion " + (i + 1)); opciones[i] = Console.ReadLine(); } Console.WriteLine("Opcion correcta(numero): "); int rcorrecta = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Tipo pregunta(numero): "); int tpregunta = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ayuda: "); String ayuda = Console.ReadLine(); Console.WriteLine("tema(numero): "); int tema = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(Pregunta.altaPregunta(pregunta, opciones, rcorrecta, tpregunta, ayuda, tema)); break; case 13: Console.WriteLine("Ingresa el id de la pregunta a eliminar"); Console.WriteLine(Pregunta.baja(Convert.ToInt32(Console.ReadLine()))); break; case 14: break; case 15: break; case 16: break; case 17: Console.WriteLine("Ingresa el ID del tipo de pregunta"); int IDTIpoPregunta = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa la descripcion de la pantalla"); string descTipoPregunta = Console.ReadLine(); Console.WriteLine(TipoPregunta.InsertTipoPregunta(IDTIpoPregunta, descTipoPregunta)); break; case 18: Console.WriteLine("Ingresa el ID del Tipo de Pregunta"); int IDTipoPregunta = Convert.ToInt32(Console.ReadLine()); Pantalla.DeletePantalla(IDTipoPregunta); Console.WriteLine("Tipo Pregunta eliminada"); break; case 19: Console.WriteLine("Ingresa el tema"); Console.WriteLine("El id del tema es: " + Tema.alta_tema(Console.ReadLine())); break; case 20: Console.WriteLine("Ingresa el id del tema a borrar"); switch (Tema.baja_tema(Convert.ToInt32(Console.ReadLine()))) { case 1: Console.WriteLine("Se borró exitosamente el tema"); break; case 0: Console.WriteLine("Error al el tema"); break; } break; case 21: foreach (Tema t in Tema.obtener_Temas()) { Console.WriteLine("id: " + t.id + "\tDescripcion: " + t.descripcion + "\n"); } break; case 22: break; case 23: Console.WriteLine("Ingresa la descripcion del tipo de examen"); string descTipoExamen = Console.ReadLine(); Console.WriteLine(TipoExamen.InsertTipoExamen(descTipoExamen)); break; case 24: Console.WriteLine("Ingresa el ID del Tipo de Examen"); int IDTipoExamen = Convert.ToInt32(Console.ReadLine()); Pantalla.DeletePantalla(IDTipoExamen); Console.WriteLine("Tipo Examen eliminado"); break; case 25: Console.WriteLine("Ingresa la descripcion del Examen"); string descExamen = Console.ReadLine(); Console.WriteLine("Ingresa el nombre del Examen"); string nombreExamen = Console.ReadLine(); Console.WriteLine("Ingresa el ID_Certificador del Examen"); int IDCertificador = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa el Tiempo del Examen"); int tiempo = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa el ID_Tipo_Examen del Examen"); int ID_Tipo_Examen = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Ingresa el Url_Oficial del Examen"); string UrlExamen = Console.ReadLine(); Console.WriteLine(Examen.InsertExamen(descExamen, nombreExamen, IDCertificador, tiempo, ID_Tipo_Examen, UrlExamen)); break; case 26: Console.WriteLine("Ingresa el id del Examen a borrar"); switch (Examen.baja_examen(Convert.ToInt32(Console.ReadLine()))) { case 1: Console.WriteLine("Se borró exitosamente el examen"); break; case 0: Console.WriteLine("Error al el tema"); break; } break; break; case 27: Console.WriteLine("Ingresa la Descrición del Certificador"); string DescCertificador = Console.ReadLine(); Console.WriteLine("Ingresa la URl del Certificador"); string Url = Console.ReadLine(); Console.WriteLine(Certificadores.InsertCertificadores(DescCertificador, Url)); break; case 28: Console.WriteLine("Ingresa el ID del Certificador"); int IDCertificadorE = Convert.ToInt32(Console.ReadLine()); Certificadores.DeleteCertificadores(IDCertificadorE); Console.WriteLine("Certificador eliminado"); break; case 29: break; case 30: break; case 31: break; case 32: break; case 33: break; } //Console.WriteLine("Estad[isticas (Pendiente, se trabajar[a cuando se haga el BI)"); //string con = ConfigurationManager.ConnectionStrings["Preparate"].ToString(); //Parameter[] p = new Parameter[] { new Parameter("@name","Alexis")}; //String res = Utilities.FirstDataFromTable(con, "hola", p); //Console.WriteLine(res); Console.ReadLine(); }
public FileStreamResult GenerarPDF(int id) { SolicitudAdmin admin = _servicioSolicitud.ObtenerSolicitudAministrativa(id); SolicitudDocente docente = _servicioSolicitud.ObtenerSolicitudDocente(id); IEnumerable <SolicitudAlumno> alumnos = _servicioSolicitud.ObtenerSolicitudesAlumno(docente.Id); Usuario solicitante = _servicioUsuario.ObtenerUsuario(docente.IdEmpleado); Materia materia = _servicioUsuario.ObtenerMateria(docente.IdMateria); Carrera carrera = _servicioUsuario.ObtenerCarrera(docente.IdCarrera); TipoExamen tipoExamen = _servicioUsuario.ObtenerTipoExamen(docente.IdTipoExamen); SubtipoExamen subTipoExamen = _servicioUsuario.ObtenerSubtipoExamen(admin.IdSubtipoExamen); int grupoSolicitud = alumnos.FirstOrDefault().Alumno.Grupo; MemoryStream workStream = new MemoryStream(); Document document = new Document(PageSize.Letter); document.SetMargins(50, 50, 50, 50); PdfWriter.GetInstance(document, workStream).CloseStream = false; document.Open(); document.AddTitle("Solicitud CAEF"); Font TitleFont = new Font(Font.HELVETICA, 12, Font.BOLD, BaseColor.Black); Paragraph Title = new Paragraph("UNIVERSIDAD AUTÓNOMA DE BAJA CALIFORNIA", TitleFont); Title.Alignment = Element.ALIGN_CENTER; document.Add(Chunk.Newline); document.Add(Title); document.Add(Chunk.Newline); Font SubtitleFont = new Font(Font.HELVETICA, 12, Font.BOLD, BaseColor.Gray); Paragraph Subtitle = new Paragraph("COORDINACIÓN DE SERVICIOS ESTUDIANTILES Y GESTIÓN ESCOLAR", SubtitleFont); Paragraph Subtitle2 = new Paragraph("ACTA DE EVALUACION FINAL", SubtitleFont); Subtitle.Alignment = Element.ALIGN_CENTER; Subtitle2.Alignment = Element.ALIGN_CENTER; document.Add(Subtitle); document.Add(Subtitle2); document.Add(Chunk.Newline); Font TextoIzquierdaFont = new Font(Font.TIMES_ROMAN, 10, Font.BOLD, BaseColor.Black); Paragraph subDir = new Paragraph("SUBDIRECCIÓN", TextoIzquierdaFont); subDir.Alignment = Element.ALIGN_RIGHT; document.Add(subDir); DateTime fecha = DateTime.Now; Font TextoIzquierdaNo = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL, BaseColor.Black); int periodo = 1; if (fecha.Month > 6) { periodo = 2; } Paragraph No = new Paragraph("No.10/" + (fecha.Year - 2000) + "-" + periodo, TextoIzquierdaNo); No.Alignment = Element.ALIGN_RIGHT; document.Add(No); Paragraph Asunto = new Paragraph("Asunto: Control de Actas", TextoIzquierdaNo); Asunto.Alignment = Element.ALIGN_RIGHT; document.Add(Asunto); var mes = DateTime.Now.ToString("MMMM", new CultureInfo("es-ES")); Paragraph Fecha = new Paragraph("Ensenada, B.C, a " + fecha.Day + " de " + mes + " del " + fecha.Year, TextoIzquierdaFont); Fecha.Alignment = Element.ALIGN_RIGHT; document.Add(Fecha); document.Add(Chunk.Newline); Font examenFont = new Font(Font.TIMES_ROMAN, 10, Font.UNDERLINE, BaseColor.Black); Chunk examenUnderline = new Chunk(tipoExamen.Nombre + " (" + subTipoExamen.Nombre + ")", examenFont); Paragraph examenInfo = new Paragraph("EXAMEN: " + examenUnderline); examenInfo.Alignment = Element.ALIGN_CENTER; document.Add(examenInfo); document.Add(Chunk.Newline); PdfPTable table = new PdfPTable(11); table.TotalWidth = 500f; table.LockedWidth = true; Font TablaFont = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL, BaseColor.Black); PdfPCell claveUnidadT = new PdfPCell(new Phrase("CLAVE DE UNIDAD", TablaFont)); claveUnidadT.Colspan = 1; claveUnidadT.HorizontalAlignment = 1; claveUnidadT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell unidadAcademicaT = new PdfPCell(new Phrase("UNIDAD ACADEMICA", TablaFont)); unidadAcademicaT.Colspan = 4; unidadAcademicaT.HorizontalAlignment = 1; unidadAcademicaT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell claveCarreraT = new PdfPCell(new Phrase("CLAVE CARRERA", TablaFont)); claveCarreraT.Colspan = 1; claveCarreraT.HorizontalAlignment = 1; claveCarreraT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell celdaCarreraT = new PdfPCell(new Phrase("CARRERA", TablaFont)); celdaCarreraT.Colspan = 3; celdaCarreraT.HorizontalAlignment = 1; celdaCarreraT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell planEstudiosT = new PdfPCell(new Phrase("PLAN DE ESTUDIOS", TablaFont)); planEstudiosT.Colspan = 2; planEstudiosT.HorizontalAlignment = 1; planEstudiosT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell claveUnidad = new PdfPCell(new Phrase(admin.ClaveUnidad)); claveUnidad.Colspan = 1; claveUnidad.HorizontalAlignment = 1; PdfPCell unidadAcademica = new PdfPCell(new Phrase(admin.UnidadAcademica)); unidadAcademica.Colspan = 4; unidadAcademica.HorizontalAlignment = 1; PdfPCell claveCarrera = new PdfPCell(new Phrase(carrera.Id + "")); claveCarrera.Colspan = 1; claveCarrera.HorizontalAlignment = 1; PdfPCell celdaCarrera = new PdfPCell(new Phrase(carrera.Nombre)); celdaCarrera.Colspan = 3; celdaCarrera.HorizontalAlignment = 1; PdfPCell planEstudios = new PdfPCell(new Phrase(admin.PlanEstudios)); planEstudios.Colspan = 2; planEstudios.HorizontalAlignment = 1; PdfPCell claveMateriaT = new PdfPCell(new Phrase("CLAVE DE MATERIA", TablaFont)); claveMateriaT.Colspan = 1; claveMateriaT.HorizontalAlignment = 1; claveMateriaT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell MateriaT = new PdfPCell(new Phrase("MATERIA", TablaFont)); MateriaT.Colspan = 5; MateriaT.HorizontalAlignment = 1; MateriaT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell SemestreT = new PdfPCell(new Phrase("SEMESTRE", TablaFont)); SemestreT.Colspan = 1; SemestreT.HorizontalAlignment = 1; SemestreT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell GrupoT = new PdfPCell(new Phrase("GRUPO", TablaFont)); GrupoT.Colspan = 1; GrupoT.HorizontalAlignment = 1; GrupoT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell CicloT = new PdfPCell(new Phrase("CICLO ESCOLAR", TablaFont)); CicloT.Colspan = 1; CicloT.HorizontalAlignment = 1; CicloT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell PeriodoT = new PdfPCell(new Phrase("PERIODO", TablaFont)); PeriodoT.Colspan = 2; PeriodoT.HorizontalAlignment = 1; PeriodoT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell claveMateria = new PdfPCell(new Phrase(materia.Id + "")); claveMateria.Colspan = 1; claveMateria.HorizontalAlignment = 1; PdfPCell Materia = new PdfPCell(new Phrase(materia.Nombre)); Materia.Colspan = 5; Materia.HorizontalAlignment = 1; PdfPCell Semestre = new PdfPCell(new Phrase(admin.EtapaSemestre)); Semestre.Colspan = 1; Semestre.HorizontalAlignment = 1; PdfPCell Grupo = new PdfPCell(new Phrase(grupoSolicitud + "")); Grupo.Colspan = 1; Grupo.HorizontalAlignment = 1; PdfPCell Ciclo = new PdfPCell(new Phrase(admin.CicloEscolar)); Ciclo.Colspan = 1; Ciclo.HorizontalAlignment = 1; PdfPCell Periodo = new PdfPCell(new Phrase(docente.Periodo)); Periodo.Colspan = 2; Periodo.HorizontalAlignment = 1; table.AddCell(claveUnidadT); table.AddCell(unidadAcademicaT); table.AddCell(claveCarreraT); table.AddCell(celdaCarreraT); table.AddCell(planEstudiosT); table.AddCell(claveUnidad); table.AddCell(unidadAcademica); table.AddCell(claveCarrera); table.AddCell(celdaCarrera); table.AddCell(planEstudios); table.AddCell(claveMateriaT); table.AddCell(MateriaT); table.AddCell(SemestreT); table.AddCell(GrupoT); table.AddCell(CicloT); table.AddCell(PeriodoT); table.AddCell(claveMateria); table.AddCell(Materia); table.AddCell(Semestre); table.AddCell(Grupo); table.AddCell(Ciclo); table.AddCell(Periodo); document.Add(table); document.Add(Chunk.Newline); PdfPTable tablaAlumnos = new PdfPTable(11); tablaAlumnos.TotalWidth = 500f; tablaAlumnos.LockedWidth = true; PdfPCell ContadorT = new PdfPCell(new Phrase("NO.", TablaFont)); ContadorT.Colspan = 1; ContadorT.HorizontalAlignment = 1; ContadorT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell NombreAlumnoT = new PdfPCell(new Phrase("NOMBRE DEL ALUMNO", TablaFont)); NombreAlumnoT.Colspan = 6; NombreAlumnoT.HorizontalAlignment = 1; NombreAlumnoT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell MatriculaT = new PdfPCell(new Phrase("MATRICULA", TablaFont)); MatriculaT.Colspan = 2; MatriculaT.HorizontalAlignment = 1; MatriculaT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell CalificacionT = new PdfPCell(new Phrase("CALIFICACION", TablaFont)); CalificacionT.Colspan = 2; CalificacionT.HorizontalAlignment = 1; CalificacionT.BackgroundColor = new BaseColor(193, 193, 193); tablaAlumnos.AddCell(ContadorT); tablaAlumnos.AddCell(NombreAlumnoT); tablaAlumnos.AddCell(MatriculaT); tablaAlumnos.AddCell(CalificacionT); int count = 1; foreach (SolicitudAlumno solicitud in alumnos) { PdfPCell Contador = new PdfPCell(new Phrase(count++ + "")); Contador.Colspan = 1; Contador.HorizontalAlignment = 1; PdfPCell NombreAlumno = new PdfPCell(new Phrase(solicitud.Alumno.Nombre + " " + solicitud.Alumno.ApellidoP + " " + solicitud.Alumno.ApellidoM)); NombreAlumno.Colspan = 6; NombreAlumno.HorizontalAlignment = 1; PdfPCell Matricula = new PdfPCell(new Phrase(solicitud.Alumno.Id + "")); Matricula.Colspan = 2; Matricula.HorizontalAlignment = 1; PdfPCell Calificacion = new PdfPCell(new Phrase(solicitud.Alumno.Promedio + "")); Calificacion.Colspan = 2; Calificacion.HorizontalAlignment = 1; tablaAlumnos.AddCell(Contador); tablaAlumnos.AddCell(NombreAlumno); tablaAlumnos.AddCell(Matricula); tablaAlumnos.AddCell(Calificacion); } document.Add(tablaAlumnos); document.Add(Chunk.Newline); PdfPTable tablaMotivo = new PdfPTable(1); tablaMotivo.TotalWidth = 500f; tablaMotivo.LockedWidth = true; PdfPCell MotivoT = new PdfPCell(new Phrase("MOTIVO", TablaFont)); MotivoT.Colspan = 1; MotivoT.HorizontalAlignment = 1; MotivoT.BackgroundColor = new BaseColor(193, 193, 193); PdfPCell Motivo = new PdfPCell(new Phrase(docente.Motivo)); Motivo.Colspan = 1; Motivo.HorizontalAlignment = 0; tablaMotivo.AddCell(MotivoT); tablaMotivo.AddCell(Motivo); document.Add(tablaMotivo); document.Close(); byte[] byteInfo = workStream.ToArray(); workStream.Write(byteInfo, 0, byteInfo.Length); workStream.Position = 0; return(new FileStreamResult(workStream, "application/pdf")); }