示例#1
0
 /// <summary>
 /// 获取权限查询的条件语句
 /// </summary>
 /// <param name="memberID">用户编号</param>
 /// <returns></returns>
 public static QueryComplete GetFindConditionToPermissions(String nowMemberID, String contenttype, Comm.DeletedFlag deleteFlag)
 {
     QueryComplete qc = null;
     if ((nowMemberID == null || nowMemberID == "") && (contenttype == null || contenttype == ""))
     {
         qc = Query.And(
                 Query.EQ("DeleteFlag", deleteFlag.GetHashCode()),
                 Query.EQ("ContentPermissions", ContentPermissions.AllOpen.GetHashCode())
                 );
     }
     else if ((nowMemberID != null && nowMemberID != "") && (contenttype == null || contenttype == ""))
     {
         qc = Query.And(
                 Query.EQ("DeleteFlag", deleteFlag.GetHashCode()),
                 Query.Or(
                     Query.EQ("ContentPermissions", ContentPermissions.AllOpen.GetHashCode()),
                     Query.EQ("MemberID", nowMemberID),
                     Query.And(
                         Query.EQ("ContentPermissions", ContentPermissions.MyFriend.GetHashCode()),
                         Query.In("MyFriends", nowMemberID)
                         )
                     )
                 );
     }
     else if ((nowMemberID == null || nowMemberID == "") && (contenttype != null && contenttype != ""))
     {
         qc = Query.And(
                 Query.EQ("ContentType", int.Parse(contenttype)),
                 Query.EQ("DeleteFlag", deleteFlag.GetHashCode()),
                 Query.EQ("ContentPermissions", ContentPermissions.AllOpen.GetHashCode())
                 );
     }
     else
     {
         qc = Query.And(
                 Query.EQ("ContentType", int.Parse(contenttype)),
                 Query.EQ("DeleteFlag", deleteFlag.GetHashCode()),
                 Query.Or(
                     Query.EQ("ContentPermissions", ContentPermissions.AllOpen.GetHashCode()),
                     Query.EQ("MemberID", nowMemberID),
                     Query.And(
                         Query.EQ("ContentPermissions", ContentPermissions.MyFriend.GetHashCode()),
                         Query.In("MyFriends", nowMemberID)
                         )
                     )
                 );
     }
     return qc;
 }