private void EditIdentify_Click(object sender, EventArgs e) { int num = 0; bool flag = true; foreach (object item in this.identifygrid.GetKeyIDArray()) { //if (!Identifys.UpdateIdentifyById(int.Parse(item.ToString()), this.identifygrid.GetControlValue(num, "name"))) //{ // flag = false; //} var ti = TopicIdentify.FindByID(item.ToInt()); if (ti == null) { flag = false; } else { ti.Name = identifygrid.GetControlValue(num, "name"); ti.Update(); } num++; } AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件修改", ""); if (!flag) { base.RegisterStartupScript("", "<script>alert('某些记录未能更新,因为与原有的记录名称相同');window.location.href='forum_identifymanage.aspx';</script>"); return; } base.RegisterStartupScript("", "<script>window.location.href='forum_identifymanage.aspx';</script>"); }
public void SubmitButton_Click(object sender, EventArgs e) { bool flag = true; for (int i = 1; i <= this.fileList.Count; i++) { if (DNTRequest.GetFormString("id" + i) != "") { try { if (!TopicIdentify.Add(DNTRequest.GetString("name" + i), DNTRequest.GetString("file" + i))) { flag = false; } } catch { base.RegisterStartupScript("", "<script>alert('出现错误,可能名称超出长度!');window.location.href='forum_identifymanage.aspx';</script>"); } } } AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件增加", ""); if (!flag) { base.RegisterStartupScript("", "<script>alert('某些记录未能插入,因为与数据库中原有的名称相同');window.location.href='forum_identifymanage.aspx';</script>"); return; } base.RegisterStartupScript("", "<script>window.location.href='forum_identifymanage.aspx';</script>"); }
/// <summary> /// 获取主题签定集合项 /// </summary> /// <returns>主题签定集合项</returns> public static Discuz.Common.Generic.List <TopicIdentify> GetTopicIdentifyCollection() { DNTCache cache = DNTCache.GetCacheService(); Discuz.Common.Generic.List <TopicIdentify> topicidentifyList = cache.RetrieveObject("/Forum/TopicIdentifys") as Discuz.Common.Generic.List <TopicIdentify>; if (topicidentifyList == null) { topicidentifyList = new Discuz.Common.Generic.List <TopicIdentify>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopicsIdentifyItem(); StringBuilder jsArray = new StringBuilder("<script type='text/javascript'>var topicidentify = { "); while (reader.Read()) { TopicIdentify topic = new TopicIdentify(); topic.Identifyid = TypeConverter.ObjectToInt(reader["identifyid"]); topic.Name = reader["name"].ToString(); topic.Filename = reader["filename"].ToString(); topicidentifyList.Add(topic); jsArray.AppendFormat("'{0}':'{1}',", reader["identifyid"], reader["filename"]); } reader.Close(); jsArray.Remove(jsArray.Length - 1, 1); jsArray.Append("};</script>"); cache.AddObject("/Forum/TopicIdentifys", topicidentifyList); cache.AddObject("/Forum/TopicIndentifysJsArray", jsArray.ToString()); } return(topicidentifyList); }
private void AddIdentifyInfo_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (String.IsNullOrEmpty(this.uploadfile.FileName.Trim()) || String.IsNullOrEmpty(this.uploadfilesmall.FileName.Trim())) { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定图片');window.location.href='forum_addidentify.aspx';"); return; } string text = this.uploadfile.UpdateFile(); string text2 = this.uploadfilesmall.UpdateFile(); if (String.IsNullOrEmpty(text.Trim())) { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定大图片');window.location.href='forum_addidentify.aspx';"); return; } if (String.IsNullOrEmpty(text2.Trim())) { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定小图片');window.location.href='forum_addidentify.aspx';"); return; } if (TopicIdentify.Add(this.name.Text, text)) { string[] array = text.Split('.'); string str = string.Format("{0}_small.{1}", array[0], array[1]); Directory.Move(base.Server.MapPath("../../images/identify/") + text2, base.Server.MapPath("../../images/identify/") + str); XCache.Remove("/Forum/TopicIdentifys"); XCache.Remove("/Forum/TopicIndentifysJsArray"); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件添加", this.name.Text); base.RegisterStartupScript("PAGE", "window.location.href='forum_identifymanage.aspx';"); return; } base.RegisterStartupScript("PAGE", "alert('插入失败,可能名称与原有的相同');window.location.href='forum_identifymanage.aspx';"); } }
public void BindData() { this.identifygrid.AllowCustomPaging = false; this.identifygrid.TableHeaderName = "论坛鉴定列表"; this.identifygrid.DataKeyField = "ID"; //this.identifygrid.BindData(Identifys.GetAllIdentify()); this.identifygrid.BindData(TopicIdentify.FindAllWithCache().ToDataTable(false)); }
private void BindFilesList() { try { this.fileinfoList.Text = ""; this.fileList = this.GetIdentifyFileList(); //DataTable allIdentify = Identifys.GetAllIdentify(); //foreach (DataRow dataRow in allIdentify.Rows) //{ // StateBag viewState; // (viewState = this.ViewState)["code"] = viewState["code"] + "" + dataRow["name"] + ","; // string obj = dataRow["filename"].ToString(); // this.fileList.Remove(obj); //} var list = TopicIdentify.FindAllWithCache(); var sb = new StringBuilder(); foreach (var item in list) { //if (sb.Length > 0) sb.Append(","); sb.Append(item.Name); fileList.Remove(item.FileName); } ViewState["code"] += sb.ToString(); this.fileList.Remove("Thumbs.db"); int num = 1; foreach (string text in this.fileList) { Literal expr_E7 = this.fileinfoList; expr_E7.Text += "<tr class='mouseoutstyle' onmouseover='this.className=\"mouseoverstyle\"' onmouseout='this.className=\"mouseoutstyle\"' >\n"; Literal expr_102 = this.fileinfoList; object text2 = expr_102.Text; expr_102.Text = text2 + "<td nowrap='nowrap' style='border-color:#EAE9E1;border-width:1px;border-style:solid;width:50px;' align='center'><input type='checkbox' id='id" + num + "' name='id" + num + "' value='" + num + "'/></td>\n"; Literal expr_16C = this.fileinfoList; object text3 = expr_16C.Text; expr_16C.Text = text3 + "<td nowrap='nowrap' style='border-color:#EAE9E1;border-width:1px;border-style:solid;width:50px;' align='left'><input type='text' id='name" + num + "' name='name" + num + "' value='鉴定帖" + num + "' class=\"FormBase\" onfocus=\"this.className='FormFocus';\" onblur=\"this.className='FormBase';\" style='width:200px' /></td>\n"; Literal expr_1D6 = this.fileinfoList; object text4 = expr_1D6.Text; expr_1D6.Text = text4 + "<td nowrap='nowrap' style='border-color:#EAE9E1;border-width:1px;border-style:solid;width:50px;'><input type='hidden' name='file" + num + "' value='" + text + "' /><div id='ilayer" + num + "' onmouseover='showMenu(this.id,false)'>" + this.PicStr(text, 20) + "</div>"; Literal expr_255 = this.fileinfoList; object text5 = expr_255.Text; expr_255.Text = text5 + "<div id='ilayer" + num + "_menu' style='display:none'>" + this.PicStr(text) + "</div></td>\n"; Literal expr_2AE = this.fileinfoList; expr_2AE.Text += "</tr>\n"; num++; } this.SubmitButton.Visible = (this.fileList.Count != 0); } catch (IOException ex) { base.RegisterStartupScript("", "<script>alert('" + ex.Message + "');window.location.href='forum_identifymanage.aspx';</script>"); } }
private void DelRec_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (Request["id"] != "") { string id = Request["id"]; //Identifys.DeleteIdentify(id); var ti = TopicIdentify.FindByID(id.ToInt()); if (ti != null) { ti.Delete(); } AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件删除", id); base.Response.Redirect("forum_identifymanage.aspx"); return; } base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_identifymanage.aspx';</script>"); } }
protected override void ShowPage() { this.topic = base.GetTopicInfo(); if (this.topic == null) { return; } this.topicid = this.topic.ID; this.forumid = this.topic.Fid; this.forum = Forums.GetForumInfo(this.forumid); if (this.forum == null) { base.AddErrLine("不存在的版块ID"); return; } if (!base.ValidateInfo() || base.IsErr()) { return; } base.IsModer(); int topicPrice = this.GetTopicPrice(this.topic); if (this.topic.Special == 0 && topicPrice > 0) { HttpContext.Current.Response.Redirect(this.forumpath + "buytopic.aspx?topicid=" + this.topic.ID); return; } if (this.postid > 0 && Post.FindByID(this.postid) == null) { base.AddErrLine("该帖可能已被删除 " + string.Format("<a href=\"{0}\">[返回主题]</a>", base.ShowTopicAspxRewrite(this.topicid, 1))); return; } ForumUtils.SetVisitedForumsCookie(this.forumid.ToString()); if (this.userid > 0) { this.userInfo = BBX.Entity.User.FindByID(this.userid); } if (this.topic.Identify > 0) { this.topicidentify = TopicIdentify.FindByID(this.topic.Identify); } this.pagetitle = string.Format("{0} - {1}", this.topic.Title, Utils.RemoveHtml(this.forum.Name)); base.GetForumAds(this.forum.Fid); TopicType.GetTopicTypeArray().TryGetValue(this.topic.TypeID, out this.topictypes); this.topictypes = (this.topictypes.IsNullOrEmpty() ? "" : ("[" + this.topictypes + "]")); this.userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); this.score = Scoresets.GetValidScoreName(); this.scoreunit = Scoresets.GetValidScoreUnit(); this.navhomemenu = Caches.GetForumListMenuDivCache(this.usergroupid, this.userid, this.config.Extname); base.EditorState(); string[] array = this.config.Customauthorinfo.Split('|'); this.postleftshow = array[0].Split(','); this.userfaceshow = array[1].Split(','); this.onlyauthor = ((this.onlyauthor == "1" || this.onlyauthor == "2") ? this.onlyauthor : "0"); this.BindPageCountAndId(); base.GetPostAds(this.GetPostPramsInfo(topicPrice), this.postlist.Count); //this.bonuslogs = Bonus.GetLogs(this.topic); if (this.topic.Special == 3) { this.bonuslogs = BonusLog.GetLogs(this.topic.ID); } if (this.topic.Special == 1) { this.GetPollInfo(); } if (this.topic.Special == 4) { this.GetDebateInfo(); } this.enabletag = config.Enabletag && forum.AllowTag; if (this.postlist != null && this.postlist.Count > 0) { base.UpdateMetaInfo(Utils.RemoveHtml(this.postlist[0].Message)); } this.IsGuestCachePage(); //Topic.UpdateViewCount(this.topicid, 1); topic.Views++; topic.SaveAsync(10000); Topics.MarkOldTopic(this.topic); this.topicviews = this.topic.Views; Online.UpdateAction(this.olid, UserAction.ShowTopic, this.forumid, this.forum.Name, this.topicid, this.topic.Title); if (DNTRequest.GetInt("fromfav", 0) > 0) { //Favorites.UpdateUserFavoriteViewTime(this.userid, this.topicid); var fav = Favorite.FindByUidAndTid(userid, topicid); if (fav != null) { fav.ViewTime = DateTime.Now; fav.Update(); } } }