public static void Write(EventLogEntry entry) { try { if (entry.ApplicationType != ApplicationType.NoSet && (entry.EventType == EventType.Information || entry.EventType == EventType.Debug)) { entry.Uniquekey = ""; CommConfig config = CommConfig.GetConfig(); CommonDataProvider.Instance().WriteEventLogEntry(entry); return; } string key = string.Empty; if (entry.EventType == EventType.Warning) { key = GlobalKey.EVENTLOG_KEY + "_" + string.Format("{0}-{1}-{2}-{3}-{4}", entry.ApplicationID, entry.EntryID, entry.EventID, (int)entry.EventType, entry.Message.GetHashCode()); } else if (entry.EventType == EventType.Error && entry.Ex != null) { key = GlobalKey.EVENTLOG_KEY + "_" + string.Format("{0}-{1}-{2}-{3}-{4}-{5}", entry.ApplicationID, entry.EntryID, entry.EventID, (int)entry.EventType, entry.Ex.StackTrace.GetHashCode(), entry.Ex.Message.GetHashCode()); entry.Message = entry.Ex.Message + "-" + entry.Ex.StackTrace + "\r\n" + entry.Message; } else { key = GlobalKey.EVENTLOG_KEY + "_" + string.Format("{0}-{1}", (int)entry.EventType, entry.Message.GetHashCode()); } EventLogEntry oldentry = MangaCache.Get(key) as EventLogEntry; if (oldentry != null) { oldentry.PCount++; oldentry.LastUpdateTime = DateTime.Now; } else { DateTime time = DateTime.Now; entry.PCount = 1; entry.Uniquekey = key; entry.AddTime = time; entry.LastUpdateTime = time; CommConfig config = CommConfig.GetConfig(); CommonDataProvider.Instance().WriteEventLogEntry(entry); entry.PCount = 0; MangaCache.Add(key, entry, 30, TimeSpan.Zero, System.Web.Caching.CacheItemPriority.AboveNormal, new CacheItemRemovedCallback(RemovedCallback)); } } catch { } }
public List <PaymentWayInfo> GetList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetPaymentWayList()); } string key = GlobalKey.PAYMENTWAY_LIST; List <PaymentWayInfo> list = MangaCache.Get(key) as List <PaymentWayInfo>; if (list == null) { list = CommonDataProvider.Instance().GetPaymentWayList(); MangaCache.Max(key, list); } return(list); }
public List <PowerGroupInfo> GetList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetPowerGroupList().OrderBy(l => l.Sort).ToList()); } string key = GlobalKey.POWERGROUP_LIST; List <PowerGroupInfo> list = MangaCache.Get(key) as List <PowerGroupInfo>; if (list == null) { list = CommonDataProvider.Instance().GetPowerGroupList().OrderBy(l => l.Sort).ToList(); MangaCache.Max(key, list); } return(list); }
public List <TalkInfo> GetList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetTalkList()); } string key = GlobalKey.TALK_LIST; List <TalkInfo> list = MangaCache.Get(key) as List <TalkInfo>; if (list == null) { list = CommonDataProvider.Instance().GetTalkList(); MangaCache.Max(key, list); } return(list); }
public List <GiveupCauseInfo> GetList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetGiveupCauseList()); } string key = GlobalKey.GIVEUPCAUSE_LIST; List <GiveupCauseInfo> list = MangaCache.Get(key) as List <GiveupCauseInfo>; if (list == null) { list = CommonDataProvider.Instance().GetGiveupCauseList(); MangaCache.Max(key, list); } return(list); }
public List <ModuleInfo> GetList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetModuleList().OrderBy(l => l.Sort).ToList()); } string key = GlobalKey.MODULE_LIST; List <ModuleInfo> list = MangaCache.Get(key) as List <ModuleInfo>; if (list == null) { list = CommonDataProvider.Instance().GetModuleList().OrderBy(l => l.Sort).ToList(); MangaCache.Max(key, list); } return(list); }
public List <CorporationInfo> GetList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetCorporationList().OrderBy(l => l.Sort).ToList()); } string key = GlobalKey.CORPORATION_LIST; List <CorporationInfo> list = MangaCache.Get(key) as List <CorporationInfo>; if (list == null) { list = CommonDataProvider.Instance().GetCorporationList().OrderBy(l => l.Sort).ToList(); MangaCache.Max(key, list); } return(list); }
public List <CarBrandInfo> GetCarBrandList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetCarBrandList().OrderBy(l => l.NameIndex).ThenBy(l => l.Name).ToList()); } string key = GlobalKey.CARBRAND_LIST; List <CarBrandInfo> list = MangaCache.Get(key) as List <CarBrandInfo>; if (list == null) { list = CommonDataProvider.Instance().GetCarBrandList().OrderBy(l => l.NameIndex).ThenBy(l => l.Name).ToList(); MangaCache.Max(key, list); } return(list); }
public List <CustomerLevelInfo> GetList(bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetCustomerLevelList().OrderBy(l => l.Sort).ToList()); } string key = GlobalKey.CUSTOMERLEVEL_LIST; List <CustomerLevelInfo> list = MangaCache.Get(key) as List <CustomerLevelInfo>; if (list == null) { list = CommonDataProvider.Instance().GetCustomerLevelList().OrderBy(l => l.Sort).ToList(); MangaCache.Max(key, list); } return(list); }
public List <CustomerInfo> GetCustomerListByCorporation(int cid, bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetCustomerListByCorporation(cid)); } string key = GlobalKey.CUSTOMER_LIST + "_corp" + cid; List <CustomerInfo> list = MangaCache.Get(key) as List <CustomerInfo>; if (list == null) { list = CommonDataProvider.Instance().GetCustomerListByCorporation(cid); MangaCache.Max(key, list); } return(list); }
public List <CustomerConnectRecordInfo> GetListByCustomerID(int cid, bool fromCache = false) { if (!fromCache) { return(CommonDataProvider.Instance().GetCustomerConnectRecordListByCustomerID(cid)); } string key = GlobalKey.CUSTOMERCONNECTRECORD_LIST + "_c" + cid; List <CustomerConnectRecordInfo> list = MangaCache.Get(key) as List <CustomerConnectRecordInfo>; if (list == null) { list = CommonDataProvider.Instance().GetCustomerConnectRecordListByCustomerID(cid); MangaCache.Max(key, list); } return(list); }
/// <summary> /// 更新客户线索缓存 /// </summary> /// <param name="entity"></param> public void RefreshCustomerCache(CustomerInfo entity) { string key = GlobalKey.CUSTOMER_LIST + "_corp" + entity.CorporationID; List <CustomerInfo> list = MangaCache.Get(key) as List <CustomerInfo>; entity = GetCustomerByID(entity.ID); if (list != null && list.Exists(c => c.ID == entity.ID)) { list[list.FindIndex(c => c.ID == entity.ID)] = entity; } else if (list == null) { GetCustomerListByCorporation(entity.CorporationID, true); } else { list.Add(entity); } }
/// <summary> /// 更新客户线索流转记录缓存 /// </summary> /// <param name="entity"></param> public void RefreshCustomerConnectRecordCache(CustomerConnectRecordInfo entity) { string key = GlobalKey.CUSTOMERCONNECTRECORD_LIST + "_c" + entity.CustomerID; List <CustomerConnectRecordInfo> list = MangaCache.Get(key) as List <CustomerConnectRecordInfo>; entity = GetCustomerConnectRecordByID(entity.ID); if (list != null && list.Exists(c => c.ID == entity.ID)) { list[list.FindIndex(c => c.ID == entity.ID)] = entity; } else if (list == null) { GetListByCustomerID(entity.CustomerID, true); } else { list.Add(entity); } }