Пример #1
0
        public ActionResult ViewProgram()
        {
            StringBuilder traceLog = new StringBuilder();

            if (Login.IsSessionExpire(Convert.ToString(HttpContext.Session[Message.LoginUserName])) ||
                Convert.ToString(HttpContext.Session[ConstantHelper.constUserType]) != Message.UserTypeAdmin)
            {
                return(RedirectToAction(ConstantHelper.constLogin, ConstantHelper.constLogin));
            }
            try
            {
                traceLog.AppendLine("Start: ViewProgram controller");
                int challengeId = 0;
                challengeId = Convert.ToInt32(Request.QueryString["id"]);
                ViewProgramDetail objChallenge = new ViewProgramDetail();
                if (challengeId > 0)
                {
                    objChallenge = ProgramBL.GetProgramById(challengeId);
                }
                return(View(objChallenge));
            }
            catch (Exception ex)
            {
                LogManager.LogManagerInstance.WriteErrorLog(ex);
                return(null);
            }
            finally
            {
                traceLog.AppendLine("ViewProgram end() : --- " + DateTime.Now.ToLongDateString());
                LogManager.LogManagerInstance.WriteTraceLog(traceLog);
            }
        }
Пример #2
0
        public ActionResult Editar(string id)
        {
            ProgramBL oBL    = new ProgramBL();
            int       pIntID = 0;

            int.TryParse(id, out pIntID);
            ProgramViewModel pProgramViewModel = oBL.Obtener(pIntID);

            return(View(pProgramViewModel));
        }
Пример #3
0
        public JsonResult Verificar(int id_program, string name)
        {
            ProgramBL oBL       = new ProgramBL();
            var       resultado = oBL.VerificarDuplicado(id_program, name);

            return(Json(new
            {
                // this is what datatables wants sending back
                valido = resultado,
            }));
        }
Пример #4
0
        public JsonResult Eliminar(int id)
        {
            ProgramBL oProgramBL = new ProgramBL();

            oProgramBL.Eliminar(id);

            return(Json(new
            {
                // this is what datatables wants sending back
                status = "1",
            }));
        }
Пример #5
0
        public ActionResult Editar([Bind(Include = "program_id,name")] ProgramViewModel pProgramViewModel)
        {
            // TODO: Add insert logic here

            if (pProgramViewModel == null)
            {
                return(HttpNotFound());
            }
            ProgramBL oProgramBL = new ProgramBL();

            pProgramViewModel.user_id_modified = AuthorizeUserAttribute.UsuarioLogeado().user_id;
            oProgramBL.Modificar(pProgramViewModel);
            return(RedirectToAction("Index"));
        }
Пример #6
0
        public JsonResult ObtenerLista(DataTableAjaxPostModel ofilters)//DataTableAjaxPostModel model
        {
            ProgramBL oProgramBL = new ProgramBL();
            //ProgramFiltersViewModel ofilters = new ProgramFiltersViewModel();
            GridModel <ProgramViewModel> grid = oProgramBL.ObtenerLista(ofilters);

            return(Json(new
            {
                // this is what datatables wants sending back
                draw = ofilters.draw,
                recordsTotal = grid.total,
                recordsFiltered = grid.recordsFiltered,
                data = grid.rows
            }));
        }
Пример #7
0
        public ActionResult Crear([Bind(Include = "program_id,name")] ProgramViewModel pProgramViewModel)
        {
            // TODO: Add insert logic here

            if (pProgramViewModel == null)
            {
                return(HttpNotFound());
            }
            pProgramViewModel.program_id      = 0;
            pProgramViewModel.user_id_created = AuthorizeUserAttribute.UsuarioLogeado().user_id;

            ProgramBL oBL = new ProgramBL();

            oBL.Agregar(pProgramViewModel);
            return(RedirectToAction("Index"));
        }