public ActionResult setDisponible(CatPeriodosModel model)
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }
            model.sesion = sesion;

            /*
             *          if (!sesion.permisos.havePermission(Privileges[0].Permiso))
             *                  return Json(new { msg = Notification.notAccess() });
             *          //*/
            try
            {
                if (model.setDisponible())
                {
                    //   model.init();
                    Log.write(this, "setDisponible", LOG.REGISTRO, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Succes("se ha realizado con exito la operación") }));
                }
                else
                {
                    // model.init();
                    Log.write(this, "setDisponible", LOG.ERROR, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Error(" Error en disponible") }));
                }
            }

            catch (Exception e)
            {
                return(Json(new { msg = Factory.Notification.Error(e.Message) }));
            }
        }
示例#2
0
        public string CreaCombo(string Sql = "", string Clave = "", string Valor = "", string Inicial = "")
        {
            string           Salida = "";
            CatPeriodosModel model  = new CatPeriodosModel();

            Salida = model.ComboSql(Sql, Clave, Valor, Inicial);
            return(Salida);
        }
        // GET: CatPeriodos
        public ActionResult Start()
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }

            CatPeriodosModel model = new CatPeriodosModel();

            //SessionDB sesion = SessionDB.start(Request, Response, false, model.db);
            if ((model.sesion = sesion) == null)
            {
                return(Content(""));
            }
            model.Clean();

            try
            {
                Main view = new Main();
                ViewBag.MainUser = view.CreateMenuInfoUser(sesion);
                ViewBag.Main     = view.createMenu(22, 45, sesion);

                sesion.vdata["TABLE_PERIODOS"] = "QPeriodosT";
                sesion.saveSession();

                ViewBag.BlockingPanel_1 = Main.createBlockingPanel("blocking-panel-1");
                ViewBag.DataTable       = CreateDataTable(10, 1, null, "PERIODO", "ASC", sesion);

                Scripts.SCRIPTS = new string[] { "js/ConsultarBanner/CatPeriodos/CatPeriodos.js" };
                ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion);

                //Intercom
                ViewBag.User     = sesion.nickName.ToString();
                ViewBag.Email    = sesion.nickName.ToString();
                ViewBag.FechaReg = DateTime.Today;

                if (!sesion.permisos.havePermission(Privileges[0].Permiso))
                {
                    return(View(Factory.View.NotAccess));
                }

                ViewBag.Ciclo = CreaCombo("select * from ciclos order by CVE_CICLO DESC", "CVE_CICLO", "CVE_CICLO", "");

                Log.write(this, "Start", LOG.CONSULTA, "Ingresa a pantalla 'Periodos' ", sesion);

                return(View(Factory.View.Access + "ConsultarBanner/CatPeriodos/Start.cshtml"));
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Ingresa a pantalla 'Periodos' " + e.Message, sesion);

                return(View(Factory.View.Access + "ConsultarBanner/CatPeriodos/Start.cshtml"));
            }
        }
        public string Importar(string periodos, string cveCiclo)
        {
            CatPeriodosModel model = new CatPeriodosModel();

            if ((model.sesion = SessionDB.start(Request, Response, false, model.db, SESSION_BEHAVIOR.AJAX)) == null)
            {
                return(string.Empty);
            }

            if (model.Importar(periodos, cveCiclo))
            {
                Log.write(this, "Importar", LOG.EDICION, "periodos:" + periodos, model.sesion);
                return(Notification.Succes("Los datos se han actualizado satisfactoriamente."));
            }
            else
            {
                return(Notification.Error("No se ha podido hacer la importación"));
            }
        }