Пример #1
0
        public void InsertOrUpdateApp(Model.App app)
        {
            var oldApp = DbHelper.GetOneApp(app.AppNo, app.AppEvent);

            if (oldApp == null)
            {
                oldApp = new App
                {
                    AppNo    = app.AppNo,
                    AppEvent = app.AppEvent
                }
            }
            ;
            oldApp.Description = app.Description;
            oldApp.Enabled     = app.Enabled;
            DbHelper.InsertOrUpdateApp(oldApp);
        }
Пример #2
0
        public IActionResult Save(Model.KeySaveModel model)
        {
            if (model.AppId <= 0)
            {
                return(Json(new JsonMsg(MsgConst.ERROR)));
            }

            Model.App app = _appService.Find(model.AppId);
            if (app == null)
            {
                return(Json(new JsonMsg(MsgConst.ERROR)));
            }

            var  cache = Caching.CacheFactory.Create(Caching.CacheType.Rediscache, app.ConnectionString);
            bool isOk  = cache.Set(model.Key, model.Type, model.Value, model.TimeToLive);


            return(Json(new JsonMsg(MsgConst.OK, "")));
        }
Пример #3
0
        public IActionResult Search(string key, int?pageIndex, int?pageSize, int?appId, bool?ignoreTTL, bool?ignoreNull)
        {
            if (!appId.HasValue)
            {
                return(Content("[]"));
            }

            if (!pageIndex.HasValue)
            {
                pageIndex = 1;
            }
            if (!pageSize.HasValue)
            {
                pageSize = 50;
            }
            if (!ignoreTTL.HasValue)
            {
                ignoreTTL = true;
            }

            if (!ignoreNull.HasValue)
            {
                ignoreNull = true;
            }

            Model.App app = _appService.Find(appId.Value);
            if (app == null)
            {
                return(Content("[]"));
            }

            ICacheService    service = new CacheService();
            PagedDataJsonMsg result  = service.Search(app, key, pageIndex.Value, pageSize.Value, ignoreTTL.Value, ignoreNull.Value);

            return(Json(result));
        }
Пример #4
0
 public static void Main()
 {
     Model.App app = new Model.App();
     app.InitializeComponent();
     app.Run();
 }