protected override void OnThreadUpdate() { if (IsUpdating || !Exchange.IsInitialized) { return; } IsUpdating = true; try { if (!Exchange.SupportWebSocket(WebSocketType.Tickers)) { Exchange.UpdateTickersInfo(); } DataCacheManager.UpdateTasks(); for (int i = 0; i < Exchange.Tickers.Count; i++) { Exchange.Tickers[i].UpdateTrailings(); } } finally { IsUpdating = false; } if (IsHandleCreated) { BeginInvoke(new Action(() => { UpdateConnectionStatus(); UpdateCachedDataCountInfo(); if (!Exchange.SupportWebSocket(WebSocketType.Tickers)) { this.gvTikers.RefreshData(); } })); } }
public static void Remove(int channelId) { lock (LockObject) { DataCacheManager.RemoveByPrefix($"{CachePrefix}.{channelId}."); } }
public ElementManager() : base(null) { ElementManager = this; if (ConvertHelper.ToBoolean(ConfigurationManager.AppSettings[@"dataCache.enable"], true)) { CacheManager = new DataCacheManager(); CacheManager.Initialize(new DataCacheManagerConfiguration()); } else { CacheManager = null; } DataQuerier = new AdoNetSqlQuerier(); DataQuerier.Initialize(CacheManager); DataQuerier.ConnectionString = new SmartConnectionString( ConfigurationManager.ConnectionStrings[@"web"].ConnectionString); // -- // Do this AFTER initializing the configuration. DataUpdaterInfo = new AdoNetUpdaterInformation(false); // -- if (CacheManager != null) { CacheManager.StartScavenge(); } }
public static List <KeyValuePair <int, SiteInfo> > GetSiteInfoKeyValuePairList() { var retval = DataCacheManager.Get <List <KeyValuePair <int, SiteInfo> > >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <List <KeyValuePair <int, SiteInfo> > >(CacheKey); if (retval == null) { var list = DataProvider.SiteDao.GetSiteInfoKeyValuePairList(); retval = new List <KeyValuePair <int, SiteInfo> >(); foreach (var pair in list) { var siteInfo = pair.Value; if (siteInfo == null) { continue; } siteInfo.SiteDir = GetSiteDir(list, siteInfo); retval.Add(pair); } DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
public ElementManager() : base(null) { ElementManager = this; if (ConvertHelper.ToBoolean(ConfigurationManager.AppSettings[@"dataCache.enable"], true)) { CacheManager = new DataCacheManager(); CacheManager.Initialize(new DataCacheManagerConfiguration()); } else { CacheManager = null; } DataQuerier = new AdoNetSqlQuerier(); DataQuerier.Initialize(CacheManager); DataQuerier.ConnectionString = new SmartConnectionString( ConfigurationManager.ConnectionStrings[@"web"].ConnectionString); // -- // Do this AFTER initializing the configuration. DataUpdaterInfo = new AdoNetUpdaterInformation(false); // -- if (CacheManager != null) { CacheManager.StartScavenge(); } }
/// <summary> /// 导出数据到Excel表 导出的excel表为 .xls 格式 /// </summary> /// <returns></returns> public FileResult ExportData() { var currentUser = LoginManager.GetCurrentUser(); try { List <Information> informationList = _informationBLL.GetInformation(DataCacheManager.GetDataCache(CachaKey.Key)); List <CustomItem> customItemList = new List <CustomItem>(); _customItemBLL.GetCustomItems(currentUser.Account, ref customItemList); List <CustomItemValue> customItemValueList = new List <CustomItemValue>(); foreach (var item in informationList) { foreach (var ci in customItemList) { var tmp = _customItemValueBLL.GetCustomItemValueByCustomItemIdAndInforId(ci.Id, item.Id); if (tmp != null) { customItemValueList.Add(tmp); } } } MemoryStream ms = _excelManager.DataTOExcel(informationList, customItemList, customItemValueList); return(File(ms, "application/vnd.ms-excel", TimeManager.GetTimeSpan() + ".xls")); } catch (Exception ex) { LogHelper.writeLog_error(ex.Message); LogHelper.writeLog_error(ex.StackTrace); throw; } }
public ActionResult SetApproval(string dataCode) { AjaxResult ar = new AjaxResult(); if (string.IsNullOrEmpty(dataCode)) { ar.state = ResultType.error.ToString(); ar.message = "提交的数据为空,上报失败"; return(Json(ar, JsonRequestBehavior.AllowGet)); } var information = _informationBLL.GetInformation(dataCode); var currentUser = LoginManager.GetCurrentUser(); if (information == null) { ar.state = ResultType.error.ToString(); ar.message = "不存在相应的数据条目,上报失败"; } else { //把数据的状态设置为 待审核状态就是上报 information.State = (int)InformatinState.PendApproval; using (var db = new DCSDBContext()) { using (var trans = db.Database.BeginTransaction()) { try { db.Set <Information>().Attach(information); db.Entry(information).State = System.Data.Entity.EntityState.Modified; currentUser.Apcount += 1; db.Set <Member>().Attach(currentUser); db.Entry(currentUser).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); trans.Commit(); DataCacheManager.Clear(CachaKey.Key); ar.state = ResultType.success.ToString(); ar.message = "上报成功"; } catch (Exception ex) { LogHelper.writeLog_error(ex.Message); LogHelper.writeLog_error(ex.StackTrace); trans.Rollback(); ar.state = ResultType.error.ToString(); ar.message = "系统错误,上报失败"; } } } } return(Json(ar, JsonRequestBehavior.AllowGet)); }
public static void Remove(int channelId) { lock (LockObject) { var cacheKey = GetCacheKey(channelId); DataCacheManager.Remove(cacheKey); } }
private static Dictionary <int, Dictionary <int, TemplateInfo> > GetCacheDictionary() { var dictionary = DataCacheManager.Get <Dictionary <int, Dictionary <int, TemplateInfo> > >(CacheKey); if (dictionary == null) { dictionary = new Dictionary <int, Dictionary <int, TemplateInfo> >(); DataCacheManager.InsertHours(CacheKey, dictionary, 24); } return(dictionary); }
public static DSResponse GetSchoolLocationList() { if (DataCacheManager.Get(LIST_SCHOOL_LOCATION) == null) { DSXmlHelper helper = new DSXmlHelper("GetSchoolLocationListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Config.GetSchoolLocationList", new DSRequest(helper)); DataCacheManager.Add(LIST_SCHOOL_LOCATION, dsrsp); } return(DataCacheManager.Get(LIST_SCHOOL_LOCATION)); }
public static KeyValuePair <string, string> FindTownByZipCode(string zipCode) { DSResponse dsrsp = DataCacheManager.Get("CountyTownBelong"); XmlNode node = dsrsp.GetContent().GetElement("Town[@Code='" + zipCode + "']"); KeyValuePair <string, string> kvp = new KeyValuePair <string, string>(); if (node != null) { kvp = new KeyValuePair <string, string>(node.Attributes["County"].Value, node.Attributes["Name"].Value); } return(kvp); }
private static Dictionary <string, List <TableColumn> > GetAllDictionary() { var allDict = DataCacheManager.Get <Dictionary <string, List <TableColumn> > >(CacheKey); if (allDict != null) { return(allDict); } allDict = new Dictionary <string, List <TableColumn> >(); DataCacheManager.InsertHours(CacheKey, allDict, 24); return(allDict); }
public static XmlElement[] GetTownList(string county) { DSResponse dsrsp = DataCacheManager.Get("CountyTownBelong"); if (dsrsp == null) { return(new XmlElement[0]); } else { return(dsrsp.GetContent().GetElements("Town[@County='" + county + "']")); } }
private static Dictionary <int, Dictionary <int, ChannelInfo> > GetAllDictionary() { var allDict = DataCacheManager.Get <Dictionary <int, Dictionary <int, ChannelInfo> > >(CacheKey); if (allDict != null) { return(allDict); } allDict = new Dictionary <int, Dictionary <int, ChannelInfo> >(); DataCacheManager.Insert(CacheKey, allDict); return(allDict); }
private static Dictionary <int, Dictionary <int, SpecialInfo> > GetCacheDictionary() { var dictionary = DataCacheManager.Get <Dictionary <int, Dictionary <int, SpecialInfo> > >(CacheKey); if (dictionary != null) { return(dictionary); } dictionary = new Dictionary <int, Dictionary <int, SpecialInfo> >(); DataCacheManager.InsertHours(CacheKey, dictionary, 24); return(dictionary); }
public IActionResult RankList(string type, int count) { int rankType = 0; switch (type) { case "todayRank": { rankType = 1; break; } case "totalRank": { rankType = 2; break; } default: { return(WriteFail("排行类型错误")); } } var userId = (int)this.UserInfo.UserId; var cacheType = $"{type}&{userId}"; var data = DataCacheManager.GetItem <string, HallRankList>(cacheType); if (data != null) { return(Json(data)); } DataSet ds = null; Core.DBTools.Data.DataProcedureHelper.WEB_GetRankList(userId, count, rankType, out ds); if (ds.Tables.Count <= 0) { return(WriteFail("没有获取到排行榜数据")); } var tb = ds.Tables[0]; data = HallRankList.ParseDataTable(tb); //缓存五分钟 this.DataCacheManager.SetItem(cacheType, data, (5 * 60)); return(Json(data)); }
public static Dictionary <int, ContentInfo> GetContentDict(int channelId) { lock (LockObject) { var cacheKey = GetCacheKey(channelId); var dict = DataCacheManager.Get <Dictionary <int, ContentInfo> >(cacheKey); if (dict == null) { dict = new Dictionary <int, ContentInfo>(); DataCacheManager.InsertHours(cacheKey, dict, 12); } return(dict); } }
public static List <KeyValuePair <int, DepartmentInfo> > GetDepartmentInfoKeyValuePair() { lock (LockObject) { var list = DataCacheManager.Get <List <KeyValuePair <int, DepartmentInfo> > >(CacheKey); if (list != null) { return(list); } list = DataProvider.DepartmentDao.GetDepartmentInfoKeyValuePair(); DataCacheManager.Insert(CacheKey, list); return(list); } }
public static DSResponse GetUpdateCodeSynopsis() { string serviceName = "SmartSchool.Config.GetUpdateCodeSynopsis"; if (DataCacheManager.Get(serviceName) == null) { DSRequest request = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetCountyListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "異動代號對照表"); request.SetContent(helper); DSResponse dsrsp = FISCA.Authentication.DSAServices.CallService("SmartSchool.Config.GetUpdateCodeSynopsis", request); DataCacheManager.Add(serviceName, dsrsp); } return(DataCacheManager.Get(serviceName)); }
public static DSResponse GetAbsenceList() { string serviceName = "GetAbsenceList"; if (DataCacheManager.Get(serviceName) == null) { DSRequest request = new DSRequest(); DSXmlHelper helper = new DSXmlHelper("GetAbsenceListRequest"); helper.AddElement("Field"); helper.AddElement("Field", "All"); request.SetContent(helper); DSResponse dsrsp = DSAServices.CallService("SmartSchool.Others.GetAbsenceList", request); DataCacheManager.Add(serviceName, dsrsp); } return(DataCacheManager.Get(serviceName)); }
public static List <int> GetContentIdList(int channelId, int?onlyAdminId) { lock (LockObject) { var cacheKey = GetCacheKey(channelId, onlyAdminId); var list = DataCacheManager.Get <List <int> >(cacheKey); if (list != null) { return(list); } list = new List <int>(); DataCacheManager.Insert(cacheKey, list); return(list); } }
private static Dictionary <string, List <ContentCountInfo> > GetAllContentCounts() { lock (LockObject) { var retVal = DataCacheManager.Get <Dictionary <string, List <ContentCountInfo> > >(CacheKey); if (retVal != null) { return(retVal); } retVal = DataCacheManager.Get <Dictionary <string, List <ContentCountInfo> > >(CacheKey); if (retVal == null) { retVal = new Dictionary <string, List <ContentCountInfo> >(); DataCacheManager.Insert(CacheKey, retVal); } return(retVal); } }
public ActionResult SearchCache() { AjaxResult ar = new AjaxResult(); try { List <InformationModel> modelList = DataCacheManager.GetDataCache(CachaKey.Key); ar.state = ResultType.success.ToString(); ar.data = modelList.ToJson(); } catch (Exception ex) { LogHelper.writeLog_error(ex.Message); LogHelper.writeLog_error(ex.StackTrace); ar.state = ResultType.error.ToString(); ar.message = "获取缓存数据失败"; } return(Json(ar, JsonRequestBehavior.AllowGet)); }
private static Dictionary <string, UserInfo> GetDict() { var retval = DataCacheManager.Get <Dictionary <string, UserInfo> >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <Dictionary <string, UserInfo> >(CacheKey); if (retval == null) { retval = new Dictionary <string, UserInfo>(); DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
private static Dictionary <string, AdministratorInfo> GetDict() { var dict = DataCacheManager.Get <Dictionary <string, AdministratorInfo> >(CacheKey); if (dict != null) { return(dict); } lock (LockObject) { dict = DataCacheManager.Get <Dictionary <string, AdministratorInfo> >(CacheKey); if (dict == null) { dict = new Dictionary <string, AdministratorInfo>(); DataCacheManager.Insert(CacheKey, dict); } } return(dict); }
public static List <KeyValuePair <string, TableStyleInfo> > GetAllTableStyles() { var retVal = DataCacheManager.Get <List <KeyValuePair <string, TableStyleInfo> > >(CacheKey); if (retVal != null) { return(retVal); } lock (LockObject) { retVal = DataCacheManager.Get <List <KeyValuePair <string, TableStyleInfo> > >(CacheKey); if (retVal == null) { retVal = DataProvider.TableStyleDao.GetAllTableStyles(); DataCacheManager.Insert(CacheKey, retVal); } } return(retVal); }
public static List <UserMenuInfo> GetAllUserMenus() { var retval = DataCacheManager.Get <List <UserMenuInfo> >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <List <UserMenuInfo> >(CacheKey); if (retval == null) { retval = DataProvider.UserMenuDao.GetUserMenuInfoList(); DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
public static Dictionary <int, List <ContentGroupInfo> > GetAllContentGroups() { var retval = DataCacheManager.Get <Dictionary <int, List <ContentGroupInfo> > >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <Dictionary <int, List <ContentGroupInfo> > >(CacheKey); if (retval == null) { retval = DataProvider.ContentGroupDao.GetAllContentGroups(); DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
public static Dictionary <string, AccessTokenInfo> GetAccessTokenDictionary() { var retval = DataCacheManager.Get <Dictionary <string, AccessTokenInfo> >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <Dictionary <string, AccessTokenInfo> >(CacheKey); if (retval == null) { retval = DataProvider.AccessTokenDao.GetAccessTokenInfoDictionary(); DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
private static string GetContentByFilePath(string filePath) { try { var content = DataCacheManager.Get <string>(filePath); if (content != null) { return(content); } if (FileUtils.IsFileExists(filePath)) { content = FileUtils.ReadText(filePath, Encoding.UTF8); } DataCacheManager.Insert(filePath, content, TimeSpan.FromHours(12), filePath); return(content); } catch { return(string.Empty); } }
public static List <KeyValuePair <int, AreaInfo> > GetAreaInfoPairList() { lock (LockObject) { var list = DataCacheManager.Get <List <KeyValuePair <int, AreaInfo> > >(CacheKey); if (list != null) { return(list); } var pairListFormDb = DataProvider.AreaDao.GetAreaInfoPairList(); list = new List <KeyValuePair <int, AreaInfo> >(); foreach (var pair in pairListFormDb) { var areaInfo = pair.Value; if (areaInfo != null) { list.Add(pair); } } DataCacheManager.Insert(CacheKey, list); return(list); } }