public ActionResult Search() { try { string strErrorMessage = string.Empty; BLSkills _objBLSkills = new BLSkills(); DOADM_SkillMasterExtended objDOADM_SkillMasterExtended = new DOADM_SkillMasterExtended(); objDOADM_SkillMasterExtended.lstRoles = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Role); objDOADM_SkillMasterExtended.lstBusinessSegment = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.BusinessSegment); objDOADM_SkillMasterExtended.lstDepartment = GetERSDepartments(); objDOADM_SkillMasterExtended.lstWorkBasket = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.WorkBasket); List <DOADM_SkillsMaster> lstDOADM_SkillsMaster = new List <DOADM_SkillsMaster>(); DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); objDOADM_SkillsMaster.IsActive = true; long? TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; ExceptionTypes result = _objBLSkills.SearchSkills(TimeZone, objDOADM_SkillsMaster, out lstDOADM_SkillsMaster, out strErrorMessage); objDOADM_SkillMasterExtended.lstSkillsMaster = lstDOADM_SkillsMaster; return(View(objDOADM_SkillMasterExtended)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(RedirectToAction("Maintenance", "Error", routeValues: ex.ToString())); } }
public ActionResult Add(long lSkillsID = 0, bool isActive = true) { string errorMessage = string.Empty; try { Session[ConstantTexts.SkillWorkQueueSessionKey] = null; DOADM_SkillsMaster objDOADM_SkillsMaster = new DOADM_SkillsMaster(); objDOADM_SkillsMaster.IsActive = true; ViewBag.Roles = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.Role); ViewBag.BusinessSegment = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.BusinessSegment); ViewBag.WorkBasket = CacheUtility.GetAllLookupsFromCache((long)LookupTypes.WorkBasket); ViewBag.lstDiscrepancyCategories = GetDiscrepancyCategories(); ViewBag.lstDepartments = GetERSDepartments(); if (lSkillsID != 0) { GetSkillForEdit(lSkillsID, isActive, out objDOADM_SkillsMaster); List <DOCMN_LookupMasterCorrelations> lstDOCMN_LookupMaster = CacheUtility.GetAllLookupMasterCorrelationFromCache((long)LookupTypesCorrelation.DiscripancyCategoryVQueue, objDOADM_SkillsMaster.DiscrepancyCategoryLkup); lstDOCMN_LookupMaster = lstDOCMN_LookupMaster.Where(x => x.CMN_LookupMasterParentRef == objDOADM_SkillsMaster.DiscrepancyCategoryLkup).ToList(); ViewBag.WorkQueues = lstDOCMN_LookupMaster; Session[ConstantTexts.SkillWorkQueueSessionKey] = objDOADM_SkillsMaster.lstDOADM_SkillWorkQueuesCorrelation; objDOADM_SkillsMaster.lstDOADM_SkillWorkQueuesCorrelation = objDOADM_SkillsMaster.lstDOADM_SkillWorkQueuesCorrelation.Where(x => x.IsActive == true).ToList(); } return(View(objDOADM_SkillsMaster)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.ManageSkills, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString()); return(RedirectToAction("Maintenance", "Error", routeValues: ex.ToString())); } }
/// <summary> /// it will save the file to actual path /// </summary> /// <param name="filePath"></param> /// <param name="newFilePath"></param> /// <returns></returns> private bool SaveFileToActualFolder(string filePath, out string newFilePath) { bool isScucess = false; string basePath = string.Empty; try { newFilePath = CacheUtility.GetMasterConfigurationByName(ConstantTexts.BulkUploadFilePath); FileInfo fi = new FileInfo(filePath); basePath = newFilePath + DateTime.Now.Year + "\\" + DateTime.Now.Month + "\\" + DateTime.Now.Day; newFilePath = basePath + "\\" + fi.Name; if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } fi.MoveTo(newFilePath); isScucess = true; } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BulkUpload, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); throw ex; } return(isScucess); }
public ActionResult UserAccess() { ENRLReconSystem.DO.UIUserLogin loggedInUser = System.Web.HttpContext.Current.Session[ENRLReconSystem.Utility.ConstantTexts.CurrentUserSessionKey] as ENRLReconSystem.DO.UIUserLogin; ViewBag.userRole = ((ENRLReconSystem.Utility.RoleLkup)loggedInUser.RoleLkup).ToString(); ViewBag.workBasket = ((ENRLReconSystem.Utility.WorkBasket)loggedInUser.WorkBasketLkup).ToString(); ViewBag.businessSegment = CacheUtility.GetAllLookupsFromCache((long)ENRLReconSystem.Utility.LookupTypes.BusinessSegment).Where(x => x.CMN_LookupMasterId.Equals(@loggedInUser.BusinessSegmentLkup)).FirstOrDefault().LookupValue; string strAccessGroups = string.Empty; if (loggedInUser.UserAccessGroup != null && loggedInUser.UserAccessGroup.Count > 0) { foreach (var item in loggedInUser.UserAccessGroup.Where(x => x.RoleLkup == loggedInUser.RoleLkup && x.WorkBasketLkup == loggedInUser.WorkBasketLkup).ToList()) { if (strAccessGroups.Length == 0) { strAccessGroups = item.AccessGroupName; } else { strAccessGroups = strAccessGroups + "," + item.AccessGroupName; } } } ViewBag.strAccessGroups = strAccessGroups; return(PartialView("_UserAccess")); }
public List <OrderItems> GetList(TableObject table) { string CustomerLink = ConfigurationManager.AppSettings["CustomerLink"]; string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"]; string key = CacheUtility.GetKey(table); object obj = CacheUtility.Get(key); if (obj != null) { return((List <OrderItems>)obj); } string sqlStr = ""; string sqlAdd = ""; if (table.IsValid == 1) { sqlAdd = " AND (TotalCourseAmount>0 OR CommonCourseAmount>0 OR SpecialCourseAmount>0) "; } sqlStr = @"select * from OrderItems where LastModified>@LastModified and OrderID in(select OrderID from OrderStatistics where CustomerID in( select CustomerID FROM " + CustomerLink + @"[CloudCustomer].[dbo].[CustomerSearch] ss where ss.XDSchoolID=@SchoolID " + sqlAdd + "))"; //string sqlStr = "select * from OrderItems where LastModified>@LastModified"; List <DbParameter> paras = new List <DbParameter>(); string providerName = ConfigurationManager.ConnectionStrings["CloudTrade"].ProviderName; switch (providerName) { case "MySql.Data.MySqlClient": paras.Add(new MySqlParameter("BranchID", table.BranchID)); paras.Add(new MySqlParameter("SchoolID", table.SchoolID)); paras.Add(new MySqlParameter("LastModified", table.LastModifiedDate)); break; default: paras.Add(new SqlParameter("BranchID", table.BranchID)); paras.Add(new SqlParameter("SchoolID", table.SchoolID)); paras.Add(new SqlParameter("LastModified", table.LastModified)); break; } List <OrderItems> list = OrderItemsBLL.Search(sqlStr, paras.ToArray()); if (list.Count > 0) { byte[] b = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b)) { CacheUtility.Insert(key, list); } else { if (CacheEnable == "true") { CacheUtility.Insert(key, list); } } } return(list); }
// TRICK: use from LTI ONLY!! public bool IsActive(int companyId) { var item = CacheUtility.GetCachedItem <CompanyCacheItem>(_cache, CachePolicies.Keys.IsActiveCompany(companyId), CachePolicies.Dependencies.IsActiveCompany(companyId), () => { var company = GetOneById(companyId).Value; DateTime?expiryDate = null; if (company.CurrentLicense != null) { expiryDate = company.CurrentLicense.ExpiryDate.ToUniversalTime(); } var result = new CompanyCacheItem { CompanyId = company.Id, IsActive = company.Status == CompanyStatus.Active, CurrentLicenseExpiryDateUtc = expiryDate, }; return(result); }); return(item.IsActive && item.CurrentLicenseExpiryDateUtc.HasValue && item.CurrentLicenseExpiryDateUtc.Value > DateTime.UtcNow); }
public List <SYNCOperation> GetList(TableObject table) { string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"]; string key = CacheUtility.GetKey(table); object obj = CacheUtility.Get(key); if (obj != null) { return((List <SYNCOperation>)obj); } string sqlStr = "select * from SYNCOperation where LastModified>@LastModified"; List <SqlParameter> pms = new List <SqlParameter>(); pms.Add(new SqlParameter("LastModified", table.LastModified)); List <SYNCOperation> list = SYNCOperationBLL.Search(sqlStr, pms.ToArray()); if (list.Count > 0) { byte[] b = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b)) { CacheUtility.Insert(key, list); } else { if (CacheEnable == "true") { CacheUtility.Insert(key, list); } } } return(list); }
public ActionResult ValidateLookupMaster(long lookupTypeId, long lookupMasterID = 0, string lookupMasterValue = "", int priority = 0) { try { CacheUtility.ClearCache(ConstantTexts.LookupMasterCacheKey); List <DOCMN_LookupMaster> lstDOCMN_LookupMaster = new List <DOCMN_LookupMaster>(); lstDOCMN_LookupMaster = CacheUtility.GetAllLookupsFromCache(lookupTypeId); if (lstDOCMN_LookupMaster.Where(xx => xx.LookupValue.ToUpper() == lookupMasterValue.ToUpper() && xx.CMN_LookupMasterId != lookupMasterID).Count() > 0) { return(Json(new { ID = 1, Message = "Lookup value already exists." })); } else if (lstDOCMN_LookupMaster.Where(xx => xx.DisplayOrder == priority && xx.CMN_LookupMasterId != lookupMasterID).Count() > 0) { return(Json(new { ID = 1, Message = "Priority value already exists." })); } return(Json(new { ID = 0, Message = "" })); } catch (Exception ex) { BLCommon.LogError(0, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Lookups, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); return(Json(new { ID = 1, Message = "An error occured while validating" })); } }
public virtual ActionResult Admin(string view = null, string code = null, string __provider__ = null, string __sid__ = null, string state = null, string providerKey = null) { if (__provider__ == "canvas" && !string.IsNullOrWhiteSpace(__sid__) && !string.IsNullOrWhiteSpace(code) && !string.IsNullOrWhiteSpace(state)) { //// crazy hack for canvas OAuth callback ??!! return(RedirectToAction("callback", "Lti", new { __provider__, __sid__, code, state, providerKey })); } else { var filePattern = (string)Settings.BuildSelector; var path = Server.MapPath("~/Content/swf/admin"); var version = CacheUtility.GetCachedItem(Cache, CachePolicies.Keys.VersionFileName(filePattern), () => _versionProcessor.ProcessVersion(path, filePattern)); var versionFileSwf = filePattern.Replace("*", version.ToString()); return(View( EdugameCloudT4.Home.Views.Admin, new HomeViewModel(this) { BuildUrl = Links.Content.swf.admin.Url(versionFileSwf) })); } }
/// <summary> /// 根据域名取得会员数据 /// </summary> /// <param name="domain">域名字符串</param> /// <returns></returns> public View_Members GetSingle(Uri uri) { var vm = CacheUtility.Get(uri.Host) as View_Members; if (vm == null) { using (var ct = new View_MembersDataContext(DbHelperSQL.Connection)) { View_Members vMember = ct.View_Members.SingleOrDefault(a => a.ID.ToString() == uri.Host.Split('.')[0].ToLower().Replace("shop", "")); if (vMember == null) { vMember = ct.View_Members.SingleOrDefault(a => a.HomePage == "http://" + uri.Host.ToLower()); } if (vMember != null) { CacheUtility.Insert(uri.Host, vMember, null, 20, CacheUtility.ExpiType.绝对过期); } return(vMember); } } else { return(vm); } }
public void ProcessRequest(HttpContext context) { //UrlDecode is neccessary to compensate encoding in ImageAdapter string imageUrl = HttpUtility.UrlDecode(context.Request["img"]); string w = context.Request["w"]; string h = context.Request["h"]; string m = context.Request["m"]; double width = 0; double.TryParse(w, out width); double height = 0; double.TryParse(h, out height); ImageResizeMode mode; switch (m) { case "Fill": mode = ImageResizeMode.Fill; break; case "Stretch": mode = ImageResizeMode.Stretch; break; default: mode = ImageResizeMode.Fit; break; } IFileSystem fs = N2.Context.Current.Resolve <IFileSystem>(); if (fs.FileExists(imageUrl)) { string path = context.Server.MapPath(imageUrl); if (CacheUtility.IsModifiedSince(context.Request, path)) { CacheUtility.NotModified(context.Response); } context.Response.ContentType = "image/jpeg"; string extension = VirtualPathUtility.GetExtension(imageUrl); ImageResizer ir = N2.Context.Current.Resolve <ImageResizer>(); CacheUtility.SetValidUntilExpires(context.Response, TimeSpan.FromDays(7)); using (var s = fs.OpenFile(imageUrl)) { var resized = ir.GetResizedBytes(s, extension, width, height, mode); context.Response.BinaryWrite(resized); } } else { throw new HttpException(404, "Not found"); } }
public T GetAndRemove <T>(string key) { var data = default(T); if (IsSuspended) { return(data); } if (_redis != null) { try { CacheUtility.EnsureCacheKey(ref key); data = (T)_binarySerializer.Deserialize(_redis.HashGet(CacheName, key), typeof(T)); if (data != null) { _redis.HashDelete(CacheName, key); ResetCacheStatus(); } } catch (Exception ex) { CatchCriticalError("GetAndRemove", _cacheName, key, ex); } } return(data); }
public void Add(string key, object data) { if (IsSuspended) { return; } if (_redis != null) { var retryTimes = 10; var counter = 0; //var m = Measure.StartNew(); CacheUtility.EnsureCacheKey(ref key); while (retryTimes > 0) { counter++; try { _redis.HashSet(CacheName, key, _binarySerializer.Serialize(data)); ResetCacheStatus(); retryTimes = 0; //m.LogDuration(counter + "Added "); } catch (Exception ex) { retryTimes = 0; CatchCriticalError("Add", _cacheName, key, ex); } } } }
public object Get(string key) { if (IsSuspended) { return(null); } if (_redis != null) { try { CacheUtility.EnsureCacheKey(ref key); var redisValue = _redis.HashGet(CacheName, key); ///if (string.IsNullOrEmpty(redisValue)) return null; if (!redisValue.HasValue) { return(null); } var data = _binarySerializer.Deserialize <object>(redisValue); ResetCacheStatus(); return(data); } catch (Exception ex) { CatchCriticalError("GetData", _cacheName, key, ex); } } return(null); }
public EGCVersionsDTO GetVersionInfo() { try { return(CacheUtility.GetCachedItem <EGCVersionsDTO>(Cache, CachePolicies.Keys.VersionInfo(), () => { string @base = string.Empty; DirectoryInfo parent; if ((parent = Directory.GetParent(HttpContext.Current.Server.MapPath("~"))) != null) { @base = parent.FullName; if (parent.EnumerateDirectories("EdugameCloud.Web").Any()) { @base = Path.Combine(@base, "EdugameCloud.Web"); } } var adminPath = @base + @"\Content\swf\admin"; var publicPath = @base + @"\Content\swf\pub"; var admin = this.ProcessVersion(adminPath, (string)this.Settings.BuildSelector); var @public = this.ProcessVersion(publicPath, (string)this.Settings.PublicBuildSelector); return new EGCVersionsDTO { adminVersion = admin.Return(x => new VersionDTO(admin), null), publicVersion = @public.Return(x => new VersionDTO(@public), null), }; })); } catch (Exception ex) { Logger.Error("Lookup.GetVersionInfo", ex); throw; } }
public void RemoveItemsFromList <T>(string cacheKey, List <T> entitys) { if (_redis != null) { try { CacheUtility.EnsureCacheKey(ref cacheKey); lock (SyncRoot3) { var list = _binarySerializer.Deserialize <List <T> >(_redis.HashGet(CacheName, cacheKey)); var newGuys = new List <T>(); newGuys.AddRange(list); foreach (object o in entitys) { foreach (var oneT in list) { if (o.Equals(oneT)) { newGuys.Remove(oneT); } } } _redis.HashSet(CacheName, cacheKey, _binarySerializer.Serialize(newGuys)); } ResetCacheStatus(); } catch (Exception ex) { CatchCriticalError("RemvoeItemsFromList", _cacheName, cacheKey, ex); } } }
protected virtual void EPActivity_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { var row = e.Row as EPActivity; if (row == null) { return; } var activity = DefaultEmailProcessor.GetParentOriginalActivity(this, (int)row.TaskID); if (activity != null) { GotoParentActivity.SetVisible(true); PXUIFieldAttribute.SetReadOnly <EPActivity.entityDescription>(cache, e.Row); var isMessageFailed = row.MPStatus == MailStatusListAttribute.Failed; row.EntityDescription = isMessageFailed ? CacheUtility.GetErrorDescription(row.Exception) : string.Empty; var helper = new EntityHelper(this); var entity = activity.RefNoteID.With(refNoteId => helper.GetEntityRow(refNoteId.Value)); if (entity != null) { row.EntityDescription += CacheUtility.GetDescription(helper, entity, entity.GetType()); } } else { GotoParentActivity.SetVisible(false); } }
public T Get<T>(string key) { CacheUtility.EnsureCacheKey(ref key); var dataObj = Get(key); return dataObj == null ? default(T) : (T)dataObj; }
/// <summary> /// Private method to save a attachment to actual folder path /// </summary> /// <param name="tempfilePath"></param> /// <param name="actualFilePath"></param> /// <returns></returns> private bool SaveFileToActualFolder(HttpPostedFileBase file, out string newFilePath) { bool isScucess = false; newFilePath = CacheUtility.GetMasterConfigurationByName(ConstantTexts.AttchmentFilePath); string basePath = string.Empty; try { FileInfo fi = new FileInfo(file.FileName); basePath = newFilePath + DateTime.Now.Year + "\\" + DateTime.Now.Month + "\\" + DateTime.Now.Day; newFilePath = Path.Combine(basePath, DateTime.Now.ToString("yyyyMMddHHmmss_") + fi.Name); if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } file.SaveAs(newFilePath); isScucess = true; } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Attachments, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); throw ex; } return(isScucess); }
private bool SaveFileToTempFolder(HttpPostedFileBase file, out string tempFilePath) { bool isUploadSuccess = false; try { tempFilePath = string.Empty; string webServerTempPath = CacheUtility.GetMasterConfigurationByName(ConstantTexts.webServerTempPath); //path tempFilePath = Path.Combine(webServerTempPath, DateTime.Now.ToString("yyyyMMddHHmmss_") + Path.GetFileName(file.FileName)); if (!Directory.Exists(webServerTempPath)) { Directory.CreateDirectory(webServerTempPath); } file.SaveAs(tempFilePath); isUploadSuccess = true; } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BulkUpload, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); isUploadSuccess = false; throw ex; } return(isUploadSuccess); }
private UIBulkUploadSearch PLoadBulkUpload() { long?TimeZone = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime; UIBulkUploadSearch objUIBulkUploadSearch = new UIBulkUploadSearch(); List <DOGEN_BulkImport> lstDOGEN_BulkImport = new List <DOGEN_BulkImport>(); errorMessage = string.Empty; try { long workBasketLkp = currentUser.WorkBasketLkup.ToInt64(); objUIBulkUploadSearch.WorkbasketLkup = workBasketLkp; objUIBulkUploadSearch.lstWorkbasket = CacheUtility.GetAllLookupsFromCache(LookupTypes.WorkBasket.ToInt64()); objUIBulkUploadSearch.lstDiscCategary = CacheUtility.GetAllLookupMasterCorrelationFromCache((long)LookupTypesCorrelation.WorkBasketVsDiscripancyCategory, workBasketLkp); objUIBulkUploadSearch.lstDOGEN_BulkImportExcelTemplateMaster = CacheUtility.GetBulkImportExcelTemplateFromCache().lstDOGEN_BulkImportExcelTemplateMaster.Where(x => x.TemplateTypeLkup == TemplateType.BulkUpload.ToInt64()).ToList(); objUIBulkUploadSearch.TemplateTypeLkup = TemplateType.BulkUpload.ToLong(); ExceptionTypes result = _objBLBulkUpload.GetBulkUploadSearchResult(TimeZone, objUIBulkUploadSearch, out lstDOGEN_BulkImport, out errorMessage); if (result != (long)ExceptionTypes.Success) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BulkUpload, (long)ExceptionTypes.Uncategorized, errorMessage, errorMessage); } objUIBulkUploadSearch.lstDOGEN_BulkImport = lstDOGEN_BulkImport; return(objUIBulkUploadSearch); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BulkUpload, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); throw ex; } }
/// <summary> /// Download template based on template ID /// </summary> /// <param name="templateMasterId"></param> /// <returns></returns> public FileResult DownloadTemplate(long templateMasterId) { byte[] fileBytes = null; string fileName = string.Empty; List <DOGEN_BulkImportExcelTemplateMaster> lstDOGEN_BulkImportExcelTemplateMaster = new List <DOGEN_BulkImportExcelTemplateMaster>(); try { lstDOGEN_BulkImportExcelTemplateMaster = CacheUtility.GetBulkImportExcelTemplateFromCache().lstDOGEN_BulkImportExcelTemplateMaster; if (lstDOGEN_BulkImportExcelTemplateMaster.Where(xx => xx.GEN_BulkImportExcelTemplateMasterId == templateMasterId && xx.IsActive == true).Count() > 0) { var item = lstDOGEN_BulkImportExcelTemplateMaster.Where(xx => xx.GEN_BulkImportExcelTemplateMasterId == templateMasterId && xx.IsActive == true).FirstOrDefault(); fileBytes = System.IO.File.ReadAllBytes(item.ExcelDirectoryPath + item.ExcelTemplateName); fileName = item.ExcelTemplateName; } return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName)); } catch (Exception ex) { BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.BulkUpload, (long)ExceptionTypes.Uncategorized, string.Empty, ex.ToString()); throw; } }
public List <T> GetAndRemoveList <T>(string key) { List <T> list = null; if (_redis != null) { CacheUtility.EnsureCacheKey(ref key); var retryTimes = 100; //var m = Measure.StartNew(); while (retryTimes > 0) { try { lock (SyncRoot2) { list = _binarySerializer.Deserialize <List <T> >(_redis.HashGet(CacheName, key)); _redis.HashDelete(CacheName, key); } retryTimes = 0; //m.LogDuration("GetAndLock/Remove " + key); } catch (Exception ex) { CatchCriticalError("GetAndRemove", _cacheName, key, ex); retryTimes = 0; } } } return(list); }
public object this[string key] { get { CacheUtility.EnsureCacheKey(ref key); return(Get(key)); } }
public override IEnumerable <TimeZone> GetAll() { return(CacheUtility.GetCachedItem <List <TimeZone> >(_cache, CachePolicies.Keys.TimeZones(), () => { var query = new DefaultQueryOver <TimeZone, int>().GetQueryOver().OrderBy(x => x.TimeZoneName).Asc; return this.Repository.FindAll(query).ToList(); })); }
public override IEnumerable <LmsQuestionType> GetAll() { return(CacheUtility.GetCachedItem(_cache, CachePolicies.Keys.LmsQuestionTypes(), () => { var query = new DefaultQueryOver <LmsQuestionType, int>().GetQueryOver(); return this.Repository.FindAll(query).ToList(); })); }
public override IEnumerable <SNMapProvider> GetAll() { return(CacheUtility.GetCachedItem <List <SNMapProvider> >(_cache, CachePolicies.Keys.SNMapProviders(), () => { var query = new DefaultQueryOver <SNMapProvider, int>().GetQueryOver().OrderBy(x => x.MapProvider).Asc; return this.Repository.FindAll(query).ToList(); })); }
// TRICK: uses cache! public override IEnumerable <LmsProvider> GetAll() { return(CacheUtility.GetCachedItem <List <LmsProvider> >(_cache, CachePolicies.Keys.LmsProviders(), () => { var queryOver = new DefaultQueryOver <LmsProvider, int>().GetQueryOver(); return Repository.FindAll(queryOver).ToList(); })); }
public object Get(string key) { CacheUtility.EnsureCacheKey(ref key); var dataObj = DataCache.Get(key); return dataObj == null ? null : _binarySerializer.Deserialize<object>(dataObj as byte[]); }
public List <JobSearch> GetList(TableObject table) { string CacheEnable = ConfigurationManager.AppSettings["CacheEnable"]; string key = CacheUtility.GetKey(table); object obj = CacheUtility.Get(key); if (obj != null) { return((List <JobSearch>)obj); } string sqlStr = "select * from JobSearch where BranchID=@BranchID and SchoolID=@SchoolID and LastModified>@LastModified"; List <DbParameter> paras = new List <DbParameter>(); string providerName = ConfigurationManager.ConnectionStrings["CloudOrganization"].ProviderName; switch (providerName) { case "MySql.Data.MySqlClient": paras.Add(new MySqlParameter("BranchID", table.BranchID)); paras.Add(new MySqlParameter("SchoolID", table.SchoolID)); paras.Add(new MySqlParameter("LastModified", table.LastModifiedDate)); break; default: paras.Add(new SqlParameter("BranchID", table.BranchID)); paras.Add(new SqlParameter("SchoolID", table.SchoolID)); paras.Add(new SqlParameter("LastModified", table.LastModified)); break; } //if (!string.IsNullOrEmpty(table.StartDate)) //{ // sqlStr += " and OperateTime>@StartDate"; // pms.Add(new MySqlParameter("StartDate", table.StartDate)); //} //if (!string.IsNullOrEmpty(table.EndDate)) //{ // sqlStr += " and OperateTime<@EndDate"; // pms.Add(new MySqlParameter("EndDate", table.EndDate)); //} List <JobSearch> list = JobSearchBLL.Search(sqlStr, paras.ToArray()); if (list.Count > 0) { byte[] b = new byte[8]; if (CacheUtility.GetCollectionKey(table.LastModified) == CacheUtility.GetCollectionKey(b)) { CacheUtility.Insert(key, list); } else { if (CacheEnable == "true") { CacheUtility.Insert(key, list); } } } return(list); }