public ActionResult Crear(Seccion modelo, bool activo) { if (ModelState.IsValid) { modelo.ColegioId = CustomHelper.getColegioId(); modelo.Activo = activo; string strMensaje = new SeccionBL().Guardar(modelo); if (strMensaje.Equals("OK")) { TempData["Seccion-Success"] = strMensaje; return(RedirectToAction("Index")); } else { ModelState.AddModelError("", strMensaje); } } string strAtributo = "checked='checked'"; ViewBag.ActivoSi = activo == true ? strAtributo : ""; ViewBag.ActivoNo = activo == false ? strAtributo : ""; return(View(modelo)); }
public ActionResult Index(int?page, string search) { CustomHelper.setTitulo("Sección", "Listado"); List <Seccion> Secciones = new List <Seccion>(); try { if (!string.IsNullOrWhiteSpace(search) && search != null) { Secciones = new SeccionBL().Buscar(search, CustomHelper.getColegioId()).ToList(); } else { Secciones = new SeccionBL().ObtenerListado(true, CustomHelper.getColegioId()); } } catch (Exception ex) { ViewBag.Error = string.Format("Message: {0} StackTrace: {1}", ex.Message, ex.StackTrace); return(View("~/Views/Shared/Error.cshtml")); } ViewBag.Search = search; int pageSize = 15; int pageNumber = (page ?? 1); return(View(Secciones.ToPagedList(pageNumber, pageSize))); }
private void CargaControles() { var Ciclos = new CicloBL().ObtenerListado(false, CustomHelper.getColegioId()); var Niveles = new NivelAcademicoBL().ObtenerListado(false, CustomHelper.getColegioId()); var Jornadas = new JornadaBL().ObtenerListado(false, CustomHelper.getColegioId()); var Secciones = new SeccionBL().ObtenerListado(false, CustomHelper.getColegioId()); ViewBag.Ciclos = new SelectList(Ciclos, "CicloId", "Nombre"); ViewBag.Niveles = new SelectList(Niveles, "NivelId", "Nombre"); ViewBag.Jornadas = new SelectList(Jornadas, "JornadaId", "Nombre"); ViewBag.Secciones = new SelectList(Secciones, "SeccionId", "Nombre"); }
public ActionResult AddSeccion(SeccionDTO dto) { if (!this.currentUser()) { return(RedirectToAction("Ingresar")); } try { SeccionBL objBL = new SeccionBL(); if (dto.IdSeccion == 0) { if (objBL.add(dto)) { createResponseMessage(CONSTANTES.SUCCESS); return(RedirectToAction("Encuesta", new { id = dto.IdEncuesta })); } else { createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); } } else if (dto.IdSeccion != 0) { if (objBL.update(dto)) { createResponseMessage(CONSTANTES.SUCCESS); return(RedirectToAction("Encuesta", new { id = dto.IdEncuesta })); } else { createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); } } else { createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_INSERT_MESSAGE); } } catch { if (dto.IdSeccion != 0) { createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); } else { createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_INSERT_MESSAGE); } } TempData["Seccion"] = dto; return(RedirectToAction("Encuesta")); }
public FormAlumnos() { InitializeComponent(); _alumnos = new AlumnosBL(); listaAlumnosBindingSource.DataSource = _alumnos.ObtenerAlumnos(); _cursos = new CursosBL(); listaCursoBindingSource.DataSource = _cursos.ObtenerCurso(); _secciones = new SeccionBL(); listaSeccionesBindingSource.DataSource = _secciones.ObtenerSecciones(); }
public ActionResult Editar(long id) { Seccion SeccionActual = new SeccionBL().ObtenerxId(id); if (SeccionActual == null || SeccionActual.SeccionId == 0) { return(HttpNotFound()); } CustomHelper.setTitulo("Sección", "Editar"); string strAtributo = "checked='checked'"; ViewBag.ActivoSi = SeccionActual.Activo == true ? strAtributo : ""; ViewBag.ActivoNo = SeccionActual.Activo == false ? strAtributo : ""; return(View(SeccionActual)); }
private void CargaSecciones() { var Secciones = new SeccionBL().ObtenerListado(false, CustomHelper.getColegioId()); ViewBag.Secciones = new SelectList(Secciones, "SeccionId", "Nombre"); }
public ActionResult AddSeccion(SeccionDTO dto) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } try { SeccionBL objBL = new SeccionBL(); if (dto.IdSeccion == 0) { if (objBL.add(dto)) { createResponseMessage(CONSTANTES.SUCCESS); return RedirectToAction("Encuesta", new { id = dto.IdEncuesta }); } else createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); } else if (dto.IdSeccion != 0) { if (objBL.update(dto)) { createResponseMessage(CONSTANTES.SUCCESS); return RedirectToAction("Encuesta", new { id = dto.IdEncuesta }); } else createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); } else createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_INSERT_MESSAGE); } catch { if (dto.IdSeccion != 0) createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); else createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_INSERT_MESSAGE); } TempData["Seccion"] = dto; return RedirectToAction("Encuesta"); }