public override void UpdateSpacePrivacy(int userID, SpacePrivacyType blogPrivacy, SpacePrivacyType feedPrivacy, SpacePrivacyType boardPrivacy, SpacePrivacyType doingPrivacy, SpacePrivacyType albumPrivacy, SpacePrivacyType spacePrivacy, SpacePrivacyType sharePrivacy, SpacePrivacyType friendListPrivacy, SpacePrivacyType informationPrivacy) { using (SqlQuery query = new SqlQuery()) { query.CommandText = @"UPDATE bx_UserInfos SET BlogPrivacy = @BlogPrivacy ,FeedPrivacy = @FeedPrivacy ,BoardPrivacy = @BoardPrivacy ,DoingPrivacy = @DoingPrivacy ,AlbumPrivacy = @AlbumPrivacy ,SpacePrivacy = @SpacePrivacy ,SharePrivacy = @SharePrivacy ,FriendListPrivacy = @FriendListPrivacy ,InformationPrivacy = @InformationPrivacy WHERE UserID = @UserID"; query.CreateParameter <SpacePrivacyType>("@BlogPrivacy", blogPrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@FeedPrivacy", feedPrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@BoardPrivacy", boardPrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@DoingPrivacy", doingPrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@AlbumPrivacy", albumPrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@SpacePrivacy", spacePrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@SharePrivacy", sharePrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@FriendListPrivacy", friendListPrivacy, SqlDbType.TinyInt); query.CreateParameter <SpacePrivacyType>("@InformationPrivacy", informationPrivacy, SqlDbType.TinyInt); query.CreateParameter <int>("@UserID", userID, SqlDbType.Int); query.ExecuteNonQuery(); } }
private bool SaveSpacePrivacy() { MessageDisplay msgDisplay = CreateMessageDisplay("spaceprivacy"); SpacePrivacyType blogPrivacy = _Request.Get <SpacePrivacyType>("BlogPrivacy", SpacePrivacyType.All); SpacePrivacyType boardPrivacy = _Request.Get <SpacePrivacyType>("BoardPrivacy", SpacePrivacyType.All); SpacePrivacyType albumPrivacy = _Request.Get <SpacePrivacyType>("AlbumPrivacy", SpacePrivacyType.All); SpacePrivacyType doingPrivacy = _Request.Get <SpacePrivacyType>("DoingPrivacy", SpacePrivacyType.All); SpacePrivacyType feedPrivacy = _Request.Get <SpacePrivacyType>("FeedPrivacy", SpacePrivacyType.All); SpacePrivacyType friendListPrivacy = _Request.Get <SpacePrivacyType>("FriendListPrivacy", SpacePrivacyType.Self); SpacePrivacyType informationPrivacy = _Request.Get <SpacePrivacyType>("InformationPrivacy", SpacePrivacyType.All); SpacePrivacyType spacePrivacy = _Request.Get <SpacePrivacyType>("SpacePrivacy", SpacePrivacyType.All); SpacePrivacyType sharePrivacy = _Request.Get <SpacePrivacyType>("SharePrivacy", SpacePrivacyType.All); try { SpaceBO.Instance.ModifySpacePrivacy(MyUserID, blogPrivacy, feedPrivacy, boardPrivacy, doingPrivacy, albumPrivacy, spacePrivacy, sharePrivacy, friendListPrivacy, informationPrivacy); } catch (Exception ex) { msgDisplay.AddException(ex); return(false); } return(true); }
protected bool CheckFunctionCanDisplay(SpacePrivacyType privacyType) { if (SpaceOwnerID == MyUserID) { return(true); } else if (VisitorInBlackList) { return(false); } else if (privacyType == SpacePrivacyType.All) { return(true); } else if (privacyType == SpacePrivacyType.Self) { return(SpaceOwnerID == MyUserID); } else if (privacyType == MaxLabs.bbsMax.Enums.SpacePrivacyType.Friend) { return(VisitorIsFriend || VisitorIsAdmin); } return(true); }
protected PrivacyType GetPrivacyTypeForFeed(SpacePrivacyType spacePrivacyType, SpacePrivacyType appPrivacyType, PrivacyType dataPrivacyType) { if (spacePrivacyType == SpacePrivacyType.Friend || appPrivacyType == SpacePrivacyType.Friend || dataPrivacyType == PrivacyType.FriendVisible) { return(PrivacyType.FriendVisible); } if (spacePrivacyType == SpacePrivacyType.Self || appPrivacyType == SpacePrivacyType.Self || dataPrivacyType == PrivacyType.SelfVisible) { return(PrivacyType.SelfVisible); } return(dataPrivacyType); }
/// <summary> /// 保存个人隐私设置 /// </summary> /// <param name="space"></param> //public bool ModifySpacePrivacy(Space space) public void ModifySpacePrivacy(int operatorUserID, SpacePrivacyType blogPrivacy, SpacePrivacyType feedPrivacy, SpacePrivacyType boardPrivacy, SpacePrivacyType doingPrivacy, SpacePrivacyType albumPrivacy, SpacePrivacyType spacePrivacy, SpacePrivacyType sharePrivacy, SpacePrivacyType friendListPrivacy, SpacePrivacyType informationPrivacy) { SpaceDao.Instance.UpdateSpacePrivacy(operatorUserID, blogPrivacy, feedPrivacy, boardPrivacy, doingPrivacy, albumPrivacy, spacePrivacy, sharePrivacy, friendListPrivacy, informationPrivacy); User user = UserBO.Instance.GetUserFromCache(operatorUserID); if (user != null) { user.BlogPrivacy = blogPrivacy; user.FeedPrivacy = feedPrivacy; user.BoardPrivacy = boardPrivacy; user.DoingPrivacy = doingPrivacy; user.AlbumPrivacy = albumPrivacy; user.SpacePrivacy = spacePrivacy; user.SharePrivacy = sharePrivacy; user.FriendListPrivacy = friendListPrivacy; user.InformationPrivacy = informationPrivacy; } string key = string.Format(cacheKey_View_All, operatorUserID); CacheUtil.RemoveBySearch(key); }
public override void UpdateSpacePrivacy(int userID, SpacePrivacyType blogPrivacy, SpacePrivacyType feedPrivacy, SpacePrivacyType boardPrivacy, SpacePrivacyType doingPrivacy, SpacePrivacyType albumPrivacy, SpacePrivacyType spacePrivacy, SpacePrivacyType sharePrivacy, SpacePrivacyType friendListPrivacy, SpacePrivacyType informationPrivacy) { using (SqlQuery query = new SqlQuery()) { query.CommandText = @"UPDATE bx_UserInfos SET BlogPrivacy = @BlogPrivacy ,FeedPrivacy = @FeedPrivacy ,BoardPrivacy = @BoardPrivacy ,DoingPrivacy = @DoingPrivacy ,AlbumPrivacy = @AlbumPrivacy ,SpacePrivacy = @SpacePrivacy ,SharePrivacy = @SharePrivacy ,FriendListPrivacy = @FriendListPrivacy ,InformationPrivacy = @InformationPrivacy WHERE UserID = @UserID"; query.CreateParameter<SpacePrivacyType>("@BlogPrivacy", blogPrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@FeedPrivacy", feedPrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@BoardPrivacy", boardPrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@DoingPrivacy", doingPrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@AlbumPrivacy", albumPrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@SpacePrivacy", spacePrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@SharePrivacy", sharePrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@FriendListPrivacy", friendListPrivacy, SqlDbType.TinyInt); query.CreateParameter<SpacePrivacyType>("@InformationPrivacy", informationPrivacy, SqlDbType.TinyInt); query.CreateParameter<int>("@UserID", userID, SqlDbType.Int); query.ExecuteNonQuery(); } }
protected bool CheckFunctionCanDisplay(SpacePrivacyType privacyType) { if (SpaceOwnerID == MyUserID) { return true; } else if (VisitorInBlackList) { return false; } else if (privacyType == SpacePrivacyType.All) { return true; } else if (privacyType == SpacePrivacyType.Self) { return SpaceOwnerID == MyUserID; } else if (privacyType == MaxLabs.bbsMax.Enums.SpacePrivacyType.Friend) { return VisitorIsFriend || VisitorIsAdmin; } return true; }
/// <summary> /// 更新个人空间 隐私设置 /// </summary> /// <param name="userID"></param> /// <param name="space"></param> public abstract void UpdateSpacePrivacy(int userID, SpacePrivacyType blogPrivacy, SpacePrivacyType feedPrivacy, SpacePrivacyType boardPrivacy, SpacePrivacyType doingPrivacy, SpacePrivacyType albumPrivacy, SpacePrivacyType spacePrivacy, SpacePrivacyType sharePrivacy, SpacePrivacyType friendListPrivacy, SpacePrivacyType informationPrivacy);