public static Caches GetCaches() { Cache _cache = HttpRuntime.Cache; IDictionaryEnumerator cacheEnum = _cache.GetEnumerator(); CacheList cl = new CacheList(); cl = new CacheList(); while (cacheEnum.MoveNext()) { cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString())); } Caches rs = new Caches(); rs.CacheList = new CacheList(); cl.SortBy(CacheInfo.Columns.Key, true); rs.CacheList.AddRange(cl); rs.Total = cl.Count; return rs; }
protected override void ShowPage() { //pagetitle = "编辑帖子"; #region 判断是否是灌水 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); this.disablepostctrl = 0; if (admininfo != null) { disablepostctrl = admininfo.Disablepostctrl; } #endregion if (userid == -1) { forum = new ForumInfo(); topic = new TopicInfo(); postinfo = new PostInfo(); AddErrLine("您尚未登录"); return; } #region 获取帖子和主题相关信息 // 如果帖子ID非数字 if (postid == -1) { AddErrLine("无效的帖子ID"); return; } postinfo = Posts.GetPostInfo(topicid, postid); // 如果帖子不存在 if (postinfo == null) { AddErrLine("不存在的帖子ID"); return; } pagetitle = (postinfo.Title == "") ? "编辑帖子" : postinfo.Title; htmlon = postinfo.Htmlon; message = postinfo.Message; isfirstpost = postinfo.Layer == 0; // 获取主题ID if (topicid != postinfo.Tid || postinfo.Tid == -1) { AddErrLine("无效的主题ID"); return; } // 获取该主题的信息 topic = Topics.GetTopicInfo(postinfo.Tid); // 如果该主题不存在 if (topic == null) { AddErrLine("不存在的主题ID"); return; } if (topic.Special == 1 && postinfo.Layer == 0) { pollinfo = Polls.GetPollInfo(topic.Tid); polloptionlist = Polls.GetPollOptionList(topic.Tid); } if (topic.Special == 4 && postinfo.Layer == 0) { debateinfo = Debates.GetDebateTopic(topic.Tid); } #endregion #region 获取并检查版块信息 ///得到所在版块信息 forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepostctrl, usergroupinfo); // 如果该版块不存在 if (forum == null || forum.Layer == 0) { AddErrLine("版块已不存在"); forum = new ForumInfo(); return; } if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password")) { AddErrLine("本版块被管理员设置了密码"); SetBackLink(base.ShowForumAspxRewrite(forumid, 0)); return; } if (forum.Applytopictype == 1) //启用主题分类 { topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes); } customeditbuttons = Caches.GetCustomEditButtonList(); #endregion //是否有编辑帖子的权限 if (!UserAuthority.CanEditPost(postinfo, userid, useradminid, ref msg)) { AddErrLine(msg); return; } #region 附件信息绑定 //得到用户可以上传的文件类型 string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum); attachextensions = Attachments.GetAttachmentTypeArray(attachmentTypeSelect); attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect); //得到今天允许用户上传的附件总大小(字节) int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0); attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小 //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); userinfo = Users.GetShortUserInfo(userid); if (canpostattach && (config.Enablealbum == 1) && apb != null && (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0)) { caninsertalbum = true; albumlist = apb.GetSpaceAlbumByUserId(userid); } else { caninsertalbum = false; } attachmentlist = Attachments.GetAttachmentListByPid(postinfo.Pid); attachmentcount = attachmentlist.Rows.Count; //当前用户是否有允许下载附件权限 allowviewattach = UserAuthority.DownloadAttachment(forum, userid, usergroupinfo); #endregion smileyoff = (!DNTRequest.IsPost()) ? postinfo.Smileyoff : 1 - forum.Allowsmilies; allowimg = forum.Allowimgcode; parseurloff = postinfo.Parseurloff; bbcodeoff = (usergroupinfo.Allowcusbbcode == 1) ? postinfo.Bbcodeoff : 1; usesig = postinfo.Usesig; userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); if (bonusCreditsTrans > 0 && bonusCreditsTrans < 9) { bonusextcreditsinfo = Scoresets.GetScoreSet(bonusCreditsTrans); mybonustranscredits = Users.GetUserExtCredits(userid, bonusCreditsTrans); } //是否有访问当前版块的权限 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); return; } // 判断当前用户是否有修改权限, 检查是否具有版主的身份 if (!Moderators.IsModer(useradminid, userid, forumid)) { if (postinfo.Posterid != userid) { AddErrLine("你并非作者, 且你当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有修改该帖的权限"); return; } else if (config.Edittimelimit > 0 && Utils.StrDateDiffMinutes(postinfo.Postdatetime, config.Edittimelimit) > 0) { AddErrLine("抱歉, 系统规定只能在帖子发表" + config.Edittimelimit + "分钟内才可以修改"); return; } else if (config.Edittimelimit == -1) { AddErrLine("抱歉,系统不允许修改帖子"); return; } alloweditpost = true; } //如果当前用户就是作者或所在管理组有编辑的权限 else if (admininfo != null && admininfo.Alloweditpost == 1 && Moderators.IsModer(useradminid, userid, forumid)) { alloweditpost = true; } if (!alloweditpost && postinfo.Posterid != userid) { AddErrLine("您当前的身份没有编辑帖子的权限"); return; } #region htmltitle标题 if (postinfo.Layer == 0) { canhtmltitle = usergroupinfo.Allowhtmltitle == 1; } if (Topics.GetMagicValue(topic.Magic, MagicType.HtmlTitle) == 1) { htmltitle = Topics.GetHtmlTitle(topic.Tid).Replace("\"", "\\\"").Replace("'", "\\'"); } #endregion #region tag信息 enabletag = (config.Enabletag & forum.Allowtag) == 1; if (enabletag && Topics.GetMagicValue(topic.Magic, MagicType.TopicTag) == 1) { foreach (TagInfo tag in ForumTags.GetTagsListByTopic(topic.Tid)) { if (tag.Orderid > -1) { topictags += string.Format(" {0}", tag.Tagname); } } topictags = topictags.Trim(); } #endregion userGroupInfoList.Sort(delegate(UserGroupInfo x, UserGroupInfo y) { return((x.Readaccess - y.Readaccess) + (y.Groupid - x.Groupid)); }); //如果是提交... if (ispost) { SetBackLink("editpost.aspx?topicid=" + postinfo.Tid + "&postid=" + postinfo.Pid); if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } //设置相关帖子信息 SetPostInfo(admininfo, userinfo, Utils.StrToInt(DNTRequest.GetString("htmlon"), 0) == 1); if (IsErr()) { return; } //通过验证的用户可以编辑帖子 Posts.UpdatePost(postinfo); //设置附件相关信息 System.Text.StringBuilder sb = SetAttachmentInfo(); if (IsErr()) { return; } CreditsFacade.UpdateUserCredits(userid); #region 设置提示信息和跳转链接 string url = ""; //辩论地址 if (topic.Special == 4) { url = Urls.ShowTopicAspxRewrite(topic.Tid, pageid); } else if (DNTRequest.GetQueryString("referer") != "")//ajax快速回复将传递referer参数 { url = string.Format("showtopic.aspx?page=end&forumpage={2}&topicid={0}#{1}", topic.Tid, postinfo.Pid, forumpageid); } else if (pageid > 1)//如果不是ajax,则应该是带pageid的参数 { if (config.Aspxrewrite == 1) { url = string.Format("showtopic-{0}-{2}{1}#{3}", topic.Tid, config.Extname, pageid, postinfo.Pid); } else { url = string.Format("showtopic.aspx?topicid={0}&forumpage={3}&page={2}#{1}", topic.Tid, postinfo.Pid, pageid, forumpageid); } } else//如果都为空.就跳转到第一页(以免意外情况) { if (config.Aspxrewrite == 1) { url = string.Format("showtopic-{0}{1}", topic.Tid, config.Extname); } else { url = string.Format("showtopic.aspx?topicid={0}&forumpage={1}", topic.Tid, forumpageid); } } SetUrl(url); if (sb.Length > 0) { SetMetaRefresh(5); SetShowBackLink(true); if (infloat == 1) { AddErrLine(sb.ToString()); return; } else { sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>编辑帖子成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr>"); sb.Append("</table>"); AddMsgLine(sb.ToString()); } } else { //编辑主题和回复需要审核 if (postinfo.Layer == 0) { SetMetaRefresh(2, url); } else { SetMetaRefresh(); } SetShowBackLink(false); if (useradminid != 1 && (needaudit || topic.Displayorder == -2 || postinfo.Invisible == 1)) { if (postinfo.Layer == 0) { SetUrl(base.ShowForumAspxRewrite(forumid, forumpageid)); } else { SetUrl(base.ShowTopicAspxRewrite(topic.Tid, forumpageid)); } AddMsgLine("编辑成功, 但需要经过审核才可以显示"); } else { MsgForward("editpost_succeed"); AddMsgLine("编辑帖子成功, 返回该主题"); } } #endregion // 删除主题游客缓存 if (postinfo.Layer == 0) { ForumUtils.DeleteTopicCacheFile(topic.Tid); } } else { AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css"); } }
protected override void ShowPage() { //获取主题信息 topic = GetTopicInfo(); if (topic == null) { return; } topicid = topic.Tid; forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); if (forum == null) { AddErrLine("不存在的版块ID"); return; } //验证不通过则返回 if (!ValidateInfo() || IsErr()) { return; } //检查是否具有管理权限 IsModer(); int price = GetTopicPrice(topic); if (topic.Special == 0 && price > 0) { HttpContext.Current.Response.Redirect(forumpath + "buytopic.aspx?topicid=" + topic.Tid); return; } if (postid > 0 && Posts.GetPostInfo(topicid, postid) == null) { AddErrLine("该帖可能已被删除 " + string.Format("<a href=\"{0}\">[返回主题]</a>", ShowTopicAspxRewrite(topicid, 1))); return; } //将版块加入到已访问版块列表中 ForumUtils.SetVisitedForumsCookie(forumid.ToString()); if (userid > 0) { userInfo = Users.GetShortUserInfo(userid); } if (topic.Identify > 0) { topicidentify = Caches.GetTopicIdentify(topic.Identify); } pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name)); ///得到广告列表 GetForumAds(forum.Fid); //获取主题类型 Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes); topictypes = Utils.StrIsNullOrEmpty(topictypes) ? "" : "[" + topictypes + "]"; userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); score = Scoresets.GetValidScoreName(); scoreunit = Scoresets.GetValidScoreUnit(); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); //编辑器状态 EditorState(); string[] customauthorinfo = config.Customauthorinfo.Split('|'); postleftshow = customauthorinfo[0].Split(','); //帖子左边要显示的用户信息项目 userfaceshow = customauthorinfo[1].Split(','); //头像上方要显示的项目 //if (newpmcount > 0) // pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1); onlyauthor = (onlyauthor == "1" || onlyauthor == "2") ? onlyauthor : "0"; // 获取分页相关信息 BindPageCountAndId(); GetPostAds(GetPostPramsInfo(price), postlist.Count); #region 获取特殊主题相关信息 bonuslogs = Bonus.GetLogs(topic); if (topic.Special == 1)//获取投票信息 { GetPollInfo(); } if (topic.Special == 4) //获取辩论信息 { GetDebateInfo(); } #endregion enabletag = (config.Enabletag & forum.Allowtag) == 1; //if (enabletag) // relatedtopics = Topics.GetRelatedTopicList(topicid, 5); //更新页面Meta信息 if (postlist != null && postlist.Count > 0) { UpdateMetaInfo(Utils.RemoveHtml(postlist[0].Message)); } //判断是否需要生成游客缓存页面 IsGuestCachePage(); //更新主题查看次数和在线用户信息 TopicStats.Track(topicid, 1); Topics.MarkOldTopic(topic); topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0); OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title); //如果是从 if (DNTRequest.GetInt("fromfav", 0) > 0) { Favorites.UpdateUserFavoriteViewTime(userid, topicid); } //UserCredits.UpdateUserCredits(userInfo);此方法与后台积分设置中的条目不匹配,故注释 }
public override void InitCacheMapping(Dictionary <Type, Type> map) { base.InitCacheMapping(map); // override INLotSerialStatus cache to allow INTransitLineLotSerialStatus with projection work currectly with LSSelect<TLSMaster, TLSDetail, Where> Caches.AddCacheMapping(typeof(INLotSerialStatus), typeof(INLotSerialStatus)); }
public void GetDefaultNamespaceKeySuccess() { var aPod = Helpers.CreatePods(1).First(); Caches.MetaNamespaceKeyFunc(aPod).Should().Be($"{aPod.Metadata.NamespaceProperty}/{aPod.Metadata.Name}"); }
public void CheckDefaultDeletedFinalStateUnknown() { var aPod = Helpers.CreatePods(1).First(); Caches.DeletionHandlingMetaNamespaceKeyFunc(aPod).Should().Be($"{aPod.Metadata.NamespaceProperty}/{aPod.Metadata.Name}"); }
/// <summary> /// /// </summary> /// <param name="appendMode">是否为append模式,否则为new模式</param> /// <param name="localCsvExpiration">CacheData中本地csv文件的保鲜期(天数)</param> /// <param name="tag"></param> public List <T> fetchFromLocalCsvOrWindAndSaveAndCache(int localCsvExpiration, bool appendMode = false, String tag = null, string code = null) { if (tag == null) { tag = typeof(T).Name; } List <T> data = null; var filePathPattern = _buildCacheDataFilePath(tag, code, "*"); var todayFilePath = _buildCacheDataFilePath(tag, code, DateTime.Now.ToString("yyyyMMdd")); var dirPath = Path.GetDirectoryName(filePathPattern); var fileNamePattern = Path.GetFileName(filePathPattern); var allFilePaths = Directory.EnumerateFiles(dirPath, fileNamePattern) .OrderByDescending(fn => fn).ToList(); var lastestFilePath = (allFilePaths == null || allFilePaths.Count == 0) ? null : allFilePaths[0]; var daysdiff = FileUtils.GetCacheDataFileDaysPastTillToday(lastestFilePath); if (daysdiff > localCsvExpiration) { //CacheData太旧,需要远程更新,然后保存到本地CacheData目录 var txt = (daysdiff == int.MaxValue) ? "不存在" : "已过期" + daysdiff + "天"; log.Info("本地csv文件{0},尝试Wind读取新数据...", txt); try { data = readFromWind(); } catch (Exception e) { log.Error(e, "从Wind读取数据失败!"); } log.Info("正在保存新数据到本地..."); try { if (lastestFilePath == null) { //新增 saveToLocalCsvFile(data, todayFilePath, appendMode, tag); log.Debug("文件{0}已保存.", todayFilePath); } else { //修改 saveToLocalCsvFile(data, lastestFilePath, appendMode, tag); //重命名为最新日期 File.Move(lastestFilePath, todayFilePath); log.Debug("文件重命名为{0}", todayFilePath); } } catch (Exception e) { log.Error(e); } } else { //CacheData不是太旧,直接读取 log.Info("正在从本地csv文件{0}读取数据... ", lastestFilePath); try { data = readFromLocalCsv(lastestFilePath); } catch (Exception e) { log.Error(e, "从本地csv文件读取数据失败!"); } } if (data != null) { //加载到内存缓存 Caches.put(tag, data); log.Info("已将{0}加载到内存缓存.", tag); log.Info("获取{0}数据列表成功.共{1}行.", tag, data.Count); } else { log.Warn("没有任何内容可以缓存!"); } return(data); }
protected override void ShowPage() { pagetitle = "首页"; score = Scoresets.GetValidScoreName(); if (config.Rssstatus == 1) { AddLinkRss("tools/rss.aspx", string.Format("{0} 最新主题", config.Forumtitle)); } OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout); if (newpmcount > 0) { pmlist = PrivateMessages.GetPrivateMessageCollectionForIndex(userid, 5, 1, 1); } userinfo = new ShortUserInfo(); if (userid != -1) { userinfo = Discuz.Forum.Users.GetShortUserInfo(userid); if (userinfo.Newpm == 0) { base.newpmcount = 0; } lastvisit = userinfo.Lastvisit.ToString(); showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4; } Statistics.GetPostCountFromForum(0, out totaltopic, out totalpost, out todayposts); digesttopiclist = Focuses.GetDigestTopicList(16); hottopiclist = Focuses.GetHotTopicList(16, 30); forumlinklist = Caches.GetForumLinkList(); forumlinkcount = forumlinklist.Rows.Count; // 获得统计信息 totalusers = Utils.StrToInt(Statistics.GetStatisticsRowItem("totalusers"), 0); lastusername = Statistics.GetStatisticsRowItem("lastusername"); lastuserid = Utils.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"), 0); totalonline = onlineusercount; showforumonline = false; if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes") { showforumonline = true; onlineuserlist = OnlineUsers.GetOnlineUserList(onlineusercount, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser); onlineiconlist = Caches.GetOnlineGroupIconList(); } if (DNTRequest.GetString("showonline") == "no") { showforumonline = false; } highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount"); highestonlineusertime = Statistics.GetStatisticsRowItem("highestonlineusertime"); // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } ///得到广告列表 headerad = Advertisements.GetOneHeaderAd("indexad", 0); footerad = Advertisements.GetOneFooterAd("indexad", 0); pagewordad = Advertisements.GetPageWordAd("indexad", 0); doublead = Advertisements.GetDoubleAd("indexad", 0); floatad = Advertisements.GetFloatAd("indexad", 0); }
public string Act = ""; //获得操作步骤 protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-8")) { className = Utils.ChkSQL(HTTPRequest.GetString("className")); classID = HTTPRequest.GetInt("classID", 0); ProductFieldID = HTTPRequest.GetString("ProductFieldID"); Act = HTTPRequest.GetString("Act"); Caches.ReSet(); ProductFieldList = tbProductFieldInfo.GetProductFieldList(" ProductClassID = " + classID); if (ispost) { if (Act.IndexOf("getNode") > -1) { string _json = ""; for (int i = 0; i < ProductFieldList.Rows.Count; i++) { _json += "{'Field':{'ProductFieldID':" + ProductFieldList.Rows [i] ["ProductFieldID"].ToString() + "," + "'ProductClassID':" + ProductFieldList.Rows [i] ["ProductClassID"].ToString() + "," + "'ProductClassName':'" + ProductFieldList.Rows [i] ["ProductClassName"].ToString() + "'," + "'pfName':'" + ProductFieldList.Rows [i] ["pfName"].ToString() + "'," + "'pfType':" + ProductFieldList.Rows [i] ["pfType"].ToString() + "," + "'TypeName':'" + ProductFieldList.Rows [i] ["TypeName"].ToString() + "'," + "'pfOrder':" + ProductFieldList.Rows [i] ["pfOrder"].ToString() + "," + "'pfState':" + ProductFieldList.Rows [i] ["pfState"].ToString() + "," + "'pfAppendTime':'" + ProductFieldList.Rows [i] ["pfAppendTime"].ToString() + "'" + "}},"; } _json = _json.Trim() != "" ? _json.Trim().Substring(0, _json.Trim().Length - 1) : ""; Response.Write("{'FieldList':[" + _json + "]}"); Response.End(); } if (Act.IndexOf("del") > -1) { if (ProductFieldID != "") { try { tbProductFieldInfo.DeleteProductField(ProductFieldID); //记录删除商品 Logs.AddEventLog(this.userid, "删除" + ProductFieldID + "商品分类"); Response.Write("1"); Response.End(); } catch { Response.Write("0"); Response.End(); } } else { Response.Write("-1"); Response.End(); } } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
private void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { int @int = DNTRequest.GetInt("opnumber", 0); int num = -1; switch (@int) { case 1: //Caches.ReSetAdminGroupList(); num = 2; break; case 2: //Caches.ReSetUserGroupList(); num = 3; break; case 3: Caches.ReSetModeratorList(); num = 4; break; case 4: Caches.ReSetAnnouncementList(); Caches.ReSetSimplifiedAnnouncementList(); num = 5; break; case 5: Caches.ReSetSimplifiedAnnouncementList(); num = 6; break; case 6: Caches.ReSetForumListBoxOptions(); num = 7; break; case 7: Caches.ReSetSmiliesList(); num = 8; break; case 8: Caches.ReSetIconsList(); num = 9; break; case 9: Caches.ReSetCustomEditButtonList(); num = 10; break; case 10: num = 11; break; case 11: Caches.ReSetScoreset(); num = 12; break; case 12: Caches.ReSetSiteUrls(); num = 13; break; case 13: Caches.ReSetStatistics(); num = 14; break; case 14: Caches.ReSetAttachmentTypeArray(); num = 15; break; case 15: Caches.ReSetTemplateListBoxOptionsCache(); num = 16; break; case 16: //Caches.ReSetOnlineGroupIconList(); num = 17; break; case 17: Caches.ReSetForumLinkList(); num = 18; break; case 18: Caches.ReSetBanWordList(); num = 19; break; case 19: Caches.ReSetForumList(); num = 20; break; case 20: Caches.ReSetOnlineUserTable(); num = 21; break; case 21: Caches.ReSetRss(); num = 22; break; case 22: Caches.ReSetRssXml(); num = 23; break; case 23: Caches.ReSetValidTemplateIDList(); num = 24; break; case 24: Caches.ReSetValidScoreName(); num = 25; break; case 25: //Caches.ReSetMedalsList(); num = 26; break; case 26: Caches.ReSetDBlinkAndTablePrefix(); num = 27; break; case 27: //Caches.ReSetAllPostTableName(); num = 28; break; case 28: //Caches.ReSetLastPostTableName(); num = 29; break; case 29: Caches.ReSetAdsList(); num = 30; break; case 30: Caches.ReSetStatisticsSearchtime(); num = 31; break; case 31: Caches.ReSetStatisticsSearchcount(); num = 32; break; case 32: Caches.ReSetCommonAvatarList(); num = 33; break; case 33: Caches.ReSetJammer(); num = 34; break; case 34: Caches.ReSetMagicList(); num = 35; break; case 35: Caches.ReSetScorePaySet(); num = 36; break; case 36: //Caches.ReSetPostTableInfo(); num = 37; break; case 37: Caches.ReSetDigestTopicList(16); num = 38; break; case 38: Caches.ReSetHotTopicList(16, 30); num = 39; break; case 39: Caches.ReSetRecentTopicList(16); num = 40; break; case 40: Caches.EditDntConfig(); num = 41; break; case 41: Online.ResetOnlineList(); num = 42; break; case 42: Caches.ReSetNavPopupMenu(); num = -1; break; } base.Response.Write(num); base.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1.0); base.Response.Expires = -1; base.Response.End(); } }
protected override void ShowPage() { GetPostAds(forumid); if (userid > 0 && useradminid > 0) { AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid); if (admingroupinfo != null) { disablepostctrl = admingroupinfo.Disablepostctrl; } } #region 获取版块信息 if (forumid == -1) { AddLinkRss(forumpath + "tools/rss.aspx", "最新主题"); AddErrLine("无效的版块ID"); return; } forum = Forums.GetForumInfo(forumid); if (forum == null || forum.Fid < 1) { if (config.Rssstatus == 1) { AddLinkRss(forumpath + "tools/rss.aspx", Utils.EncodeHtml(config.Forumtitle) + " 最新主题"); } AddErrLine("不存在的版块ID"); return; } #endregion if (config.Rssstatus == 1) { AddLinkRss(forumpath + "tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新主题"); } if (JumpUrl(forum)) { return; } needaudit = UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo); // 检查是否具有版主的身份 if (useradminid > 0) { ismoder = Moderators.IsModer(useradminid, userid, forumid); } //设置搜索和排序条件 SetSearchCondition(); showforumlogin = IsShowForumLogin(forum); pagetitle = Utils.RemoveHtml(forum.Name); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); forumnav = ShowForumAspxRewrite(ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("\"showforum", "\"" + forumurl + "showforum"), forumid, pageid); topicextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans()); #region 主题分类设置 if (forum.Applytopictype == 1) //启用主题分类 { topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes); } if (forum.Viewbytopictype == 1) //允许按类别浏览 { topictypeselectlink = Forums.GetCurrentTopicTypesLink(forum.Fid, forum.Topictypes, forumurl + "showforum.aspx"); } #endregion //更新页面Meta中的keyword,description项, 提高SEO友好性 UpdateMetaInfo(Utils.StrIsNullOrEmpty(forum.Seokeywords) ? config.Seokeywords : forum.Seokeywords, Utils.StrIsNullOrEmpty(forum.Seodescription) ? forum.Description : forum.Seodescription, config.Seohead); //设置编辑器状态 SetEditorState(); #region 访问和发帖权限校验 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = userid == -1; return; } canposttopic = UserAuthority.PostAuthority(forum, usergroupinfo, userid, ref msg); // 如果当前用户非管理员并且论坛设定了禁止发帖时间段,当前时间如果在其中的一个时间段内,不允许用户发帖 if (useradminid != 1 && usergroupinfo.Disableperiodctrl != 1) { string visittime = ""; if (canposttopic && Scoresets.BetweenTime(config.Postbanperiods, out visittime)) { canposttopic = false; } isnewbie = UserAuthority.CheckNewbieSpan(userid); } //是否显示快速发主题编辑器(全局权限判定,版块权限判定,是否是游客,游客需要显示,登录用户是否允许发主题且已过新手见习期) if ((config.Fastpost == 1 || config.Fastpost == 3) && forum.Allowspecialonly <= 0 && (userid < 0 || (canposttopic && !isnewbie))) { canquickpost = true; } #endregion // 得到子版块列表 if (forum.Subforumcount > 0) { subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay); } if (!forum.Rules.Equals("")) { forum.Rules = UBB.ParseSimpleUBB(forum.Rules);//替换版规中的UBB } //获取主题总数 topiccount = Topics.GetTopicCount(forumid, true, condition); #region 设置分页及主题列表信息 // 得到Tpp设置 if (tpp <= 0) { tpp = config.Tpp; } // 得到Ppp设置 if (ppp <= 0) { ppp = config.Ppp; } //修正请求页数中可能的错误 if (pageid < 1) { pageid = 1; } int toptopicpagecount = 0; if (forum.Layer > 0) { //获取当前页置顶主题列表 DataRow dr = Topics.GetTopTopicListID(forumid); if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString())) { topiccount = topiccount + TypeConverter.ObjectToInt(dr["tid0Count"]); } //获取总页数 pagecount = topiccount % tpp == 0 ? topiccount / tpp : topiccount / tpp + 1; if (pagecount == 0) { pagecount = 1; } if (pageid > pagecount) { pageid = pagecount; } if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString())) { toptopiccount = TypeConverter.ObjectToInt(dr["tidCount"]); if (toptopiccount > tpp * (pageid - 1)) { toptopiclist = Topics.GetTopTopicList(forumid, tpp, pageid, dr["tid"].ToString(), forum.Autoclose, forum.Topictypeprefix); toptopicpagecount = toptopiccount / tpp; } if (toptopicpagecount >= pageid || (pageid == 1 && toptopicpagecount != toptopiccount)) { topiclist = GetTopicInfoList(tpp - toptopiccount % tpp, pageid - toptopicpagecount, 0); } else { topiclist = GetTopicInfoList(tpp, pageid - toptopicpagecount, toptopiccount % tpp); } } else { toptopicpagecount = 0; topiclist = GetTopicInfoList(tpp, pageid, 0); } //如果topiclist为空则更新当前论坛帖数 if (topiclist == null || topiclist.Count == 0 || topiclist.Count > topiccount) { Forums.SetRealCurrentTopics(forum.Fid); } SetPageNumber(); //当版块数大于一个并且当版块数量为一个时不是版块自身时显示下拉菜单 showvisitedforumsmenu = visitedforums != null && ((visitedforums.Length == 1 && visitedforums[0].Fid != forumid) || visitedforums.Length > 1); SetVisitedForumsCookie(); //保存查看版块的页数 Utils.WriteCookie("forumpageid", pageid.ToString(), 30); //判断是否需要生成游客缓存页面 IsGuestCachePage(); } #endregion #region 替换版规中的UBB forum.Description = UBB.ParseSimpleUBB(forum.Description); #endregion #region 更新在线信息 OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, forum.Name, -1, ""); if ((forumtotalonline < config.Maxonlinelist && (config.Whosonlinestatus == 2 || config.Whosonlinestatus == 3)) || DNTRequest.GetString("showonline") == "yes") { showforumonline = true; onlineuserlist = OnlineUsers.GetForumOnlineUserCollection(forumid, out forumtotalonline, out forumtotalonlineguest, out forumtotalonlineuser, out forumtotalonlineinvisibleuser); } //if (DNTRequest.GetString("showonline") != "no") //{ // showforumonline = false; //} if (DNTRequest.GetString("showonline") == "no") { showforumonline = false; } #endregion //修正版主列表 if (forum.Moderators.Trim() != "") { string moderHtml = string.Empty; foreach (string m in forum.Moderators.Split(',')) { moderHtml += string.Format("<a href=\"{0}userinfo.aspx?username={1}\">{2}</a>,", forumpath, Utils.UrlEncode(m), m); } forum.Moderators = moderHtml.TrimEnd(','); } ForumUtils.UpdateVisitedForumsOptions(forumid); }
protected override void ShowPage() { if (oluserinfo.Groupid == 4) { AddErrLine("你所在的用户组,为禁止发言"); return; } #region 临时帐号发帖 //int realuserid = -1; //bool tempaccountspost = false; //string tempusername = DNTRequest.GetString("tempusername"); //if (!Utils.StrIsNullOrEmpty(tempusername) && tempusername != username) //{ // realuserid = Users.CheckTempUserInfo(tempusername, DNTRequest.GetString("temppassword"), DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer")); // if (realuserid == -1) // { // AddErrLine("临时帐号登录失败,无法继续发帖。"); return; // } // else // { // userid = realuserid; // username = tempusername; // tempaccountspost = true; // } //} #endregion if (userid > 0) { userinfo = Users.GetShortUserInfo(userid); // if (userinfo != null) // { // usergroupinfo = UserGroups.GetUserGroupInfo(userinfo.Groupid); // usergroupid = usergroupinfo.Groupid; // useradminid = userinfo.Adminid; // } } #region 获取并检查版块信息 forum = Forums.GetForumInfo(forumid); if (forum == null || forum.Layer == 0) { forum = new ForumInfo();//如果不初始化对象,则会报错 allowposttopic = false; AddErrLine("错误的论坛ID"); return; } pagetitle = Utils.RemoveHtml(forum.Name); enabletag = (config.Enabletag & forum.Allowtag) == 1; if (forum.Applytopictype == 1) //启用主题分类 { topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes); } if (forum.Password != "" && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password")) { AddErrLine("本版块被管理员设置了密码"); SetBackLink(base.ShowForumAspxRewrite(forumid, 0)); return; } needaudit = UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo); smileyoff = 1 - forum.Allowsmilies; bbcodeoff = (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1) ? 0 : 1; allowimg = forum.Allowimgcode; customeditbuttons = Caches.GetCustomEditButtonList(); #endregion #region 访问和发帖权限校验 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = true; return; } if (!UserAuthority.PostAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = true; return; } #endregion #region 附件信息绑定 //得到用户可以上传的文件类型 string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum); attachextensions = Attachments.GetAttachmentTypeArray(attachmentTypeSelect); attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect); //得到今天允许用户上传的附件总大小(字节) int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0); attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小 //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); if (canpostattach && (userinfo != null && userinfo.Uid > 0) && apb != null && config.Enablealbum == 1 && (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0)) { caninsertalbum = true; albumlist = apb.GetSpaceAlbumByUserId(userid); } #endregion canhtmltitle = usergroupinfo.Allowhtmltitle == 1; #region 积分信息 creditstrans = Scoresets.GetTopicAttachCreditsTrans(); userextcreditsinfo = Scoresets.GetScoreSet(creditstrans); bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans()); #endregion #region 特殊主题权限判断 if (forum.Allowspecialonly > 0 && !Utils.InArray(type, "poll,bonus,debate")) { AddErrLine(string.Format("当前版块 \"{0}\" 不允许发表普通主题", forum.Name)); return; } if (!UserAuthority.PostSpecialAuthority(forum, type, ref msg)) { AddErrLine(msg); return; } if (!UserAuthority.PostSpecialAuthority(usergroupinfo, type, ref msg)) { AddErrLine(msg); needlogin = true; return; } if (type == "bonus") { int creditTrans = Scoresets.GetBonusCreditsTrans(); //当“交易积分设置”有效时(1-8的整数): if (creditTrans <= 0) { //AddErrLine(string.Format("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏", usergroupinfo.Grouptitle)); return; AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return; } mybonustranscredits = Users.GetUserExtCredits(userid, creditTrans); } userGroupInfoList.Sort(delegate(UserGroupInfo x, UserGroupInfo y) { return((x.Readaccess - y.Readaccess) + (y.Groupid - x.Groupid)); }); #endregion //发帖不受审核、过滤、灌水等限制权限 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); disablepost = admininfo != null ? admininfo.Disablepostctrl : usergroupinfo.Disableperiodctrl; //如果是提交... if (ispost) { #region 判断是否是灌水 if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg)) { AddErrLine(msg); return; } #endregion SetBackLink(string.Format("posttopic.aspx?forumid={0}&restore=1&type={1}", forumid, type)); ForumUtils.WriteCookie("postmessage", postmessage); #region 验证提交信息 //常规项验证 NormalValidate(admininfo, postmessage, userinfo); if (IsErr()) { return; } // 如果用户上传了附件,则检测用户是否有上传附件的权限 if (ForumUtils.IsPostFile()) { if (Utils.StrIsNullOrEmpty(Attachments.GetAttachmentTypeArray(attachmentTypeSelect))) { AddErrLine("系统不允许上传附件"); } if (!UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); } } //发悬赏校验 int topicprice = 0; bool isbonus = type == "bonus"; ValidateBonus(ref topicprice, ref isbonus); //发特殊主题校验 ValidatePollAndDebate(); if (IsErr()) { return; } #endregion int hide = (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) ? 1 : 0; TopicInfo topicinfo = CreateTopic(admininfo, postmessage, isbonus, topicprice); if (IsErr()) { return; } PostInfo postinfo = CreatePost(topicinfo); if (IsErr()) { return; } #region 处理附件 //处理附件 StringBuilder sb = new StringBuilder(); AttachmentInfo[] attachmentinfo = null; string attachId = DNTRequest.GetFormString("attachid"); if (!string.IsNullOrEmpty(attachId)) { attachmentinfo = Attachments.GetNoUsedAttachmentArray(userid, attachId); Attachments.UpdateAttachment(attachmentinfo, topicinfo.Tid, postinfo.Pid, postinfo, ref sb, userid, config, usergroupinfo); } //加入相册 if (config.Enablealbum == 1 && apb != null) { sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username)); } #endregion #region 添加日志的操作 SpacePluginBase spb = SpacePluginProvider.GetInstance(); if (DNTRequest.GetFormString("addtoblog") == "on" && spb != null) { if (userid != -1 && userinfo.Spaceid > 0) { spb.CreateTopic(topicinfo, postinfo, attachmentinfo); } else { AddMsgLine("您的个人空间尚未开通, 无法同时添加为日志"); } } #endregion OnlineUsers.UpdateAction(olid, UserAction.PostTopic.ActionID, forumid, forum.Name, -1, ""); #region 设置提示信息和跳转链接 if (sb.Length > 0) { SetUrl(base.ShowTopicAspxRewrite(topicinfo.Tid, 0)); SetMetaRefresh(5); SetShowBackLink(true); if (infloat == 1) { AddErrLine(sb.ToString()); return; } else { sb.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表主题成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr>"); AddMsgLine(sb.Append("</table>").ToString()); } } else { SetShowBackLink(false); if (useradminid != 1) { //是否需要审核 if (UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo) || topicinfo.Displayorder == -2) { ForumUtils.WriteCookie("postmessage", ""); SetLastPostedForumCookie(); SetUrl(base.ShowForumAspxRewrite(forumid, forumpageid)); SetMetaRefresh(); AddMsgLine("发表主题成功, 但需要经过审核才可以显示. 返回该版块"); } else { PostTopicSucceed(Forums.GetValues(forum.Postcredits), topicinfo, topicinfo.Tid); } } else { PostTopicSucceed(Forums.GetValues(forum.Postcredits), topicinfo, topicinfo.Tid); } } #endregion //ForumUtils.WriteCookie("postmessage", ""); //SetLastPostedForumCookie(); //如果已登录就不需要再登录 if (needlogin && userid > 0) { needlogin = false; } } else //非提交操作 { AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css"); } }
protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X")) { Act = HTTPRequest.GetString("Act"); if (!ispost) { if (Act == "recache") { BaseConfigs.ResetConfig(); GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Utils.GetMapPath(BaseConfigs.GetSysPath + "config/general.config")); Caches.ReSet(); AddMsgLine("已重建缓存."); AddScript("window.setTimeout('history.back(1);',2000);"); } else { ManageConfig = GeneralConfigs.GetConfig(); if (ManageConfig == null) { AddErrLine("获取配置信息发生错误.<br>"); } } } else { try { ManageConfig = GeneralConfigs.GetConfig(); ManageConfig.OrderID = HTTPRequest.GetString("OrderID"); ManageConfig.MoneyDecimal = HTTPRequest.GetInt("MoneyDecimal", 0); ManageConfig.QuantityDecimal = HTTPRequest.GetInt("QuantityDecimal", 0); ManageConfig.CompanyName = HTTPRequest.GetString("CompanyName"); ManageConfig.RegistrationNo = HTTPRequest.GetString("RegistrationNo"); ManageConfig.Address = HTTPRequest.GetString("Address"); ManageConfig.Phone = HTTPRequest.GetString("Phone"); ManageConfig.MonthlyStatementCode = HTTPRequest.GetString("MonthlyStatementCode"); ManageConfig.SupplierCode = HTTPRequest.GetString("SupplierCode"); ManageConfig.ReWorkedOrderNum = HTTPRequest.GetString("ReWorkedOrderNum"); //ManageConfig.CertificateCode = HTTPRequest.GetString("CertificateCode"); ManageConfig.PrinterName = HTTPRequest.GetString("PrinterName"); ManageConfig.PrintPageWidth = HTTPRequest.GetString("PrintPageWidth"); ManageConfig.PrintCertificatePageWidth = HTTPRequest.GetString("PrintCertificatePageWidth"); ManageConfig.CertificateRow = HTTPRequest.GetInt("CertificateRow", 0); ManageConfig.CertificateCodeLen = HTTPRequest.GetInt("CertificateCodeLen", 0); ManageConfig.PrintAddPageWidth = HTTPRequest.GetString("PrintAddPageWidth"); ManageConfig.PrintAddRow = HTTPRequest.GetInt("PrintAddRow", 0); ManageConfig.Taobao_Open = HTTPRequest.GetInt("Taobao_Open", 0); ManageConfig.Order_lock = HTTPRequest.GetInt("Order_lock", 0); ManageConfig.Certificate_lock = HTTPRequest.GetInt("Certificate_lock", 0); //ManageConfig.Taobao_AppKey = HTTPRequest.GetString("Taobao_AppKey"); //ManageConfig.Taobao_AppSecret = HTTPRequest.GetString("Taobao_AppSecret"); GeneralConfigs.Serialiaze(ManageConfig, Utils.GetMapPath(BaseConfigs.GetSysPath + "config/general.config")); Logs.AddEventLog(this.userid, "修改系统配置."); BaseConfigs.ResetConfig(); Caches.ReSet(); AddMsgLine("提交成功!"); SetBackLink("config.aspx?r=" + Utils.GetRanDomCode()); SetMetaRefresh(1, "config.aspx?r=" + Utils.GetRanDomCode()); } catch (Exception ex) { AddErrLine("提交时发生错误:<br>" + ex.Message.ToString()); } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
protected override void ShowPage() { pagetitle = "首页"; if (userid > 0 && useradminid > 0) { AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid); if (admingroupinfo != null) { disablepostctrl = admingroupinfo.Disablepostctrl; } } int toframe = DNTRequest.GetInt("f", 1); if (toframe == 0) { ForumUtils.WriteCookie("isframe", "1"); } else { toframe = Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1) == -1 ? config.Isframeshow : Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1); } if (toframe == 2) { HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "frame.aspx"); HttpContext.Current.Response.End(); return; } if (config.Rssstatus == 1) { AddLinkRss("tools/rss.aspx", "最新主题"); } OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout); //if (newpmcount > 0) // pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid,5,1,1); if (userid != -1) { userinfo = Users.GetShortUserInfo(userid); if (userinfo == null) { userid = -1; ForumUtils.ClearUserCookie("dnt"); } else { newpmcount = userinfo.Newpm == 0 ? 0 : newpmcount; lastvisit = userinfo.Lastvisit.ToString(); showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4; } } navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); forumlist = Forums.GetForumIndexCollection(config.Hideprivate, usergroupid, config.Moddisplay, out totaltopic, out totalpost, out todayposts); forumlinkcount = forumlinklist.Rows.Count; //个人空间控制 if (config.Enablespace == 1) { GetSpacePerm(); } // 获得统计信息 totalusers = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("totalusers")); lastusername = Statistics.GetStatisticsRowItem("lastusername").Trim(); lastuserid = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("lastuserid")); yesterdayposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("yesterdayposts")); highestposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestposts")); highestpostsdate = Statistics.GetStatisticsRowItem("highestpostsdate").ToString().Trim(); if (todayposts > highestposts) { highestposts = todayposts; highestpostsdate = DateTime.Now.ToString("yyyy-M-d"); } totalonline = onlineusercount; showforumonline = false; onlineiconlist = Caches.GetOnlineGroupIconList(); if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes") { showforumonline = true; //获得在线用户列表和图标 onlineuserlist = OnlineUsers.GetOnlineUserCollection(out totalonline, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser); } if (DNTRequest.GetString("showonline") == "no") { showforumonline = false; } highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount"); highestonlineusertime = DateTime.Parse(Statistics.GetStatisticsRowItem("highestonlineusertime")).ToString("yyyy-MM-dd HH:mm"); // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = announcementlist != null ? announcementlist.Rows.Count : 0; List <IndexPageForumInfo> topforum = new List <IndexPageForumInfo>(); foreach (IndexPageForumInfo f in forumlist) { f.Description = UBB.ParseSimpleUBB(f.Description); if (f.Layer == 0) { topforum.Add(f); } } taglist = config.Enabletag == 1 ? ForumTags.GetCachedHotForumTags(config.Hottagcount) : new TagInfo[0]; ///得到广告列表 headerad = Advertisements.GetOneHeaderAd("indexad", 0); footerad = Advertisements.GetOneFooterAd("indexad", 0); inforumad = Advertisements.GetInForumAd("indexad", 0, topforum, templatepath); pagewordad = Advertisements.GetPageWordAd("indexad", 0); doublead = Advertisements.GetDoubleAd("indexad", 0); floatad = Advertisements.GetFloatAd("indexad", 0); mediaad = Advertisements.GetMediaAd(templatepath, "indexad", 0); pagead = Advertisements.GetPageAd("indexad", 0); if (userid > 0) { if (oluserinfo.Newpms < 0) { Users.UpdateUserNewPMCount(userid, olid); } } }
protected virtual void Page_Load(object sender, EventArgs e) { Act = HTTPRequest.GetString("Act"); if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("7-2-1-5-6-1")) { if (CheckUserPopedoms("X") || CheckUserPopedoms("7-2-1-5-6-2")) { ShowPrice = true; } bDate = Convert.ToDateTime(((HTTPRequest.GetString("bDate").Trim() != "") ? Convert.ToDateTime(HTTPRequest.GetString("bDate").Trim()) : Convert.ToDateTime(DateTime.Now.Year + "-" + DateTime.Now.Month + "-1")).ToShortDateString() + " 00:00:00"); eDate = Convert.ToDateTime(((HTTPRequest.GetString("eDate").Trim() != "") ? Convert.ToDateTime(HTTPRequest.GetString("eDate").Trim()) : DateTime.Now).ToShortDateString() + " 23:59:59"); ProductID = HTTPRequest.GetInt("ProductID", 0); CostPrice = HTTPRequest.GetInt("CostPrice", 1); StorageID = HTTPRequest.GetInt("StorageID", 0); StorageClassName = Utils.ChkSQL(HTTPRequest.GetString("StorageClassName")); StorageClassNum = HTTPRequest.GetInt("StorageClassNum", 0); S_key = Utils.ChkSQL(HTTPRequest.GetString("S_key")); StorageList = tbStockProductInfo.getStorageNameByClass(StorageClassNum); StorageClassJson = Caches.GetStorageInfoToJson(-1, false, true); if (CostPrice == 1) { ShowPrice = false; } if (Act.IndexOf("Search") > -1) { dSet = Caches.GetProductLogDetails(bDate, eDate, ProductID, CostPrice, StorageID); if (dSet != null) { Product_UPYear = decimal.Parse(dSet.Tables[0].Rows[0][0].ToString()); dList = dSet.Tables[1]; //查询具体数据 yList = dSet.Tables[2]; //年累计 bList = dSet.Tables[3]; //开始月前半部分累计 eList = dSet.Tables[4]; //结束月后半部分累计 } } else { //导出 if (Act.IndexOf("Export") > -1) { dSet = Caches.GetProductLogDetails(bDate, eDate, ProductID, CostPrice, StorageID); if (dSet != null) { Product_UPYear = decimal.Parse(dSet.Tables[0].Rows[0][0].ToString()); dList = dSet.Tables[1]; //查询具体数据 yList = dSet.Tables[2]; //年累计 bList = dSet.Tables[3]; //开始月前半部分累计 eList = dSet.Tables[4]; //结束月后半部分累计 } } } } else { AddErrLine("权限不足!"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
private void SaveTopicType_Click(object sender, EventArgs e) { #region 保存主题分类编辑 //下四行取编辑行的更新值 int rowid = 0; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { string id = o.ToString(); string name = DataGrid1.GetControlValue(rowid, "name"); string displayorder = DataGrid1.GetControlValue(rowid, "displayorder"); string description = DataGrid1.GetControlValue(rowid, "description"); //判断主题分类表中是否有与要更新的重名 if (!CheckValue(name, displayorder, description) || TopicTypes.IsExistTopicType(name, int.Parse(id))) { error = true; continue; } //取得主题分类的缓存 Discuz.Common.Generic.SortedList <int, string> topictypearray = new Discuz.Common.Generic.SortedList <int, string>(); topictypearray = Caches.GetTopicTypeArray(); DataTable dt = Forums.GetExistTopicTypeOfForum(); DataTable topicTypes = TopicTypes.GetTopicTypes(); foreach (DataRow dr in dt.Rows) { //用新名更新dnt_forumfields表的topictypes字段 string topictypes = dr["topictypes"].ToString(); if (topictypes.Trim() == "") //如果主题列表为空则不处理 { continue; } string oldTopicType = GetTopicTypeString(topictypes, topictypearray[Int32.Parse(id)].ToString().Trim()); //获取修改名字前的旧主题列表 if (oldTopicType == "") //如果主题列表中不包含当前要修改的主题,则不处理 { continue; } string newTopicType = oldTopicType.Replace("," + topictypearray[Int32.Parse(id)].ToString().Trim() + ",", "," + name + ","); topictypes = topictypes.Replace(oldTopicType + "|", ""); //将旧的主题列表从论坛主题列表中删除 ArrayList topictypesal = new ArrayList(); foreach (string topictype in topictypes.Split('|')) { if (topictype != "") { topictypesal.Add(topictype); } } bool isInsert = false; for (int i = 0; i < topictypesal.Count; i++) { int curDisplayOrder = GetDisplayOrder(topictypesal[i].ToString().Split(',')[1], topicTypes); if (curDisplayOrder > int.Parse(displayorder)) { topictypesal.Insert(i, newTopicType); isInsert = true; break; } } if (!isInsert) { topictypesal.Add(newTopicType); } topictypes = ""; foreach (object t in topictypesal) { topictypes += t.ToString() + "|"; } TopicTypes.UpdateForumTopicType(topictypes, int.Parse(dr["fid"].ToString())); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TopicTypesOption" + dr["fid"].ToString()); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TopicTypesLink" + dr["fid"].ToString()); } //更新主题分类表(dnt_topictypes) TopicTypes.UpdateTopicTypes(name, int.Parse(displayorder), description, int.Parse(id)); rowid++; } //更新缓存 DNTCache cache = DNTCache.GetCacheService(); cache.RemoveObject("/Forum/TopicTypes"); cache.RemoveObject("/Forum/ForumList"); if (error) { base.RegisterStartupScript("", "<script>alert('数据库中已存在相同的主题分类名称或为空,该记录不能被更新!');window.location.href='forum_topictypesgrid.aspx';</script>"); } else { base.RegisterStartupScript("PAGE", "window.location.href='forum_topictypesgrid.aspx';"); } return; #endregion }
void GUIBundles() { var bundles = BundleManager.Instance.Bundles; if (bundles == null || bundles.Count == 0) { return; } GUILayout.BeginVertical("box"); if (BundleManager.Instance.HasUpdate() && GUILayout.Button("Download ALL")) { var handle = Addressables.DownloadDependenciesAsync(BundleManager.Instance.GetUpdateKeysAll(), Addressables.MergeMode.Union); if (DownloadingText) { AsyncOperationMonitor.Create(handle, (finish, percent) => { if (finish) { DownloadingText.text = $"Downloaded"; BundleManager.Instance.RefreshBundles(); cacheSize = Caches.GetAllCachedSize(); } else { DownloadingText.text = $"Downloading {percent:F2} %"; } }); } else { handle.Completed += (h) => { BundleManager.Instance.RefreshBundles(); cacheSize = Caches.GetAllCachedSize(); }; } } foreach (var bundle in bundles) { GUILayout.BeginHorizontal("box"); { if (GUILayout.Button(bundle.name) && bundle.size > 0) { Debug.Log($"Start Loading {bundle.key}"); var handle = Addressables.DownloadDependenciesAsync(bundle.key); if (DownloadingText) { DownloadingText.text = "Start"; AsyncOperationMonitor.Create(handle, (finish, percent) => { if (finish) { DownloadingText.text = $"{bundle.name} Downloaded"; BundleManager.Instance.RefreshBundles(); cacheSize = Caches.GetAllCachedSize(); // Release _aa resource Addressables.Release(handle.Result); } else { DownloadingText.text = $"{bundle.name} Downloading {percent:F2} %"; } }); } else { handle.Completed += (h) => { BundleManager.Instance.RefreshBundles(); cacheSize = Caches.GetAllCachedSize(); }; } } GUILayout.Label($"[ {bundle.size} ]"); if (!string.IsNullOrEmpty(bundle.bundleName)) { GUILayout.Button($"{bundle.bundleName.Substring(0, 6)}"); GUILayout.Button($"{bundle.bundleHash.Substring(0, 6)}"); } else { GUILayout.Label("no bundle name & hash"); } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); }
private static Caches GetCaches(bool isGetAll, int pageIndex, int pageSize, string sort, bool isAsc, string cacheKey, string cacheType) { Cache _cache = HttpRuntime.Cache; IDictionaryEnumerator cacheEnum = _cache.GetEnumerator(); CacheList cl = new CacheList(); cl = new CacheList(); while (cacheEnum.MoveNext()) { if (!string.IsNullOrEmpty(cacheKey) && cacheEnum.Key.ToString().ToUpper().IndexOf(cacheKey.ToUpper()) < 0) continue; if (!string.IsNullOrEmpty(cacheType) && cacheEnum.Value.GetType().ToString().ToUpper().IndexOf(cacheType.ToUpper()) < 0) continue; cl.Add(new CacheInfo(cacheEnum.Key.ToString(), cacheEnum.Value.GetType().ToString())); } Caches rs = new Caches(); rs.CacheList = new CacheList(); if (isGetAll) { cl.SortBy(sort, isAsc); rs.CacheList.AddRange(cl); } else rs.CacheList.AddRange(cl.GetPaging(pageSize, pageIndex, sort, isAsc)); rs.Total = cl.Count; return rs; }
public string Act = ""; //获得操作步骤 protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-5")) { className = HTTPRequest.GetString("className"); classID = HTTPRequest.GetInt("classID", -1); Act = HTTPRequest.GetString("Act"); Caches.ReSet(); //1.获得地区分类详情 pclass = tbRegionInfo.GetAreaDetails(classID); if (ispost) { if (Act.IndexOf("getNode") > -1) { string pid = ""; string pName = ""; string pOrder = ""; string pTime = ""; string pRarentID = ""; string pRarentName = ""; //当选择到节点是统计到该节点及子节点 if (classID > -1) { if (pclass.Rows.Count > 0) { for (int i = 0; i < pclass.Rows.Count; i++) { //2.获得表字段组成字符串 pid += pclass.Rows[i]["RegionID"].ToString() + ","; pName += pclass.Rows[i]["rName"].ToString() + ","; pOrder += pclass.Rows[i]["rOrder"].ToString() + ","; pTime += pclass.Rows[i]["rAppendTime"].ToString() + ","; pRarentID = pclass.Rows[i]["rUpID"].ToString(); } pid = pid.Substring(0, pid.Length - 1); pName = pName.Substring(0, pName.Length - 1); pOrder = pOrder.Substring(0, pOrder.Length - 1); pTime = pTime.Substring(0, pTime.Length - 1); } sTjson = "cDetails:{'pid':'" + pid + "','pname':'" + pName + "','porder':'" + pOrder + "','ptime':'" + pTime + "','parentID':'" + pRarentID + "'}"; Response.Write("{" + sTjson + "}"); Response.End(); } else { if (pclass.Rows.Count > 0) { //3.将重复的ID去掉 DataView dwv = new DataView(pclass); dwv.Sort = "rUpID"; pclass = dwv.ToTable(true, "rUpID"); DataTable dt = new DataTable(); DataSet ds = new DataSet(); for (int j = 0; j < pclass.Rows.Count; j++) { //4.获得地区上级分类信息 DataTable dtParent = tbRegionInfo.geAreaClassList(Convert.ToInt32(pclass.Rows[j]["rUpID"].ToString())); dt = dtParent.Copy(); dt.TableName = "td_" + j; ds.Tables.Add(dt); } pParent = ds.Tables[0].Clone(); //创建新表 克隆以有表的架构 object[] objArray = new object[pParent.Columns.Count]; //定义与表列数相同的对象数组 存放表的一行的值 for (int m = 0; m < ds.Tables.Count; m++) { if (ds.Tables[m].Rows.Count > 0) { for (int n = 0; n < ds.Tables[m].Rows.Count; n++) { ds.Tables[m].Rows[n].ItemArray.CopyTo(objArray, 0); //将表的一行的值存放数组中 pParent.Rows.Add(objArray); //将数组的值添加到新表中 } } } //5.整合表以后的字段拼接 for (int i = 0; i < pParent.Rows.Count; i++) { pid += pParent.Rows[i]["RegionID"].ToString() + ","; pName += pParent.Rows[i]["rName"].ToString() + ","; pOrder += pParent.Rows[i]["rOrder"].ToString() + ","; pTime += pParent.Rows[i]["rAppendTime"].ToString() + ","; pRarentID = pParent.Rows[i]["rUpID"].ToString(); pRarentName += pParent.Rows[i]["parentName"].ToString() + ","; } pid = pid.Substring(0, pid.Length - 1); pName = pName.Substring(0, pName.Length - 1); pOrder = pOrder.Substring(0, pOrder.Length - 1); pTime = pTime.Substring(0, pTime.Length - 1); pRarentName = pRarentName.Substring(0, pRarentName.Length - 1); } sTjson = "cDetails:{'pid':'" + pid + "','pname':'" + pName + "','porder':'" + pOrder + "','ptime':'" + pTime + "','parentID':'" + pRarentID + "','parentName':'" + pRarentName + "'}"; Response.Write("{" + sTjson + "}"); Response.End(); } } if (Act.IndexOf("del") > -1) { string trNode = HTTPRequest.GetString("trNode"); int count = 0; if (trNode != "") { if (trNode.IndexOf(",") > -1) { string[] trNodeBits = trNode.Split(','); for (int i = 0; i < trNodeBits.Length - 1; i++) { //6.删除操作(多个删除) count = tbRegionInfo.DeleteRegionInfo(Convert.ToInt32(trNodeBits[i].ToString())); } } else { //7.删除操作(单个删除) count = tbRegionInfo.DeleteRegionInfo(Convert.ToInt32(trNode)); } if (count > 0) { //记录成功操作 Logs.AddEventLog(this.userid, "删除" + trNode + "地区分类"); Response.Write("1"); Response.End(); } else { Response.Write("0"); Response.End(); } } else { Response.Write("-1"); Response.End(); } } } else { if (pclass.Rows.Count > 0) { //8.页面加载时候 DataView dwv = new DataView(pclass); dwv.Sort = "rUpID"; pclass = dwv.ToTable(true, "rUpID"); DataTable dt = new DataTable(); DataSet ds = new DataSet(); for (int j = 0; j < pclass.Rows.Count; j++) { //9.获得上级分类 DataTable dtParent = tbRegionInfo.geAreaClassList(Convert.ToInt32(pclass.Rows[j]["rUpID"].ToString())); dt = dtParent.Copy(); dt.TableName = "td_" + j; ds.Tables.Add(dt); } pParent = ds.Tables[0].Clone(); //创建新表 克隆以有表的架构 object[] objArray = new object[pParent.Columns.Count]; //定义与表列数相同的对象数组 存放表的一行的值 for (int m = 0; m < ds.Tables.Count; m++) { if (ds.Tables[m].Rows.Count > 0) { for (int n = 0; n < ds.Tables[m].Rows.Count; n++) { ds.Tables[m].Rows[n].ItemArray.CopyTo(objArray, 0); //将表的一行的值存放数组中 pParent.Rows.Add(objArray); //将数组的值添加到新表中 } } } } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存信息 if (this.CheckCookie()) { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); Hashtable HT = new Hashtable(); HT.Add("最大在线人数", maxonlines.Text); HT.Add("搜索时间限制", searchctrl.Text); foreach (DictionaryEntry de in HT) { if (!Utils.IsInt(de.Value.ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误:" + de.Key.ToString().Trim() + ",只能是0或者正整数');window.location.href='global_safecontrol.aspx';</script>"); return; } } if (fulltextsearch.SelectedValue == "1") { string msg = ""; configInfo.Fulltextsearch = Databases.TestFullTextIndex(ref msg); } else { configInfo.Fulltextsearch = 0; } configInfo.Nocacheheaders = Convert.ToInt16(nocacheheaders.SelectedValue); configInfo.Maxonlines = Convert.ToInt32(maxonlines.Text); configInfo.Searchctrl = Convert.ToInt32(searchctrl.Text); configInfo.Statscachelife = Convert.ToInt16(statscachelife.Text); configInfo.Guestcachepagetimeout = Convert.ToInt16(guestcachepagetimeout.Text); configInfo.Oltimespan = Convert.ToInt16(oltimespan.Text); configInfo.Topiccachemark = Convert.ToInt16(topiccachemark.Text); if (showauthorstatusinpost.SelectedValue == "1") { configInfo.Onlinetimeout = 0 - Convert.ToInt32(onlinetimeout.Text); } else { configInfo.Onlinetimeout = TypeConverter.StrToInt(onlinetimeout.Text); } //configInfo.Secques = Convert.ToInt32(secques.SelectedValue); //configInfo.Postinterval = Convert.ToInt32(postinterval.Text); //configInfo.Maxspm = Convert.ToInt32(maxspm.Text); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); Urls.config = configInfo; if (configInfo.Aspxrewrite == 1) { AdminForums.SetForumsPathList(true, configInfo.Extname); } else { AdminForums.SetForumsPathList(false, configInfo.Extname); } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); Discuz.Forum.TopicStats.SetQueueCount(); Caches.ReSetConfig(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "基本设置", ""); base.RegisterStartupScript("PAGE", "window.location.href='global_siteoptimization.aspx';"); } #endregion }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存设置信息 string[][] inputrule = new string[2][]; inputrule[0] = new string[] { losslessdel.Text, tpp.Text, ppp.Text, starthreshold.Text, hottopic.Text }; inputrule[1] = new string[] { "删帖不减积分时间", "每页主题数", "每页主题数", "星星升级阀值", "热门话题最低帖数" }; for (int j = 0; j < inputrule[0].Length; j++) { if (!Utils.IsInt(inputrule[0][j].ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误:" + inputrule[1][j].ToString() + ",只能是0或者正整数');window.location.href='forum_option.aspx';</script>"); return; } } if (Convert.ToInt32(losslessdel.Text) > 9999 || Convert.ToInt32(losslessdel.Text) < 0) { base.RegisterStartupScript("", "<script>alert('删帖不减积分时间期限只能在0-9999之间');window.location.href='forum_option.aspx';</script>"); return; } if (Convert.ToInt16(tpp.Text) > 100 || Convert.ToInt16(tpp.Text) <= 0) { base.RegisterStartupScript("", "<script>alert('每页主题数只能在1-100之间');window.location.href='forum_option.aspx';</script>"); return; } if (Convert.ToInt16(ppp.Text) > 100 || Convert.ToInt16(ppp.Text) <= 0) { base.RegisterStartupScript("", "<script>alert('每页帖子数只能在1-100之间');window.location.href='forum_option.aspx';</script>"); return; } if (Convert.ToInt16(starthreshold.Text) > 9999 || Convert.ToInt16(starthreshold.Text) < 0) { base.RegisterStartupScript("", "<script>alert('星星升级阀值只能在0-9999之间');window.location.href='forum_option.aspx';</script>"); return; } if (Convert.ToInt16(hottopic.Text) > 9999 || Convert.ToInt16(hottopic.Text) < 0) { base.RegisterStartupScript("", "<script>alert('热门话题最低帖数只能在0-9999之间');window.location.href='forum_option.aspx';</script>"); return; } if (Convert.ToInt16(hottagcount.Text) > 60 || Convert.ToInt16(hottagcount.Text) < 0) { base.RegisterStartupScript("", "<script>alert('首页热门标签(Tag)数量只能在0-60之间');window.location.href='forum_option.aspx';</script>"); } if (TypeConverter.StrToInt(viewnewtopicminute.Text) > 14400 || (TypeConverter.StrToInt(viewnewtopicminute.Text) < 5)) { base.RegisterStartupScript("", "<script>alert('查看新帖的设置必须在5-14400之间');window.location.href='global_uiandshowstyle.aspx';</script>"); return; } if (!ValidateRatevalveset(ratevalveset1.Text)) { return; } if (!ValidateRatevalveset(ratevalveset2.Text)) { return; } if (!ValidateRatevalveset(ratevalveset3.Text)) { return; } if (!ValidateRatevalveset(ratevalveset4.Text)) { return; } if (!ValidateRatevalveset(ratevalveset5.Text)) { return; } if (!(Convert.ToInt16(ratevalveset1.Text) < Convert.ToInt16(ratevalveset2.Text) && Convert.ToInt16(ratevalveset2.Text) < Convert.ToInt16(ratevalveset3.Text) && Convert.ToInt16(ratevalveset3.Text) < Convert.ToInt16(ratevalveset4.Text) && Convert.ToInt16(ratevalveset4.Text) < Convert.ToInt16(ratevalveset5.Text))) { base.RegisterStartupScript("", "<script>alert('评分阀值不是递增取值');window.location.href='forum_option.aspx';</script>"); return; } if (this.CheckCookie()) { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Modworkstatus = Convert.ToInt16(modworkstatus.SelectedValue); configInfo.Userstatusby = Convert.ToInt16(userstatusby.SelectedValue); configInfo.Rssttl = Convert.ToInt32(rssttl.Text); configInfo.Losslessdel = Convert.ToInt16(losslessdel.Text); configInfo.Editedby = Convert.ToInt16(editedby.SelectedValue); configInfo.Allowswitcheditor = Convert.ToInt16(allowswitcheditor.SelectedValue); configInfo.Reasonpm = Convert.ToInt16(reasonpm.SelectedValue); configInfo.Hottopic = Convert.ToInt16(hottopic.Text); configInfo.Starthreshold = Convert.ToInt16(starthreshold.Text); configInfo.Fastpost = Convert.ToInt16(fastpost.SelectedValue); configInfo.Tpp = Convert.ToInt16(tpp.Text); configInfo.Ppp = Convert.ToInt16(ppp.Text); configInfo.Enabletag = Convert.ToInt32(enabletag.SelectedValue); configInfo.Ratevalveset = ratevalveset1.Text + "," + ratevalveset2.Text + "," + ratevalveset3.Text + "," + ratevalveset4.Text + "," + ratevalveset5.Text; configInfo.Statstatus = Convert.ToInt16(statstatus.SelectedValue); configInfo.Hottagcount = Convert.ToInt16(hottagcount.Text); configInfo.Maxmodworksmonths = Convert.ToInt16(maxmodworksmonths.Text); configInfo.Replynotificationstatus = Convert.ToInt16(replynotificationstatus.SelectedValue); configInfo.Replyemailstatus = Convert.ToInt16(replyemailstatus.SelectedValue); //configInfo.Allwoforumindexpost = Convert.ToInt16(allowforumindexposts.SelectedValue);首页快速发主题的功能 configInfo.Viewnewtopicminute = TypeConverter.StrToInt(viewnewtopicminute.Text); configInfo.Quickforward = TypeConverter.StrToInt(quickforward.SelectedValue); configInfo.Msgforwardlist = msgforwardlist.Text.Replace("\r\n", ","); configInfo.Rssstatus = Convert.ToInt16(rssstatus.SelectedValue); configInfo.Cachelog = Convert.ToInt16(cachelog.SelectedValue); configInfo.Silverlight = Convert.ToInt16(silverlight.SelectedValue); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); Discuz.Forum.TopicStats.SetQueueCount(); Caches.ReSetConfig(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "站点功能", ""); base.RegisterStartupScript("PAGE", "window.location.href='forum_option.aspx';"); } #endregion }
public override void InitCacheMapping(Dictionary <Type, Type> map) { base.InitCacheMapping(map); Caches.AddCacheMappingsWithInheritance(this, typeof(BAccount)); }
public void GetDefaultNamespaceKeyNull() { Assert.Throws <ArgumentNullException>(() => { Caches.MetaNamespaceKeyFunc(null); }); }
IClient IClientBuilder.Build() { if (this.apiKey == null) { if (this.clientApiKeyBuilder != null) { this.apiKey = this.clientApiKeyBuilder.Build(); } else { throw new ApplicationException("No valid API Key and Secret could be found."); } } var logger = this.logger ?? new NullLogger(); IJsonSerializer serializer = null; if (this.overrideSerializer != null) { serializer = this.overrideSerializer; } else { if (this.serializerBuilder == null) { this.logger.Info("No serializer plugin specified, using default."); this.serializerBuilder = Serializers.Create().AutoDetect(); } serializer = this.serializerBuilder.Build(); } IHttpClient httpClient = null; if (this.overrideHttpClient != null) { httpClient = this.overrideHttpClient; } else { if (this.httpClientBuilder == null) { this.logger.Info("No HTTP client plugin specified, using default."); this.httpClientBuilder = HttpClients.Create().AutoDetect(); } this.httpClientBuilder .SetBaseUrl(this.baseUrl) .SetConnectionTimeout(this.connectionTimeout) .SetProxy(this.proxy) .SetLogger(this.logger); httpClient = this.httpClientBuilder.Build(); } if (this.cacheProvider == null) { this.logger.Info("No CacheProvider configured. Defaulting to in-memory CacheProvider with default TTL and TTI of one hour."); this.cacheProvider = Caches .NewInMemoryCacheProvider() .WithDefaultTimeToIdle(TimeSpan.FromHours(1)) .WithDefaultTimeToLive(TimeSpan.FromHours(1)) .Build(); } else { var injectableWithSerializer = this.cacheProvider as ISerializerConsumer <ICacheProvider>; if (injectableWithSerializer != null) { injectableWithSerializer.SetSerializer(serializer); } var injectableWithLogger = this.cacheProvider as ILoggerConsumer <ICacheProvider>; if (injectableWithLogger != null) { injectableWithLogger.SetLogger(this.logger); } } return(new DefaultClient( this.apiKey, this.baseUrl, this.authenticationScheme, this.connectionTimeout, this.proxy, httpClient, serializer, this.cacheProvider, this.userAgentBuilder, logger, DefaultIdentityMapSlidingExpiration)); }
public void GetDefaultNamespaceIndexNull() { Assert.Throws <ArgumentNullException>(() => { Caches.MetaNamespaceIndexFunc <V1Pod>(null); }); }
/// <summary> /// Initializes a new instance of the <see cref="ClearCachesAttribute" /> class. /// </summary> /// <param name="caches">The caches.</param> public ClearCachesAttribute(Caches caches) : this(caches, Clear.BeforeTest) { }
/// <summary> /// Gets the cache. /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> public VideoPublisher GetCache(int id) { return(Caches.FirstOrDefault(c => c.Id == id)); }
protected override void ShowPage() { #region 临时帐号发帖 //int realuserid = -1; //bool tempaccountspost = false; //string tempusername = DNTRequest.GetString("tempusername"); //if (!Utils.StrIsNullOrEmpty(tempusername) && tempusername != username) //{ // realuserid = Users.CheckTempUserInfo(tempusername, DNTRequest.GetString("temppassword"), DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer")); // if (realuserid == -1) // { // AddErrLine("临时帐号登录失败,无法继续发帖。"); // return; // } // else // { // userid = realuserid; // username = tempusername; // tempaccountspost = true; // } //} #endregion if (userid > 0) { userinfo = Users.GetShortUserInfo(userid); } #region 判断是否是灌水 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); if (admininfo != null) { disablepost = admininfo.Disablepostctrl; } if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg)) { if (continuereply != "") { AddErrLine("<b>回帖成功</b><br />由于" + msg + "后刷新继续"); } else { AddErrLine(msg); } return; } #endregion //获取主题帖信息 PostInfo postinfo = GetPostAndTopic(admininfo); if (IsErr()) { return; } forum = Forums.GetForumInfo(forumid); smileyoff = 1 - forum.Allowsmilies; bbcodeoff = (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1) ? 0 : 1; allowimg = forum.Allowimgcode; needaudit = UserAuthority.NeedAudit(forum, useradminid, topic, userid, disablepost, usergroupinfo); if (needaudit && topic.Displayorder == -2) { AddErrLine("主题尚未通过审核, 不能执行回复操作"); return; } #region 附件信息绑定 //得到用户可以上传的文件类型 string attachmentTypeSelect = Attachments.GetAllowAttachmentType(usergroupinfo, forum); attachextensions = Attachments.GetAttachmentTypeArray(attachmentTypeSelect); attachextensionsnosize = Attachments.GetAttachmentTypeString(attachmentTypeSelect); //得到今天允许用户上传的附件总大小(字节) int MaxTodaySize = (userid > 0 ? MaxTodaySize = Attachments.GetUploadFileSizeByuserid(userid) : 0); attachsize = usergroupinfo.Maxsizeperday - MaxTodaySize;//今天可上传得大小 //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); if (canpostattach && (userinfo != null && userinfo.Uid > 0) && apb != null && config.Enablealbum == 1 && (UserGroups.GetUserGroupInfo(userinfo.Groupid).Maxspacephotosize - apb.GetPhotoSizeByUserid(userid) > 0)) { caninsertalbum = true; albumlist = apb.GetSpaceAlbumByUserId(userid); } #endregion if (!Utils.StrIsNullOrEmpty(forum.Password) && Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid + "password")) { AddErrLine("本版块被管理员设置了密码"); SetBackLink(base.ShowForumAspxRewrite(forumid, 0)); return; } #region 访问和发帖权限校验 if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); needlogin = true; return; } if (!UserAuthority.PostReply(forum, userid, usergroupinfo, topic)) { AddErrLine(topic.Closed == 1 ? "主题已关闭无法回复" : "您没有发表回复的权限"); needlogin = (topic.Closed == 1 ? false : true); return; } if (!UserAuthority.CheckPostTimeSpan(usergroupinfo, admininfo, oluserinfo, userinfo, ref msg)) { AddErrLine(msg); return; } #endregion // 如果是受灌水限制用户, 则判断是否是灌水 if (admininfo != null) { disablepost = admininfo.Disablepostctrl; } if (forum.Templateid > 0) { templatepath = Templates.GetTemplateItem(forum.Templateid).Directory; } AddLinkCss(BaseConfigs.GetForumPath + "templates/" + templatepath + "/editor.css", "css"); customeditbuttons = Caches.GetCustomEditButtonList(); //如果是提交... if (ispost) { string backlink = (DNTRequest.GetInt("topicid", -1) > 0 ? string.Format("postreply.aspx?topicid={0}&restore=1&forumpage=" + forumpageid, topicid) : string.Format("postreply.aspx?postid={0}&restore=1&forumpage=" + forumpageid, postid)); if (!DNTRequest.GetString("quote").Equals("")) { backlink = string.Format("{0}"e={1}", backlink, DNTRequest.GetString("quote")); } SetBackLink(backlink); #region 验证提交信息 //常规项验证 NormalValidate(admininfo, postmessage, userinfo); if (IsErr()) { return; } #endregion //是否有上传附件的权限 canpostattach = UserAuthority.PostAttachAuthority(forum, usergroupinfo, userid, ref msg); // 产生新帖子 if (!string.IsNullOrEmpty(DNTRequest.GetFormString("toreplay_user").Trim())) { postmessage = DNTRequest.GetFormString("toreplay_user").Trim() + "\n\n" + postmessage; } postinfo = CreatePostInfo(postmessage); //获取被回复帖子的作者uid int replyUserid = postid > 0 ? Posts.GetPostInfo(topicid, postid).Posterid : postinfo.Posterid; postid = postinfo.Pid; if (IsErr()) { return; } #region 当回复成功后,发送通知 if (postinfo.Pid > 0 && DNTRequest.GetString("postreplynotice") == "on") { Notices.SendPostReplyNotice(postinfo, topic, replyUserid); } #endregion //向第三方应用同步数据 Sync.Reply(postid.ToString(), topic.Tid.ToString(), topic.Title, postinfo.Poster, postinfo.Posterid.ToString(), topic.Fid.ToString(), ""); //更新主题相关信息 //UpdateTopicInfo(postmessage); #region 处理附件 //处理附件 StringBuilder sb = new StringBuilder(); AttachmentInfo[] attachmentinfo = null; string attachId = DNTRequest.GetFormString("attachid"); if (!string.IsNullOrEmpty(attachId)) { attachmentinfo = Attachments.GetNoUsedAttachmentArray(userid, attachId); Attachments.UpdateAttachment(attachmentinfo, topic.Tid, postinfo.Pid, postinfo, ref sb, userid, config, usergroupinfo); } //加入相册 if (config.Enablealbum == 1 && apb != null) { sb.Append(apb.CreateAttachment(attachmentinfo, usergroupid, userid, username)); } #endregion OnlineUsers.UpdateAction(olid, UserAction.PostReply.ActionID, forumid, forum.Name, topicid, topictitle); #region 设置提示信息和跳转链接 //辩论地址 if (topic.Special == 4) { SetUrl(Urls.ShowDebateAspxRewrite(topicid)); } else if (infloat == 0)//此处加是否弹窗提交判断是因为在IE6下弹窗提交会造成gettopicinfo, getpostlist(位于showtopic页面)被提交了两次 { SetUrl(string.Format("showtopic.aspx?forumpage={0}&topicid={1}&page=end&jump=pid#{2}", forumpageid, topicid, postid)); } if (DNTRequest.GetFormString("continuereply") == "on") { SetUrl("postreply.aspx?topicid=" + topicid + "&forumpage=" + forumpageid + "&continuereply=yes"); } if (sb.Length > 0) { UpdateUserCredits(); SetMetaRefresh(5); SetShowBackLink(true); if (infloat == 1) { AddErrLine(sb.ToString()); return; } else { AddMsgLine("<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表回复成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr></table>"); } } else { SetMetaRefresh(); SetShowBackLink(false); //上面已经进行用户组判断 if (postinfo.Invisible == 1) { AddMsgLine(string.Format("发表回复成功, 但需要经过审核才可以显示. {0}<br /><br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name)); } else { UpdateUserCredits(); MsgForward("postreply_succeed"); AddMsgLine(string.Format("发表回复成功, {0}<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, 0) + "\">点击这里返回 {1}</a>)<br />", (DNTRequest.GetFormString("continuereply") == "on" ? "继续回复" : "返回该主题"), forum.Name)); } } #endregion // 删除主题游客缓存 if (topic.Replies < (config.Ppp + 10)) { ForumUtils.DeleteTopicCacheFile(topicid); } //发送邮件通知 if (DNTRequest.GetString("emailnotify") == "on" && topic.Posterid != -1 && topic.Posterid != userid) { SendNotifyEmail(Users.GetShortUserInfo(topic.Posterid).Email.Trim(), postinfo, Utils.GetRootUrl(BaseConfigs.GetForumPath) + string.Format("showtopic.aspx?topicid={0}&page=end&jump=pid#{1}", topicid, postid)); } } }
public void Handle_response(string id_, string jwtResponse, string expectedStatus, bool isNewAccount, string expectedState) { IAccountResult accountResultFromListener = null; var listener = new InlineIdSiteSyncResultListener( onAuthenticated: result => { if (expectedStatus == IdSiteResultStatus.Authenticated) { accountResultFromListener = result; } else { throw new InvalidOperationException("This method should not have been executed"); } }, onLogout: result => { if (expectedStatus == IdSiteResultStatus.Logout) { accountResultFromListener = result; } else { throw new InvalidOperationException("This method should not have been executed"); } }, onRegistered: result => { if (expectedStatus == IdSiteResultStatus.Registered) { accountResultFromListener = result; } else { throw new InvalidOperationException("This method should not have been executed"); } }); var testApiKey = ClientApiKeys.Builder().SetId("2EV70AHRTYF0JOA7OEFO3SM29").SetSecret("goPUHQMkS4dlKwl5wtbNd91I+UrRehCsEDJrIrMruK8").Build(); var fakeRequestExecutor = Substitute.For <IRequestExecutor>(); fakeRequestExecutor.ApiKey.Returns(testApiKey); this.dataStore = TestDataStore.Create(fakeRequestExecutor, Caches.NewInMemoryCacheProvider().Build()); var request = new DefaultHttpRequest(HttpMethod.Get, new CanonicalUri($"https://foo.bar?{IdSiteClaims.JwtResponse}={jwtResponse}")); IIdSiteSyncCallbackHandler callbackHandler = new DefaultIdSiteSyncCallbackHandler(this.dataStore, request); callbackHandler.SetResultListener(listener); var accountResult = callbackHandler.GetAccountResult(); // Validate result (accountResult as DefaultAccountResult).Account.Href.ShouldBe("https://api.stormpath.com/v1/accounts/7Ora8KfVDEIQP38KzrYdAs"); (accountResultFromListener as DefaultAccountResult).Account.Href.ShouldBe("https://api.stormpath.com/v1/accounts/7Ora8KfVDEIQP38KzrYdAs"); accountResult.IsNewAccount.ShouldBe(isNewAccount); accountResultFromListener.IsNewAccount.ShouldBe(isNewAccount); accountResult.State.ShouldBe(expectedState); accountResultFromListener.State.ShouldBe(expectedState); var expectedResultStatus = IdSiteResultStatus.Parse(expectedStatus); accountResult.Status.ShouldBe(expectedResultStatus); accountResultFromListener.Status.ShouldBe(expectedResultStatus); }
public bool ShowProductCostPrice = false; //是否显示成本 protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X")) { Act = HTTPRequest.GetString("Act"); //邮件校验码 if (HTTPRequest.GetString("rCode") != "") { Session ["r_Code"] = HTTPRequest.GetString("rCode"); } string _rCode = Session["r_Code"] != null?Convert.ToString(Session["r_Code"]) : ""; //邮件获取 string s_rCode = Session["s_r_Code"] != null?Convert.ToString(Session["s_r_Code"]) : ""; //本地校验 if (_rCode == "" || _rCode != s_rCode) { string s_r_Code = s_rCode.Trim() != ""?s_rCode: MakeCode(6); //生成6位验证码 if (Act == "SendCode") { Session ["s_r_Code"] = s_r_Code; UsersUtils.SendMailToEmail(config.ProductCostPriceCodeMail, "商品成本维护校验码", "请在10分钟内输入商品成本维护校验码:<b>" + s_r_Code + "</b>"); Response.ClearContent(); Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1); Response.Expires = 0; Response.Write("{state:true,msg:\"OK!\"}"); Response.End(); } if (Act.Trim() == "UpdatePrice") { Response.ClearContent(); Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1); Response.Expires = 0; Response.Write("{state:false,msg:\"No Code!\"}"); Response.End(); } else { ShowRCodeInput(s_r_Code); } //AddErrLine ("请输入授权码!"); } else { //仓库分类树 StorageClassJson = Caches.GetStorageInfoToJson(-1, false, true); Aclass = HTTPRequest.GetString("aclass"); if (Aclass.IndexOf("aclass") > -1) { string sID = ""; string sCode = ""; string sName = ""; //获得仓库分类编号 StorageClassID = HTTPRequest.GetString("sClassID"); //获得仓库名称、编号、系统编号 StorageName = tbStockProductInfo.getStorageNameByClass(Convert.ToInt32(StorageClassID)); for (int i = 0; i < StorageName.Rows.Count; i++) { if (StorageName.Rows [i] ["sState"].ToString() == "0") { sName += StorageName.Rows [i] ["sName"].ToString() + "(" + StorageName.Rows [i] ["sCode"].ToString() + ")" + ","; sID += StorageName.Rows [i] ["StorageID"].ToString() + ","; sCode += StorageName.Rows [i] ["sCode"].ToString() + ","; } } Response.ClearContent(); Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1); Response.Expires = 0; Response.Write("{sID:'" + sID + "',sCode:'" + sCode + "',sName:'" + sName + "'}"); Response.End(); } StorageID = HTTPRequest.GetInt("StorageID", 0); sDate = HTTPRequest.GetString("sDate").Trim() != "" ? Convert.ToDateTime(HTTPRequest.GetString("sDate").Trim() + " 23:59:59") : DateTime.Now; //显示列表 if (Act.Trim() != "") { className = HTTPRequest.GetString("StorageClassName").Trim(); StorageClassID = HTTPRequest.GetString("StorageClassNum"); if (StorageClassID == "") { AddMsgLine("请选择仓库类别后再进行查询!"); } else { priceList = tbProductPriceNOAuto.GetProductPriceNOAutoListNew("").Tables [0]; StorageName = tbStockProductInfo.getStorageNameByClass(Convert.ToInt32(StorageClassID)); if (StorageID == 0) { dList = tbProductsInfo.GetProductsStorageInfoByStorageID(Convert.ToInt32(StorageClassID), StorageID, sDate, ProductID); } else { dList = tbProductsInfo.GetProductsStorageInfoByStorageID(0, StorageID, sDate, ProductID); // DataUtils.GetStock_analysis(0, DateTime.Now, ProductID); } if (dList.Rows.Count > 0) { DataColumn dc = dList.Columns.Add("pPrice", Type.GetType("System.Decimal")); dc.DefaultValue = 0; DataColumn dc2 = dList.Columns.Add("pPriceRMB", Type.GetType("System.Decimal")); dc2.DefaultValue = 0; for (int k = 0; k < priceList.Rows.Count; k++) { for (int j = 0; j < dList.Rows.Count; j++) { if (dList.Rows [j] ["ProductsID"].ToString() == priceList.Rows [k] ["ProductsID"].ToString()) { dList.Rows [j] ["pPrice"] = Convert.ToDecimal(priceList.Rows [k] ["Price"]); dList.Rows [j] ["pPriceRMB"] = Convert.ToDecimal(priceList.Rows [k] ["PriceRMB"]); } } } dList.AcceptChanges(); } } } //更新成本 if (Act == "UpdatePrice") { ProductID = HTTPRequest.GetInt("ProductID", 0); Price = Convert.ToDecimal(HTTPRequest.GetFloat("Price", 0)); PriceRMB = Convert.ToDecimal(HTTPRequest.GetFloat("PriceRMB", 0)); if (ProductID > 0) { ProductPriceNOAutoInfo pp = new ProductPriceNOAutoInfo(); pp.ProductsID = ProductID; pp.Price = Price; pp.PriceRMB = PriceRMB; pp.ppAppendTime = DateTime.Now; if (tbProductPriceNOAuto.AddProductPriceNOAuto(pp) > 0) { Response.ClearContent(); Response.Buffer = true; Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1); Response.Expires = 0; Response.Write("{state:true,ProductsID:" + ProductID + ",Price:" + Price + "}"); Response.End(); } } } if (ispost) { Act = HTTPRequest.GetFormString("Act"); S_key = Utils.ChkSQL(HTTPRequest.GetFormString("S_key")); } else { S_key = Utils.ChkSQL(HTTPRequest.GetQueryString("S_key")); //导出 if (Act.IndexOf("Export") > -1) { DataTable dt = dList.Copy(); if (dt.Rows.Count > 0) { for (int j = 0; j < dt.Rows.Count; j++) { dt.Rows[j]["pStorage"] = (Convert.ToDecimal(dt.Rows[j]["pStorage"].ToString()) + Convert.ToDecimal(dt.Rows[j]["pStorageIn"].ToString()) - Convert.ToDecimal(dt.Rows[j]["pStorageOut"].ToString()) + Convert.ToDecimal(dt.Rows[j]["Beginning"].ToString())).ToString(); } dt.AcceptChanges(); dt.Columns.RemoveAt(0); dt.Columns.RemoveAt(0); dt.Columns.RemoveAt(6); dt.Columns.RemoveAt(6); dt.Columns.RemoveAt(6); dt.Columns.RemoveAt(7); DataSet dset = new DataSet(); dt.Columns["sName"].SetOrdinal(0); dset.Tables.Add(dt); dset.Tables[0].Columns[0].ColumnName = "仓库名称"; dset.Tables[0].Columns[1].ColumnName = "商品条码"; dset.Tables[0].Columns[2].ColumnName = "商品名称"; dset.Tables[0].Columns[3].ColumnName = "默认售价"; dset.Tables[0].Columns[4].ColumnName = "库存数量"; dset.Tables[0].Columns[5].ColumnName = "入库未核销"; dset.Tables[0].Columns[6].ColumnName = "出库未核销"; dset.Tables[0].Columns[7].ColumnName = "不可用库存"; dset.Tables[0].Columns[8].ColumnName = "成本(€)"; dset.Tables[0].Columns[9].ColumnName = "成本(¥)"; CreateExcel(dset.Tables[0], "Data_" + sDate.ToShortDateString() + ".xls"); } else { AddErrLine("请选择仓库类别后再进行查询!"); } } } } } else { AddErrLine("权限不足!"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
public ActionResult Edit(int?id = null) { //ViewBag.Facility = new FacilityModel().SelectListItems; //ViewBag.Scenics = new ScenicModel().SelectListItems; var result = new HotelCreateViewModel(); var model = _db.Hotel.Where(o => o.ID == id).FirstOrDefault(); #region ## 設施/景點 if (model != null && !string.IsNullOrEmpty(model.Facility)) { var chkoptions = model.Facility.Split(',').ToList(); var FacilityModel = new FacilityModel(); FacilityModel.SelectedItems = chkoptions; ViewBag.Facility = new FacilityModel().List(chkoptions); } else { ViewBag.Facility = new FacilityModel().SelectListItems; } if (model != null && !string.IsNullOrEmpty(model.Scenics)) { var chkScenics = model.Scenics.Split(',').ToList(); ViewBag.Scenics = new ScenicModel().List(chkScenics); } else { ViewBag.Scenics = new ScenicModel().SelectListItems; } #endregion if (id == null || model == null) { result.Information = new HtmlContent("/Views/Hotel/InformationTemp.html").Text; ViewBag.ImgKey = Guid.NewGuid().GetHashCode().ToString("x"); result.Enabled = true; result.SaleOff = true; return(View(result)); } result.ID = model.ID; result.Information = model.Information; result.Introduce = model.Introduce; result.Location = model.Location; result.Name = model.Name; result.Tel = model.Tel; result.WebSite = model.WebSite; result.Enabled = model.Enabled; result.Feature = model.Feature; result.Area = model.Area; result.City = model.City; result.Address = model.Address; result.SaleOff = model.SaleOff; result.Enabled = true; ViewBag.CurrentCity = model.City; ViewBag.CurrentArea = model.Area; ViewBag.CurrentLocation = model.Location; var SessionKey = Guid.NewGuid().GetHashCode().ToString("x"); ViewBag.ImgKey = SessionKey; var HotelImages = model.HotelImage.ToList(); Session[SessionKey] = HotelImages; ViewBag.HotelImg = HotelImages; var City = new Caches().TWCity; SelectList selectList = new SelectList(City, "ID", "Name", model.City); ViewBag.City = selectList; var Areas = new Caches().TWArea; //SelectList Areas = new SelectList(City, "ID", "Name", 0); var AreaList = Areas.Select(o => new DropDownListItem { DataAttr = o.CID.ToString(), Selected = model.Area <= 0 ? false : o.ID == model.Area, Text = o.Name, Value = o.ID.ToString() }).ToList(); ViewBag.Area = AreaList; var Location = new Caches().TWLocation; SelectList Locations = new SelectList(Location, "Location", "Location", model.Location); ViewBag.Location = Locations; return(View(result)); }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存信息 if (this.CheckCookie()) { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); Hashtable HT = new Hashtable(); HT.Add("最大在线人数", maxonlines.Text); HT.Add("搜索时间限制", searchctrl.Text); foreach (DictionaryEntry de in HT) { if (!Utils.IsInt(de.Value.ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误:" + de.Key.ToString().Trim() + ",只能是0或者正整数');window.location.href='global_safecontrol.aspx';</script>"); return; } } if (fulltextsearch.SelectedValue == "1") { string msg = ""; configInfo.Fulltextsearch = Databases.TestFullTextIndex(ref msg); } else { configInfo.Fulltextsearch = 0; } if (Topicqueuestats_1.Checked == true) { configInfo.TopicQueueStats = 1; } else { configInfo.TopicQueueStats = 0; } if (!Utils.IsInt(notificationreserveddays.Text) || Utils.StrToInt(notificationreserveddays.Text, -1) < 0) { base.RegisterStartupScript("", "<script>alert('通知保留天数只能为正数或0!');</script>"); return; } if (!Utils.IsInt(maxindexsubforumcount.Text) || Utils.StrToInt(maxindexsubforumcount.Text, -1) < 0) { base.RegisterStartupScript("", "<script>alert('首页每个分类下最多显示版块数只能为正数或0!');</script>"); return; } if (!Utils.IsInt(deletingexpireduserfrequency.Text) || Utils.StrToInt(deletingexpireduserfrequency.Text, 0) < 1) { base.RegisterStartupScript("", "<script>alert('删除离线用户频率只能为正数!');</script>"); return; } configInfo.Deletingexpireduserfrequency = Utils.StrToInt(deletingexpireduserfrequency.Text, 1); configInfo.Maxindexsubforumcount = Utils.StrToInt(maxindexsubforumcount.Text, 0); configInfo.Notificationreserveddays = Utils.StrToInt(notificationreserveddays.Text, 0); configInfo.TopicQueueStatsCount = Convert.ToInt32(topicqueuestatscount.Text); configInfo.Nocacheheaders = Convert.ToInt16(nocacheheaders.SelectedValue); configInfo.Maxonlines = Convert.ToInt32(maxonlines.Text); configInfo.Searchctrl = Convert.ToInt32(searchctrl.Text); configInfo.Statscachelife = Convert.ToInt16(statscachelife.Text); configInfo.Guestcachepagetimeout = Convert.ToInt16(guestcachepagetimeout.Text); configInfo.Oltimespan = Convert.ToInt16(oltimespan.Text); configInfo.Topiccachemark = Convert.ToInt16(topiccachemark.Text); configInfo.Onlineoptimization = Convert.ToInt32(onlineoptimization.SelectedValue); configInfo.AvatarMethod = Convert.ToInt16(avatarmethod.SelectedValue); //configInfo.Showattachmentpath = Convert.ToInt16(showattachmentpath.SelectedValue); configInfo.Showimgattachmode = Convert.ToInt16(showimgattachmode.SelectedValue); configInfo.TopicQueueStats = Topicqueuestats_1.Checked ? 1 : 0; configInfo.OnlineUserCountCacheMinute = Convert.ToInt32(onlineusercountcacheminute.Text); configInfo.PostTimeStorageMedia = Convert.ToInt32(posttimestoragemedia.SelectedValue); //如果帖子显示作者状态是简单判断,则保存无动作离线时间为负数值 configInfo.Onlinetimeout = showauthorstatusinpost.SelectedValue == "1" ? 0 - TypeConverter.StrToInt(onlinetimeout.Text) : TypeConverter.StrToInt(onlinetimeout.Text); configInfo.Jqueryurl = jqueryurl.Text; GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); if (configInfo.Aspxrewrite == 1) { AdminForums.SetForumsPathList(true, configInfo.Extname); } else { AdminForums.SetForumsPathList(false, configInfo.Extname); } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); Discuz.Forum.TopicStats.SetQueueCount(); Caches.ReSetConfig(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "站点优化", ""); base.RegisterStartupScript("PAGE", "window.location.href='global_siteoptimization.aspx';"); } #endregion }