public override int CreateForum(string codeName, string forumName, int parentID, ForumType forumType, string password, string logoUrl , string themeID, string readme, string description, ThreadCatalogStatus threadCatalogStaus, int columnSpan, int sortOrder , ForumExtendedAttribute forumExtendedDatas, out int forumID) { using (SqlQuery query = new SqlQuery()) { query.CommandText = "bx_v5_CreateForum"; query.CommandType = CommandType.StoredProcedure; query.CreateParameter <string>("@CodeName", codeName, SqlDbType.NVarChar, 128); query.CreateParameter <string>("@ForumName", forumName, SqlDbType.NVarChar, 1024); query.CreateParameter <int>("@ParentID", parentID, SqlDbType.Int); query.CreateParameter <int>("@ForumType", (int)forumType, SqlDbType.TinyInt); query.CreateParameter <string>("@Password", password, SqlDbType.NVarChar, 64); query.CreateParameter <string>("@LogoUrl", logoUrl, SqlDbType.NVarChar, 256); query.CreateParameter <string>("@ThemeID", themeID, SqlDbType.NVarChar, 64); query.CreateParameter <string>("@Readme", readme, SqlDbType.NText); query.CreateParameter <string>("@Description", description, SqlDbType.NText); query.CreateParameter <int>("@ThreadCatalogStatus", (int)threadCatalogStaus, SqlDbType.TinyInt); query.CreateParameter <int>("@ColumnSpan", columnSpan, SqlDbType.TinyInt); query.CreateParameter <int>("@SortOrder", sortOrder, SqlDbType.Int); query.CreateParameter <string>("@ExtendedAttributes", forumExtendedDatas.ToString(), SqlDbType.NText); query.CreateParameter <int>("@ForumID", SqlDbType.Int, ParameterDirection.Output); query.CreateParameter <int>("@ErrorCode", SqlDbType.Int, ParameterDirection.ReturnValue); query.ExecuteNonQuery(); forumID = (int)query.Parameters["@ForumID"].Value; return((int)query.Parameters["@ErrorCode"].Value); } }
public bool CreateForum(AuthUser operatorUser, string codeName, string forumName, int parentID, ForumType forumType, string password, string logoSrc , string themeID, string readme, string description, ThreadCatalogStatus threadCatalogStaus, int columnSpan, int sortOrder , ForumExtendedAttribute forumExtendedDatas, out int forumID) { forumID = 0; if (!AllSettings.Current.BackendPermissions.Can(operatorUser, BackendPermissions.Action.Manage_Forum)) { ThrowError <NoPermissionManageForumError>(new NoPermissionManageForumError(0)); return(false); } if (false == ValidateForumParams(codeName, forumName, parentID, forumType, password, logoSrc, themeID)) { return(false); } int result = ForumDaoV5.Instance.CreateForum(codeName, forumName, parentID, forumType, password, logoSrc, themeID, readme, description, threadCatalogStaus, columnSpan, sortOrder, forumExtendedDatas, out forumID); switch (result) { case 13: ThrowError <DuplicateForumCodeNameError>(new DuplicateForumCodeNameError("codename", codeName)); return(false); case -1: ThrowError <ParentForumNotExistsError>(new ParentForumNotExistsError("parentID")); return(false); default: break; } ClearAllCache(); ThreadCachePool.ClearAllCache(); return(true); }
public bool UpdateForum(AuthUser operatorUser, int forumID, string codeName, string forumName, ForumType forumType, string password, string logoSrc , string readme, string description, string themeID, int columnSpan, int sortOrder, ForumExtendedAttribute forumExtendedDatas) { if (!AllSettings.Current.BackendPermissions.Can(operatorUser, BackendPermissions.Action.Manage_Forum)) { ThrowError <NoPermissionManageForumError>(new NoPermissionManageForumError(forumID)); return(false); } if (false == ValidateForumParams(codeName, forumName, null, forumType, password, logoSrc, themeID)) { return(false); } int result = ForumDaoV5.Instance.UpdateForum(forumID, codeName, forumName, forumType, password, logoSrc, readme, description, themeID, columnSpan, sortOrder, forumExtendedDatas); switch (result) { case 13: ThrowError <DuplicateForumCodeNameError>(new DuplicateForumCodeNameError("codename", codeName)); return(false); default: break; } ClearAllCache(); ThreadCachePool.ClearAllCache(); return(true); }
private void SaveForum() { m_IsSuccess = false; MessageDisplay message = CreateMessageDisplay("codeName", "forumName", "parentID", "forumType", "logoSrc", "themeID", "password" , "DisplayInList", "new_DisplayInList", "VisitForum", "new_VisitForum", "SigninForumWithoutPassword", "new_SigninForumWithoutPassword"); string codeName = _Request.Get("codeName", Method.Post, string.Empty); string forumName = _Request.Get("forumName", Method.Post, string.Empty, false); int sortOrder = _Request.Get <int>("sortorder", Method.Post, 0); ForumType forumType = _Request.Get <ForumType>("forumType", Method.Post, ForumType.Normal); string password; if (forumType == ForumType.Link) { password = _Request.Get("forumLink", Method.Post, string.Empty, false); if (password.Trim() == string.Empty) { message.AddError("password", "请填写链接地址"); } } else { password = _Request.Get("password", Method.Post, string.Empty); } int columnSpan = _Request.Get <int>("colSpan", Method.Post, 0); int parentID; if (forumType == ForumType.Catalog) { parentID = 0; } else { if (IsEdit) { parentID = Forum.ParentID; } else { parentID = _Request.Get <int>("parentForum", Method.Post, 0); } } string description = StringUtil.Trim(_Request.Get("Description", Method.Post, string.Empty, false)); string readme = StringUtil.Trim(_Request.Get("readme", Method.Post, string.Empty, false)); string logoSrc = _Request.Get("logo", Method.Post, string.Empty); string themeID = _Request.Get("theme", Method.Post, string.Empty); ThreadCatalogStatus threadCatalogStatus; if (IsEdit) { threadCatalogStatus = Forum.ThreadCatalogStatus; } else { threadCatalogStatus = ThreadCatalogStatus.DisEnable; } ForumExtendedAttribute extendedDatas = new ForumExtendedAttribute(); extendedDatas.LinkOpenByNewWidow = _Request.Get <bool>("linktype", Method.Post, false); //extendedDatas.AllowGuestVisitForum = _Request.Get<bool>("AllowGuestVisitForum", Method.Post, true); //extendedDatas.DisplayInListForGuest = _Request.Get<bool>("DisplayInListForGuest", Method.Post, true); //extendedDatas.DisplayInList = new ExceptableSetting.ExceptableItem_bool().GetExceptable("DisplayInList", message); //extendedDatas.VisitForum = new ExceptableSetting.ExceptableItem_bool().GetExceptable("VisitForum", message); extendedDatas.SigninForumWithoutPassword = new ExceptableSetting.ExceptableItem_bool().GetExceptable("SigninForumWithoutPassword", message); extendedDatas.MetaDescription = _Request.Get("MetaDescription", Method.Post, ""); extendedDatas.MetaKeywords = _Request.Get("MetaKeywords", Method.Post, ""); extendedDatas.TitleAttach = _Request.Get("TitleAttach", Method.Post, ""); if (message.HasAnyError()) { return; } try { using (new ErrorScope()) { bool success; int forumID; if (IsEdit) { forumID = Forum.ForumID; success = ForumBO.Instance.UpdateForum(My, forumID, codeName, forumName, forumType, password, logoSrc , readme, description, themeID, columnSpan, sortOrder, extendedDatas); } else { success = ForumBO.Instance.CreateForum(My, codeName, forumName, parentID, forumType, password, logoSrc , themeID, readme, description, threadCatalogStatus, columnSpan, sortOrder, extendedDatas, out forumID); } if (success == false) { CatchError <ErrorInfo>(delegate(ErrorInfo error) { message.AddError(error); }); m_IsSuccess = false; } else { if (new ExceptableItem_bool().AplyAllNode("SigninForumWithoutPassword"))//应用到所有下级版块 { Dictionary <int, ForumExtendedAttribute> extendedAttributes = new Dictionary <int, ForumExtendedAttribute>(); ForumCollection childForums = ForumBO.Instance.GetAllSubForums(forumID); foreach (Forum tempForum in childForums) { tempForum.ExtendedAttribute.SigninForumWithoutPassword = forum.ExtendedAttribute.SigninForumWithoutPassword; extendedAttributes.Add(tempForum.ForumID, tempForum.ExtendedAttribute); } ForumBO.Instance.UpdateChildForumsExtendedAttributes(My, extendedAttributes); } if (IsEdit == false) { JumpTo("bbs/manage-forum.aspx"); } else { BbsRouter.JumpToCurrentUrl("success=1"); } } } } catch (Exception ex) { message.AddError(ex.Message); } }
/// <summary> /// 更新指定的版块 /// </summary> public abstract int UpdateForum(int forumID, string codeName, string forumName, ForumType forumType, string password, string logoUrl , string readme, string description, string themeID, int columaSpan, int sortOrder, ForumExtendedAttribute forumExtendedDatas);
public abstract int CreateForum(string codeName, string forumName, int parentID, ForumType forumType, string password, string logoUrl , string themeID, string readme, string description, ThreadCatalogStatus threadCatalogStaus, int columnSpan, int sortOrder , ForumExtendedAttribute forumExtendedDatas, out int forumID);