/// <summary> /// 绑定查询的方法 /// </summary> private List <SearchParam> BindSearch() { List <SearchParam> Where = new List <SearchParam>(); Where.Add(new SearchParam("ModuleId", Settings_ModuleID, SearchType.Equal)); //筛选文章的状态 if (ArticleStatus >= 0) { Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Status, ArticleStatus, SearchType.Equal)); } if (GroupID > 0) { String ArticleIDs = DNNGo_DNNGalleryProGame_Slider_Group.FindArticleIDsByCategoryIDs(GroupID.ToString()); if (!String.IsNullOrEmpty(ArticleIDs)) { Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, ArticleIDs, SearchType.In)); } else { Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, 0, SearchType.Equal)); } } //Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.t, ArticleStatus, SearchType.Equal)); return(Where); }
/// <summary> /// 绑定查询的方法 /// </summary> private QueryParam BindSearch(QueryParam qp) { qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ModuleId, Settings_ModuleID, SearchType.Equal)); qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Status, (Int32)EnumStatus.Activated, SearchType.Equal)); if (FilterStartTime) { qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.StartTime, xUserTime.UtcTime(), SearchType.LtEqual)); } if (FilterEndTime) { qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.EndTime, xUserTime.UtcTime(), SearchType.GtEqual)); } if (GroupID > 0) { String ArticleIDs = DNNGo_DNNGalleryProGame_Slider_Group.FindArticleIDsByCategoryIDs(GroupID.ToString()); if (!String.IsNullOrEmpty(ArticleIDs)) { qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ID, ArticleIDs, SearchType.In)); } } if (Attribute1 >= 0) { qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Attribute1, Attribute1, SearchType.Equal)); } if (!String.IsNullOrEmpty(Attribute2)) { qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Attribute2, Attribute2, SearchType.Equal)); } //需要根据条件来查找相应的权限 if (UserId > 0) { if (!UserInfo.IsSuperUser)//超级管理员不限制 { qp.WhereSql.Append(" ( "); //公开的 qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_AllUsers, 0, SearchType.Equal).ToSql()); //有角色的 if (UserInfo.Roles != null && UserInfo.Roles.Length > 0) { qp.WhereSql.Append(" OR "); qp.WhereSql.Append(" ( "); Int32 RoleIndex = 0; foreach (var r in UserInfo.Roles) { if (RoleIndex > 0) { qp.WhereSql.Append(" OR "); } qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_Roles, String.Format(",{0},", r), SearchType.Like).ToSql()); //qp.WhereSql.Append(" OR "); //qp.WhereSql.Append(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_Roles, r, SearchType.Like).ToSql()); RoleIndex++; } qp.WhereSql.Append(" ) "); } qp.WhereSql.Append(" ) "); } } else { qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.Per_AllUsers, 0, SearchType.Equal)); } return(qp); }