public string BuildGuestID() { string guestID; if (PageCacheUtil.TryGetValue <string>("GuestID_BX", out guestID) == false) { HttpCookie cookie = CookieUtil.Get("bbxmax_guest"); if (cookie != null) { guestID = cookie.Value; } else { guestID = string.Empty; } //必须是32位长度(GUID) if (guestID == null || guestID.Length != 32) { guestID = Guid.NewGuid().ToString("N"); CookieUtil.Set("bbxmax_guest", guestID, DateTime.MaxValue); } PageCacheUtil.Set("GuestID_BX", guestID); } if (guestID == string.Empty) { return(null); } return(guestID); }
public string PrizeDescription(string lineFormat, string separator) { string key = string.Format(prizeDescriptionKey, lineFormat, separator, this.Prize.ConvertToString()); string description; if (PageCacheUtil.TryGetValue <string>(key, out description) == false) { description = MissionBO.Instance.GetMissionPrizeDescription(this.Prize, lineFormat, separator); PageCacheUtil.Set(key, description); } return(description); }
private bool CheckFileSize(HttpContext context, string fileName, long fileSize) { Forum forum = GetForum(context); if (forum == null) { return(false); } AuthUser operatorUser = User.Current; ForumSettingItem forumSetting = AllSettings.Current.ForumSettings.Items.GetForumSettingItem(forum.ForumID); long maxSignleSize = forumSetting.MaxSignleAttachmentSize[operatorUser]; if (maxSignleSize == 0) { maxSignleSize = long.MaxValue; } if (fileSize > maxSignleSize) { WebEngine.Context.ThrowError <OverAttachmentMaxSingleFileSizeError>(new OverAttachmentMaxSingleFileSizeError(forum.ForumID, maxSignleSize, fileName, fileSize)); return(false); } long todayFileSize; if (!PageCacheUtil.TryGetValue <long>(Key_TodayTotalUsedFileSize, out todayFileSize)) { int todayCount; PostBOV5.Instance.GetUserTodayAttachmentInfo(operatorUser.UserID, null, out todayCount, out todayFileSize); } long maxTotalAttachmentsSizeInDay = AllSettings.Current.BbsSettings.MaxTotalAttachmentsSizeInDay[operatorUser]; if (maxTotalAttachmentsSizeInDay == 0) { maxTotalAttachmentsSizeInDay = long.MaxValue; } if (todayFileSize + fileSize > maxTotalAttachmentsSizeInDay) { WebEngine.Context.ThrowError <OverTodayAlowAttachmentFileSizeError>(new OverTodayAlowAttachmentFileSizeError("OverTodayAlowAttachmentFileSizeError", maxTotalAttachmentsSizeInDay, maxTotalAttachmentsSizeInDay - todayFileSize, fileSize)); return(false); } return(true); }
private FieldInfo[] GetFieldInfosWithTarget() { string cachekey = string.Format("PermissionSet/FieldInfos/{0}", typeof(TA2).Name); FieldInfo[] fieldInfos; if (PageCacheUtil.TryGetValue(cachekey, out fieldInfos) == false) { fieldInfos = typeof(TA2).GetFields(BindingFlags.Static | BindingFlags.Public); PageCacheUtil.Set(cachekey, fieldInfos); } return(fieldInfos); }