Beispiel #1
0
        public IHttpActionResult GetCache()
        {
            object IdentityTypeList = CacheClass.GetCache("IdentityTypeList");

            //object val= CacheClass.GetCache("ceshi");
            return(Json(IdentityTypeList));
        }
Beispiel #2
0
        public DataTable GetOwenTreeByCatchBySysCode(string User_ID, string SysRole_IDS, string ModuleIDLike)
        {
            string str  = ConfigurationManager.AppSettings["IsEnableDataCache"];
            bool   flag = false;

            if (!string.IsNullOrEmpty(str) && (str.ToLower().Equals("true") || str.ToLower().Equals("false")))
            {
                flag = bool.Parse(str);
            }
            if (flag)
            {
                string cacheName = "Owen_LeftTree_" + clsUtility.GetSysCode() + "_" + User_ID + "_" + ModuleIDLike;
                object cache     = CacheClass.GetCache(cacheName);
                if (cache == null)
                {
                    try
                    {
                        cache = this.GetOwenTreeBySysCode(User_ID, SysRole_IDS, ModuleIDLike);
                        if (cache != null)
                        {
                            int num = 1;
                            CacheClass.AddCache(cacheName, DateTime.Now.AddMinutes((double)num), cache);
                        }
                    }
                    catch
                    {
                    }
                }
                return((DataTable)cache);
            }
            object obj3 = this.GetOwenTreeBySysCode(User_ID, SysRole_IDS, ModuleIDLike);

            CacheClass.DeleteCache("Owen_LeftTree_" + clsUtility.GetSysCode() + "_" + User_ID + "_" + ModuleIDLike);
            return((DataTable)obj3);
        }
Beispiel #3
0
        public IHttpActionResult SetCache()
        {
            List <SYS_IdentityType> IdentityTypeList = new List <SYS_IdentityType>();

            IdentityTypeList = SYS_IdentityTypeAdapter.Instance.GetAll().ToList();
            CacheClass.SetCache("IdentityTypeList", IdentityTypeList);
            return(Json(""));
        }
Beispiel #4
0
        public DataTable GetOwenTreeByCatchBySysCode(string User_ID, string SysRole_IDS, string ModuleIDLike, bool IsEnableDataCache)
        {
            DataTable table = new DataTable();

            if (IsEnableDataCache)
            {
                return(this.GetOwenTreeByCatchBySysCode(User_ID, SysRole_IDS, ModuleIDLike));
            }
            table = this.GetOwenTreeBySysCode(User_ID, SysRole_IDS, ModuleIDLike);
            CacheClass.DeleteCache("Owen_LeftTree_" + clsUtility.GetSysCode() + "_" + User_ID + "_" + ModuleIDLike);
            return(table);
        }
Beispiel #5
0
 public void TestGetAndIncrementGetAndDecrement()
 {
     CacheClass cacheClass = new CacheClass();
       cacheClass.Age = 19;
       cacheClass.Name = "Kang";
       Backendless.Cache.Put(DEFAULT_CACHE_KEY, cacheClass);
       Boolean isExist = Backendless.Cache.Contains(DEFAULT_CACHE_KEY);
       Assert.AreEqual(isExist, true, "Server returned a count with wrong value");
       CacheClass getCacheClass = Backendless.Cache.Get<CacheClass>(DEFAULT_CACHE_KEY);
       Assert.AreEqual(cacheClass.Age, getCacheClass.Age, "Server returned a count with wrong value");
       Assert.AreEqual(cacheClass.Name, getCacheClass.Name, "Server returned a count with wrong value");
       Backendless.Cache.Delete(DEFAULT_CACHE_KEY);
       isExist = Backendless.Cache.Contains(DEFAULT_CACHE_KEY);
       Assert.AreEqual(isExist, false, "Server returned a count with wrong value");
 }
Beispiel #6
0
        public void TestGetAndIncrementGetAndDecrement()
        {
            CacheClass cacheClass = new CacheClass();

            cacheClass.Age  = 19;
            cacheClass.Name = "Kang";
            Backendless.Cache.Put(DEFAULT_CACHE_KEY, cacheClass);
            Boolean isExist = Backendless.Cache.Contains(DEFAULT_CACHE_KEY);

            Assert.AreEqual(isExist, true, "Server returned a count with wrong value");
            CacheClass getCacheClass = Backendless.Cache.Get <CacheClass>(DEFAULT_CACHE_KEY);

            Assert.AreEqual(cacheClass.Age, getCacheClass.Age, "Server returned a count with wrong value");
            Assert.AreEqual(cacheClass.Name, getCacheClass.Name, "Server returned a count with wrong value");
            Backendless.Cache.Delete(DEFAULT_CACHE_KEY);
            isExist = Backendless.Cache.Contains(DEFAULT_CACHE_KEY);
            Assert.AreEqual(isExist, false, "Server returned a count with wrong value");
        }
Beispiel #7
0
        /// <summary>
        /// 读取缓存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 读取ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter = "缓存(*.bin)|*.bin";
            if (DialogResult.OK == openFileDialog.ShowDialog())
            {
                using (Stream stream = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    IFormatter iformatter = new BinaryFormatter();
                    CacheClass cache      = (CacheClass)iformatter.Deserialize(stream);
                    stream.Close();

                    FilterInstitute form = (FilterInstitute)GetForm(typeof(FilterInstitute));
                    if (form != null)
                    {
                        form.Close();
                    }

                    form             = new FilterInstitute();
                    form.MdiParent   = this;
                    form.WindowState = FormWindowState.Maximized;
                    form.Show();
                    #region 设置数据
                    form.fileformat               = cache.Fileformat;
                    form.memoryFilenames          = cache.MemoryFilenames;
                    form.Univerisities            = cache.UniverisityList;
                    form.memoryInstituteDataTable = cache.MemoryTable;
                    form.ifilter = cache.ifilter;
                    form.isOpen  = cache.isOpen;
                    form.tempInstituteDataTable = cache.InsituteTable;
                    cache.UniverisityList       = (from p in cache.UniverisityList orderby p.Checked descending select p).ToList <UniversityItem>();
                    form.BingUniversity(cache.UniverisityList);
                    form.BindInstituteDataTable(cache.InsituteTable);
                    form.SetFilenames(cache.Filenames);
                    form.SetSystemFormat(cache.Type);
                    form.SetFilterInstitute(cache.FilterInstiute);
                    #endregion

                    规范表ToolStripMenuItem.Enabled = true;
                }
            }
        }
Beispiel #8
0
 public void TestGetPointsByMetadata()
 {
     RunAndAwait(() =>
     {
         CacheClass cacheClass = new CacheClass();
         cacheClass.Age        = 19;
         cacheClass.Name       = "Kang";
         Backendless.Cache.Put(DEFAULT_CACHE_KEY, cacheClass, new AsyncCallback <object>(
                                   r =>
         {
             Backendless.Cache.Contains(DEFAULT_CACHE_KEY, new AsyncCallback <Boolean>(
                                            r2 =>
             {
                 Assert.AreEqual(r2, true, "Server returned a count with wrong value");
                 Backendless.Cache.Get <CacheClass>(DEFAULT_CACHE_KEY, new AsyncCallback <CacheClass>(
                                                        r3 =>
                 {
                     Assert.AreEqual(cacheClass.Age, r3.Age, "Server returned a count with wrong value");
                     Assert.AreEqual(cacheClass.Name, r3.Name, "Server returned a count with wrong value");
                     Backendless.Cache.Delete(DEFAULT_CACHE_KEY, new AsyncCallback <object>(
                                                  r4 =>
                     {
                         Backendless.Cache.Contains(DEFAULT_CACHE_KEY, new AsyncCallback <Boolean>(
                                                        r5 =>
                         {
                             Assert.AreEqual(r5, false, "Server returned a count with wrong value");
                             CountDown();
                         },
                                                        f5 => FailCountDownWith(f5)));
                     },
                                                  f4 => FailCountDownWith(f4)));
                 },
                                                        f3 => FailCountDownWith(f3)));
             },
                                            f2 => FailCountDownWith(f2)));
         },
                                   f => FailCountDownWith(f)));
     });
 }
Beispiel #9
0
        public string GetSetMapByCacheBySysCode(string ModuleId, string type)
        {
            string cacheName = "GetSetMap_" + clsUtility.GetSysCode() + "_" + ModuleId + type;
            object cache     = CacheClass.GetCache(cacheName);

            if (cache == null)
            {
                try
                {
                    cache = this.GetSetMapBySysCode(ModuleId, type);
                    if (cache != null)
                    {
                        int num = 1;
                        CacheClass.AddCache(cacheName, DateTime.Now.AddMinutes((double)num), cache);
                    }
                }
                catch
                {
                }
            }
            return(cache.ToString());
        }
Beispiel #10
0
        public DataTable GetOwenModuleListByCacheBySysCode(string User_ID, string SysRole_IDS)
        {
            string cacheName = "Owen_TopTree_" + clsUtility.GetSysCode() + "_" + User_ID;
            object cache     = CacheClass.GetCache(cacheName);

            if (cache == null)
            {
                try
                {
                    cache = this.GetModuleListBySysCode_Power(User_ID, SysRole_IDS).Tables[0];
                    if (cache != null)
                    {
                        int num = 1;
                        CacheClass.AddCache(cacheName, DateTime.Now.AddMinutes((double)num), cache);
                    }
                }
                catch
                {
                }
            }
            return((DataTable)cache);
        }
Beispiel #11
0
        public DataTable GetOwenModuleListByCache(string DoctorInfo_ID, string SysRole_IDS)
        {
            string cacheName = "Owen_TopTree_" + DoctorInfo_ID;
            object cache     = CacheClass.GetCache(cacheName);

            if (cache == null)
            {
                try
                {
                    cache = this.GetSysModuleList_Power(DoctorInfo_ID, SysRole_IDS).Tables[0];
                    if (cache != null)
                    {
                        int num = 1;
                        CacheClass.AddCache(cacheName, DateTime.Now.AddMinutes((double)num), cache);
                    }
                }
                catch
                {
                }
            }
            return((DataTable)cache);
        }
Beispiel #12
0
 public void TestGetPointsByMetadata()
 {
     RunAndAwait( () =>
     {
       CacheClass cacheClass = new CacheClass();
       cacheClass.Age = 19;
       cacheClass.Name = "Kang";
       Backendless.Cache.Put(DEFAULT_CACHE_KEY, cacheClass, new AsyncCallback<object>(
     r =>
     {
       Backendless.Cache.Contains(DEFAULT_CACHE_KEY, new AsyncCallback<Boolean>(
         r2 =>
         {
           Assert.AreEqual(r2, true, "Server returned a count with wrong value");
           Backendless.Cache.Get<CacheClass>(DEFAULT_CACHE_KEY, new AsyncCallback<CacheClass>(
             r3 =>
             {
               Assert.AreEqual(cacheClass.Age, r3.Age, "Server returned a count with wrong value");
               Assert.AreEqual(cacheClass.Name, r3.Name, "Server returned a count with wrong value");
               Backendless.Cache.Delete(DEFAULT_CACHE_KEY, new AsyncCallback<object>(
                 r4 =>
                 {
                   Backendless.Cache.Contains(DEFAULT_CACHE_KEY, new AsyncCallback<Boolean>(
                   r5 =>
                   {
                     Assert.AreEqual(r5, false, "Server returned a count with wrong value");
                     CountDown();
                   },
                   f5 => FailCountDownWith(f5)));
                 },
                 f4 => FailCountDownWith(f4)));
             },
             f3 => FailCountDownWith(f3)));
         },
         f2 => FailCountDownWith(f2)));
     },
     f => FailCountDownWith(f)));
     } );
 }
Beispiel #13
0
        public DataTable GetListByCache()
        {
            string cacheName = "MODEL_SysModuleList";
            object cache     = CacheClass.GetCache(cacheName);

            cache = null;
            if (cache == null)
            {
                try
                {
                    cache = this.GetSysModuleList("").Tables[0];
                    if (cache != null)
                    {
                        int num = 1;
                        CacheClass.AddCache(cacheName, DateTime.Now.AddMinutes((double)num), cache);
                    }
                }
                catch
                {
                }
            }
            return((DataTable)cache);
        }
Beispiel #14
0
        /// <summary>
        /// 保存缓存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 保存ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            FilterInstitute form = (FilterInstitute)GetForm(typeof(FilterInstitute));

            if (form == null)
            {
                return;
            }
            saveFileDialog.Filter = "缓存(*.bin)|*.bin";

            if (DialogResult.OK == saveFileDialog.ShowDialog())
            {
                CacheClass cache = new CacheClass();
                cache.Fileformat      = form.fileformat;
                cache.MemoryFilenames = form.memoryFilenames;

                form.SetUniversityList();
                cache.UniverisityList = form.Univerisities;
                cache.MemoryTable     = form.memoryInstituteDataTable;
                cache.ifilter         = form.ifilter;
                cache.isOpen          = form.isOpen;
                cache.Type            = form.GetSystemFormat();
                cache.Filenames       = form.GetFilenames();
                cache.FilterInstiute  = form.GetFilterInstitute();
                DataGridView dgvInstituteDataTable = form.dgvInstituteDataTable;
                //cache.InsituteTable = form.GetDataTableFromGridView(dgvInstituteDataTable);
                cache.InsituteTable = form.tempInstituteDataTable;

                using (Stream stream = new FileStream(saveFileDialog.FileName, FileMode.Create, FileAccess.Write))
                {
                    IFormatter iformatter = new BinaryFormatter();
                    iformatter.Serialize(stream, cache);
                    stream.Close();
                    MessageBox.Show("缓存保存成功");
                }
            }
        }
 public SQLSysViews(IDataProvider provider) :this()
 {
     Cache = new CacheClass(provider, this);
 }
Beispiel #16
0
        public void ClearCacheFormulations_Dict()
        {
            string cacheName = "Formulations_Dict";

            CacheClass.DeleteCache(cacheName);
        }