Exemplo n.º 1
0
        public ActionResult Nuevo(CompromisoModel.Nuevo model)
        {
            try
            {
                Validar(model);
                if (ModelState.IsValid)
                {
                    Compromiso entidad = model.Get();
                    entidad.EstructuraId = _estructuraId;
                    entidad.Estado       = EstadoCompromiso.NUEVO;

                    _compromisoLogica = new CompromisoLogica();
                    _compromisoLogica.Guardar(entidad);

                    return(Content(entidad.Id.ToString()));
                }
                else
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return(PartialView("_Error"));
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Exemplo n.º 2
0
        public ActionResult ListarPorPagina(CompromisoFiltro filter, int pageIndex, int pageSize)
        {
            try
            {
                _compromisoLogica = new CompromisoLogica();
                int totalRows           = 0;
                List <Compromiso> lista = _compromisoLogica.ListarPorPagina(filter, pageIndex, pageSize, ref totalRows) ?? new List <Compromiso>();

                string rpta = JsonConvert.SerializeObject(new
                {
                    lista = lista.Select(x => new
                    {
                        x.Id,
                        x.Codigo,
                        x.Descripcion,
                        Fecha   = x.FechaRegistro.ToString("dd/MM/yyyy HH:mm"),
                        Estado  = x.Estado.ToString(),
                        Nuevo   = x.FechaRegistro.Date == DateTime.Today,
                        Tablero = new { x.Tablero.Descripcion }
                    }),
                    totalRows
                });
                return(Content(rpta, "application/json"));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Exemplo n.º 3
0
        public ActionResult Ver(int id, bool parcial = true)
        {
            try
            {
                _compromisoLogica = new CompromisoLogica();
                _estructuraLogica = new EstructuraLogica();

                Compromiso model = _compromisoLogica.Buscar(id);

                ViewBag.Tablero = string.Concat("/ALICORP", _estructuraLogica.Ruta(model.TableroId)?.ToUpper() ?? "");
                ViewBag.Ruta    = string.Concat("/ALICORP", _estructuraLogica.Ruta(model.EstructuraId)?.ToUpper() ?? "");

                if (parcial)
                {
                    return(PartialView("_Ver", model));
                }
                else
                {
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Exemplo n.º 4
0
        public ActionResult Editar(CompromisoModel.Editar model)
        {
            try
            {
                Validar(model);
                if (ModelState.IsValid)
                {
                    Compromiso entidad = model.Get();

                    _compromisoLogica = new CompromisoLogica();
                    _compromisoLogica.Actualizar(entidad);
                    return(Content(model.Id.ToString()));
                }
                else
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return(PartialView("_Error"));
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Exemplo n.º 5
0
        public ActionResult Seguimiento(int id)
        {
            try
            {
                _compromisoLogica = new CompromisoLogica();
                _estructuraLogica = new EstructuraLogica();

                Compromiso model = _compromisoLogica.Buscar(id, true);
                ViewBag.Ruta = string.Concat("/ALICORP", _estructuraLogica.Ruta(model.EstructuraId)?.ToUpper() ?? "");

                return(PartialView("_Seguimiento", model));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Exemplo n.º 6
0
        public ActionResult Editar(int id, string callBack = "SetCompromiso")
        {
            try
            {
                _estructuraLogica = new EstructuraLogica();
                _compromisoLogica = new CompromisoLogica();

                Compromiso model = _compromisoLogica.Buscar(id);

                ViewBag.Tablero  = string.Concat("/ALICORP", _estructuraLogica.Ruta(model.TableroId)?.ToUpper() ?? "");
                ViewBag.CallBack = callBack;

                return(PartialView("_Editar", model));
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                ViewBag.Message     = ex.Message;
                return(PartialView("_Error"));
            }
        }
Exemplo n.º 7
0
 public ActionResult Verificacion(CompromisoModel.Verificar model)
 {
     try
     {
         Validar(model);
         if (ModelState.IsValid)
         {
             _compromisoLogica = new CompromisoLogica();
             _compromisoLogica.Finalizar(model.Id.Value, model.Respuesta);
             return(Content(model.Id.Value.ToString()));
         }
         else
         {
             Response.StatusCode = (int)HttpStatusCode.BadRequest;
             return(PartialView("_Error"));
         }
     }
     catch (Exception ex)
     {
         Response.StatusCode = (int)HttpStatusCode.BadRequest;
         ViewBag.Message     = ex.Message;
         return(PartialView("_Error"));
     }
 }