private string GetTopicType() { string text = this.forumInfo.TopicTypes + ""; int num = 0; var topicTypes = TopicType.FindAllWithCache().ToDataTable(); while (!(String.IsNullOrEmpty(DNTRequest.GetFormString("type" + num)))) { string type1 = DNTRequest.GetFormString("oldtopictype" + num); string type2 = DNTRequest.GetFormString("type" + num); if (type2 != "-1") { if (String.IsNullOrEmpty(type1)) { int displayOrder = this.GetDisplayOrder(type2.Split(',')[1], topicTypes); var list = new List <String>(text.Split("|")); bool flag = false; for (int j = 0; j < list.Count; j++) { int displayOrder2 = this.GetDisplayOrder(list[j].Split(',')[1], topicTypes); if (displayOrder2 > displayOrder) { list.Insert(j, type2); flag = true; break; } } if (!flag) { list.Add(type2); } text = ""; foreach (var item in list) { text = text + item + "|"; } } else { text = text.Replace(type1, type2); } } else { if (type1 != "") { text = text.Replace(type1, ""); } } //IL_215: num++; } return(text); }
private void SaveTopicType_Click(object sender, EventArgs e) { int num = 0; bool flag = false; foreach (object current in this.DataGrid1.GetKeyIDArray()) { string s = current.ToString(); Int32 typeid = Int32.Parse(s); string controlValue = this.DataGrid1.GetControlValue(num, "name"); string controlValue2 = this.DataGrid1.GetControlValue(num, "displayorder"); string controlValue3 = this.DataGrid1.GetControlValue(num, "description"); if (!this.CheckValue(controlValue, controlValue2, controlValue3) || TopicType.IsExist(controlValue, typeid)) { flag = true; } else { var sortedList = TopicType.GetTopicTypeArray(); //DataTable existTopicTypeOfForum = Forums.GetExistTopicTypeOfForum(); DataTable topicTypes = TopicType.FindAllWithCache().ToDataTable(); foreach (var item in XForum.Root.AllChilds) { var text = item.Field.TopicTypes + ""; if (String.IsNullOrEmpty(text.Trim())) { continue; } string topicTypeString = this.GetTopicTypeString(text, sortedList[typeid].ToString().Trim()); if (!(String.IsNullOrEmpty(topicTypeString))) { string value = topicTypeString.Replace("," + sortedList[typeid].ToString().Trim() + ",", "," + controlValue + ","); text = text.Replace(topicTypeString + "|", ""); ArrayList arrayList = new ArrayList(); string[] array = text.Split('|'); for (int i = 0; i < array.Length; i++) { string text2 = array[i]; if (text2 != "") { arrayList.Add(text2); } } bool flag2 = false; for (int j = 0; j < arrayList.Count; j++) { int displayOrder = this.GetDisplayOrder(arrayList[j].ToString().Split(',')[1], topicTypes); if (displayOrder > int.Parse(controlValue2)) { arrayList.Insert(j, value); flag2 = true; break; } } if (!flag2) { arrayList.Add(value); } text = ""; foreach (object current2 in arrayList) { text = text + current2.ToString() + "|"; } //TopicTypes.UpdateForumTopicType(text, int.Parse(dataRow["fid"].ToString())); //var ff = ForumField.FindByID(int.Parse(dataRow["fid"].ToString())); var ff = item.Field; if (ff != null) { ff.TopicTypes = text; ff.Save(); } XCache.Remove("/Forum/TopicTypesOption" + item.ID); XCache.Remove("/Forum/TopicTypesLink" + item.ID); } } //TopicTypes.UpdateTopicTypes(controlValue, int.Parse(controlValue2), controlValue3, typeid); var entity = TopicType.FindByID(typeid); if (entity != null) { entity.Name = controlValue; entity.DisplayOrder = Int32.Parse(controlValue); entity.Description = controlValue3; entity.Save(); } num++; } } //XCache.Remove("/Forum/TopicTypes"); XCache.Remove(CacheKeys.FORUM_FORUM_LIST); if (flag) { base.RegisterStartupScript("", "<script>alert('数据库中已存在相同的主题分类名称或为空,该记录不能被更新!');window.location.href='forum_topictypesgrid.aspx';</script>"); return; } base.RegisterStartupScript("PAGE", "window.location.href='forum_topictypesgrid.aspx';"); }
private void BindTopicType() { this.TopicTypeDataGrid.BindData(TopicType.FindAllWithCache().ToDataTable()); this.TopicTypeDataGrid.TableHeaderName = "当前版块: " + this.forumInfo.Name; }
private string GetTopicType() { string text = this.forumInfo.TopicTypes; int num = 0; DataTable topicTypes = TopicType.FindAllWithCache().ToDataTable(); while (!(String.IsNullOrEmpty(DNTRequest.GetFormString("type" + num)))) { if (DNTRequest.GetFormString("type" + num) != "-1") { string formString = DNTRequest.GetFormString("oldtopictype" + num); string formString2 = DNTRequest.GetFormString("type" + num); if (String.IsNullOrEmpty(formString)) { int displayOrder = this.GetDisplayOrder(formString2.Split(',')[1], topicTypes); ArrayList arrayList = new ArrayList(); string[] array = text.Split('|'); for (int i = 0; i < array.Length; i++) { string text2 = array[i]; if (text2 != "") { arrayList.Add(text2); } } bool flag = false; for (int j = 0; j < arrayList.Count; j++) { int displayOrder2 = this.GetDisplayOrder(arrayList[j].ToString().Split(',')[1], topicTypes); if (displayOrder2 > displayOrder) { arrayList.Insert(j, formString2); flag = true; break; } } if (!flag) { arrayList.Add(formString2); } text = ""; IEnumerator enumerator = arrayList.GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; text = text + current.ToString() + "|"; } goto IL_215; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } text = text.Replace(formString, formString2); } else { if (DNTRequest.GetFormString("oldtopictype" + num) != "") { text = text.Replace(DNTRequest.GetFormString("oldtopictype" + num), ""); } } IL_215: num++; } return(text); }