/// <summary> /// ������ҵ��� /// </summary> /// <param name="EntCode"></param> /// <returns></returns> public IList<Group> getByEntCode(string EntCode) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@EntCode", SqlDbType.NVarChar, EntCode); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetGroupByEntCode); if (reader != null) { while (reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.Num = reader.GetInt32(1); if (!reader.IsDBNull(2)) group.Term = reader.GetInt32(2); if (!reader.IsDBNull(3)) group.YearCode = reader.GetString(3); if (!reader.IsDBNull(4)) group.EntCode = reader.GetString(4); if (!reader.IsDBNull(5)) group.GroupName = reader.GetString(5); group.MarkOld(); grouplist.Add(group); } reader.Close(); } return grouplist; }
public CY.UME.Core.Business.Group GetAccountBindedPhoneCountByGroup(string groupName) { SqlServerUtility sql = new SqlServerUtility(SqlConnection); string getgroupsql = "SELECT [Id],[CreatorId],[MaxMemberNum],[Type],[DateCreated],[IsChecked],[ManageSite],[ManageAccount],[ManageGroup],[ManageSchool],[Name],[ViewPermission],[IsRecommended],[MemberNum],[AddPermission],[Level],[PlaCard],[LeaveWordsPermission],[AddPictureReplyPermission],[AddPicturePermission],[AddTopicPermission],[AddTopicReplyPermission],[UrlName],[Slogan],[HeadPicPath],[LogoPath] from [Group] where [IsChecked]=1 And [Name] = '" + groupName + "'"; SqlDataReader reader = sql.ExecuteSqlReader(getgroupsql); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.CreatorId = reader.GetInt64(1); if (!reader.IsDBNull(2)) group.MaxMemberNum = reader.GetInt32(2); if (!reader.IsDBNull(3)) group.Type = reader.GetInt32(3); if (!reader.IsDBNull(4)) group.DateCreated = reader.GetDateTime(4); if (!reader.IsDBNull(5)) group.IsChecked = reader.GetBoolean(5); if (!reader.IsDBNull(6)) group.ManageSite = reader.GetBoolean(6); if (!reader.IsDBNull(7)) group.ManageAccount = reader.GetBoolean(7); if (!reader.IsDBNull(8)) group.ManageGroup = reader.GetBoolean(8); if (!reader.IsDBNull(9)) group.ManageSchool = reader.GetBoolean(9); if (!reader.IsDBNull(10)) group.Name = reader.GetString(10); if (!reader.IsDBNull(11)) group.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) group.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) group.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) group.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) group.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) group.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) group.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) group.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) group.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) group.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) group.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) group.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) group.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) group.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) group.LogoPath = reader.GetString(25); reader.Close(); return group; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public Core.Business.Group Select(int id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.Int, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectGroup); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.Num = reader.GetInt32(1); if (!reader.IsDBNull(2)) group.Term = reader.GetInt32(2); if (!reader.IsDBNull(3)) group.YearCode = reader.GetString(3); if (!reader.IsDBNull(4)) group.EntCode = reader.GetString(4); if (!reader.IsDBNull(5)) group.GroupName = reader.GetString(5); reader.Close(); return group; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<CY.UME.Core.Business.Group> GetRelativeGroup(CY.UME.Core.Business.Group group) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); if (group == null) { return grouplist; } SqlServerUtility sql = new SqlServerUtility(SqlConnection); sql.AddParameter("@GroupId", SqlDbType.Int, group.Id); SqlDataReader reader = sql.ExecuteSPReader("USP_Group_GetRelativeGroup_By_GroupId"); if (reader != null) { while (reader.Read()) { Core.Business.Group groupTemp = new Core.Business.Group(); if (!reader.IsDBNull(0)) groupTemp.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) groupTemp.CreatorId = reader.GetInt64(1); if (!reader.IsDBNull(2)) groupTemp.MaxMemberNum = reader.GetInt32(2); if (!reader.IsDBNull(3)) groupTemp.Type = reader.GetInt32(3); if (!reader.IsDBNull(4)) groupTemp.DateCreated = reader.GetDateTime(4); if (!reader.IsDBNull(5)) groupTemp.IsChecked = reader.GetBoolean(5); if (!reader.IsDBNull(6)) groupTemp.ManageSite = reader.GetBoolean(6); if (!reader.IsDBNull(7)) groupTemp.ManageAccount = reader.GetBoolean(7); if (!reader.IsDBNull(8)) groupTemp.ManageGroup = reader.GetBoolean(8); if (!reader.IsDBNull(9)) groupTemp.ManageSchool = reader.GetBoolean(9); if (!reader.IsDBNull(10)) groupTemp.Name = reader.GetString(10); if (!reader.IsDBNull(11)) groupTemp.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) groupTemp.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) groupTemp.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) groupTemp.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) groupTemp.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) groupTemp.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) groupTemp.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) groupTemp.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) groupTemp.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) groupTemp.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) groupTemp.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) groupTemp.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) groupTemp.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) groupTemp.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) groupTemp.LogoPath = reader.GetString(25); groupTemp.MarkOld(); grouplist.Add(groupTemp); } reader.Close(); } return grouplist; }
public IList<CY.UME.Core.Business.Group> GetRecommendedGroups(CY.UME.Core.PagingInfo pageInfo) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); string sbFilter = "[IsRecommended] = 1 AND [IsChecked] = 1"; int pageSize = int.MaxValue; int pageNumber = 1; if (pageInfo != null) { pageSize = pageInfo.PageSize; pageNumber = pageInfo.CurrentPage; } sql.AddParameter("@PageNum", SqlDbType.Int, pageSize); sql.AddParameter("@Num", SqlDbType.Int, pageSize * (pageNumber - 1)); string SqlGetUC = "SELECT Top (@PageNum)[Id],[CreatorId],[MaxMemberNum],[Type],[DateCreated],[IsChecked],[ManageSite],[ManageAccount],[ManageGroup],[ManageSchool],[Name],[ViewPermission],[IsRecommended],[MemberNum],[AddPermission],[Level],[PlaCard],[LeaveWordsPermission],[AddPictureReplyPermission],[AddPicturePermission],[AddTopicPermission],[AddTopicReplyPermission],[UrlName],[Slogan],[HeadPicPath],[LogoPath] FROM [Group] WHERE [Id] NOT IN (SELECT Top (@Num) [Id] FROM [Group] WHERE "; SqlGetUC += sbFilter.ToString() + " ORDER BY [Id] DESC) and " + sbFilter.ToString() + " ORDER BY [Id] DESC"; SqlDataReader reader = sql.ExecuteSqlReader(SqlGetUC); if (reader != null) { while (reader.Read()) { Core.Business.Group groupTemp = new Core.Business.Group(); if (!reader.IsDBNull(0)) groupTemp.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) groupTemp.CreatorId = reader.GetInt64(1); if (!reader.IsDBNull(2)) groupTemp.MaxMemberNum = reader.GetInt32(2); if (!reader.IsDBNull(3)) groupTemp.Type = reader.GetInt32(3); if (!reader.IsDBNull(4)) groupTemp.DateCreated = reader.GetDateTime(4); if (!reader.IsDBNull(5)) groupTemp.IsChecked = reader.GetBoolean(5); if (!reader.IsDBNull(6)) groupTemp.ManageSite = reader.GetBoolean(6); if (!reader.IsDBNull(7)) groupTemp.ManageAccount = reader.GetBoolean(7); if (!reader.IsDBNull(8)) groupTemp.ManageGroup = reader.GetBoolean(8); if (!reader.IsDBNull(9)) groupTemp.ManageSchool = reader.GetBoolean(9); if (!reader.IsDBNull(10)) groupTemp.Name = reader.GetString(10); if (!reader.IsDBNull(11)) groupTemp.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) groupTemp.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) groupTemp.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) groupTemp.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) groupTemp.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) groupTemp.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) groupTemp.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) groupTemp.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) groupTemp.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) groupTemp.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) groupTemp.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) groupTemp.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) groupTemp.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) groupTemp.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) groupTemp.LogoPath = reader.GetString(25); groupTemp.MarkOld(); grouplist.Add(groupTemp); } reader.Close(); } return grouplist; }
public IList<Group> GetGroupsCountBySearch(string sText, CY.UME.Core.PagingInfo pinfo, string type) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); int pageSize = int.MaxValue; int pageNumber = 1; if (pinfo != null) { pageSize = pinfo.PageSize; pageNumber = pinfo.CurrentPage; } sql.AddParameter("@PageNum", SqlDbType.Int, pageSize); sql.AddParameter("@Num", SqlDbType.Int, pageSize * (pageNumber - 1)); string sqlwhere = "SELECT Top (@PageNum) * FROM [dbo].[Group] WHERE [Id] not in(SELECT Top (@Num) [Id] FROM [Group] WHERE Name like '%" + sText + "%' and [IsChecked]=1 and [Type]>0 ORDER BY Id DESC ) and Name like '%" + sText + "%' and [IsChecked]=1 and [Type]>0 ORDER BY Id DESC"; if (type == "2") { sqlwhere = "SELECT Top (@PageNum) * FROM [Group] INNER JOIN [dbo].[AccountGroup] ON [Group].Id=AccountGroup.GroupId WHERE AccountGroup.AccountId =" + sText + " and [Group].IsChecked=1 and [Group].[Type]>0 and [Group].[Id] not in(SELECT Top (@Num) [Group].[Id] FROM [Group] INNER JOIN [dbo].[AccountGroup] ON [Group].Id=AccountGroup.GroupId WHERE AccountGroup.AccountId =" + sText + " and [Group].IsChecked=1 and [Group].[Type]>0 ORDER BY [Group].Id DESC ) ORDER BY [Group].Id DESC"; } SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere); if (reader != null) { while (reader.Read()) { Core.Business.Group groupTemp = new Core.Business.Group(); if (!reader.IsDBNull(0)) groupTemp.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) groupTemp.Name = reader.GetString(1); if (!reader.IsDBNull(2)) groupTemp.CreatorId = reader.GetInt64(2); if (!reader.IsDBNull(3)) groupTemp.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) groupTemp.IsChecked = reader.GetBoolean(4); if (!reader.IsDBNull(5)) groupTemp.MaxMemberNum = reader.GetInt32(5); if (!reader.IsDBNull(6)) groupTemp.Type = reader.GetInt32(6); if (!reader.IsDBNull(7)) groupTemp.ManageSite = reader.GetBoolean(7); if (!reader.IsDBNull(8)) groupTemp.ManageAccount = reader.GetBoolean(8); if (!reader.IsDBNull(9)) groupTemp.ManageGroup = reader.GetBoolean(9); if (!reader.IsDBNull(10)) groupTemp.ManageSchool = reader.GetBoolean(10); if (!reader.IsDBNull(11)) groupTemp.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) groupTemp.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) groupTemp.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) groupTemp.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) groupTemp.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) groupTemp.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) groupTemp.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) groupTemp.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) groupTemp.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) groupTemp.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) groupTemp.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) groupTemp.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) groupTemp.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) groupTemp.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) groupTemp.LogoPath = reader.GetString(25); groupTemp.MarkOld(); grouplist.Add(groupTemp); } reader.Close(); } return grouplist; }
public IList<CY.UME.Core.Business.Group> GetGroupsByAccountIdAndType(CY.UME.Core.Business.Account account, int type, CY.UME.Core.PagingInfo pageInfo, string field, string sort, bool? isRecommended) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); string strsort = field + " " + sort; string sbFilter = "1 = 1 AND [IsChecked] = 1"; if (type == -2) { sbFilter += " AND [Type] > 0"; } else if (type != -1) { sbFilter += " AND [Type] =" + type.ToString(); } if (account != null) { sbFilter += " AND [Id] IN (select [GroupId] from AccountGroup where AccountId = " + account.Id.ToString() + ")"; } if (isRecommended != null) { if ((bool)isRecommended) { sbFilter += " AND [IsRecommended] = 1"; } else { sbFilter += " AND [IsRecommended] = 0"; } } int pageSize = int.MaxValue; int pageNumber = 1; if (pageInfo != null) { pageSize = pageInfo.PageSize; pageNumber = pageInfo.CurrentPage; } sql.AddParameter("@PageNum", SqlDbType.Int, pageSize); sql.AddParameter("@Num", SqlDbType.Int, pageSize * (pageNumber - 1)); string SqlGetUC = "SELECT Top (@PageNum)[Id],[CreatorId],[MaxMemberNum],[Type],[DateCreated],[IsChecked],[ManageSite],[ManageAccount],[ManageGroup],[ManageSchool],[Name],[ViewPermission],[IsRecommended],[MemberNum],[AddPermission],[Level],[PlaCard],[LeaveWordsPermission],[AddPictureReplyPermission],[AddPicturePermission],[AddTopicPermission],[AddTopicReplyPermission],[UrlName],[Slogan],[HeadPicPath],[LogoPath] FROM [Group] WHERE [Id] not in(SELECT Top (@Num) [Id] FROM [Group] WHERE "; SqlGetUC += sbFilter.ToString() + " ORDER BY " + strsort + ") AND " + sbFilter.ToString() + " ORDER BY "; SqlGetUC += strsort; SqlDataReader reader = sql.ExecuteSqlReader(SqlGetUC); if (reader != null) { while (reader.Read()) { Core.Business.Group groupTemp = new Core.Business.Group(); if (!reader.IsDBNull(0)) groupTemp.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) groupTemp.CreatorId = reader.GetInt64(1); if (!reader.IsDBNull(2)) groupTemp.MaxMemberNum = reader.GetInt32(2); if (!reader.IsDBNull(3)) groupTemp.Type = reader.GetInt32(3); if (!reader.IsDBNull(4)) groupTemp.DateCreated = reader.GetDateTime(4); if (!reader.IsDBNull(5)) groupTemp.IsChecked = reader.GetBoolean(5); if (!reader.IsDBNull(6)) groupTemp.ManageSite = reader.GetBoolean(6); if (!reader.IsDBNull(7)) groupTemp.ManageAccount = reader.GetBoolean(7); if (!reader.IsDBNull(8)) groupTemp.ManageGroup = reader.GetBoolean(8); if (!reader.IsDBNull(9)) groupTemp.ManageSchool = reader.GetBoolean(9); if (!reader.IsDBNull(10)) groupTemp.Name = reader.GetString(10); if (!reader.IsDBNull(11)) groupTemp.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) groupTemp.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) groupTemp.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) groupTemp.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) groupTemp.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) groupTemp.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) groupTemp.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) groupTemp.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) groupTemp.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) groupTemp.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) groupTemp.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) groupTemp.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) groupTemp.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) groupTemp.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) groupTemp.LogoPath = reader.GetString(25); groupTemp.MarkOld(); grouplist.Add(groupTemp); } reader.Close(); } return grouplist; }
// ��̨���� public CY.UME.Core.Business.Group GetGroupByTopicId(Guid topicId) { SqlServerUtility sql = new SqlServerUtility(SqlConnection); sql.AddParameter("@TopicId", SqlDbType.UniqueIdentifier, topicId); SqlDataReader reader = sql.ExecuteSPReader("USP_Group_Select_By_TopicId"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.CreatorId = reader.GetInt64(1); if (!reader.IsDBNull(2)) group.MaxMemberNum = reader.GetInt32(2); if (!reader.IsDBNull(3)) group.Type = reader.GetInt32(3); if (!reader.IsDBNull(4)) group.DateCreated = reader.GetDateTime(4); if (!reader.IsDBNull(5)) group.IsChecked = reader.GetBoolean(5); if (!reader.IsDBNull(6)) group.ManageSite = reader.GetBoolean(6); if (!reader.IsDBNull(7)) group.ManageAccount = reader.GetBoolean(7); if (!reader.IsDBNull(8)) group.ManageGroup = reader.GetBoolean(8); if (!reader.IsDBNull(9)) group.ManageSchool = reader.GetBoolean(9); if (!reader.IsDBNull(10)) group.Name = reader.GetString(10); if (!reader.IsDBNull(11)) group.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) group.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) group.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) group.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) group.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) group.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) group.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) group.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) group.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) group.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) group.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) group.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) group.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) group.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) group.LogoPath = reader.GetString(25); reader.Close(); return group; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public IList<Group> GetCommendGroupByPageInfo(long id, CY.UME.Core.PagingInfo pageInfo) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); string sqlstr = " "; Core.Business.AccountExtend uaccountex = Core.Business.AccountExtend.Load(id); if (uaccountex != null && !string.IsNullOrEmpty(uaccountex.Interest)) { if (uaccountex.Interest.Contains(",")) { string[] Interst = uaccountex.Interest.Split(','); sqlstr += " and "; if (Interst != null && Interst[0] != "") { for (int i = 0; i < Interst.Length; i++) { if (i == Interst.Length - 1) { if (Interst[i] == "Ӱ��") { sqlstr += " Name like'%��Ӱ%' "; } else { sqlstr += " Name like '%" + Interst[i] + "%' "; } } else { if (Interst[i] == "Ӱ��") { sqlstr += " Name like '%��Ӱ%' or "; } else { sqlstr += " Name like '%" + Interst[i] + "%' or "; } } } } } else { if (uaccountex.Interest == "Ӱ��") { sqlstr = " and Name like '%��Ӱ%'"; } else { sqlstr = " and Name like '%" + uaccountex.Interest + "%'"; } } } string sort = "Id"; int pageNumber = pageInfo.CurrentPage; int pageSize = pageInfo.PageSize; string filter = ""; filter = sqlstr; sql.AddParameter("@PageNum", SqlDbType.Int, pageSize); sql.AddParameter("@Num", SqlDbType.Int, pageSize * (pageNumber - 1)); string SqlGetUC = "SELECT Top (@PageNum)[Id], [CreatorId],[MaxMemberNum],[Type],[DateCreated],[IsChecked],[ManageSite],[ManageAccount],[ManageGroup],[ManageSchool],[Name],[ViewPermission],[IsRecommended],[MemberNum],[AddPermission],[Level],[PlaCard],[LeaveWordsPermission],[AddPictureReplyPermission],[AddPicturePermission],[AddTopicPermission],[AddTopicReplyPermission],[UrlName],[Slogan],[HeadPicPath],[LogoPath] FROM [Group] WHERE [Id] not in(SELECT Top (@Num) [Id] FROM [Group] WHERE [ViewPermission]=1 and [IsChecked]=1 "; SqlGetUC += filter + "ORDER BY " + sort + " DESC ) and ViewPermission=1 and [IsChecked]=1" + filter + " ORDER BY "; SqlGetUC += sort + " DESC"; SqlDataReader reader = sql.ExecuteSqlReader(SqlGetUC); if (reader != null) { while (reader.Read()) { Core.Business.Group groupTemp = new Core.Business.Group(); if (!reader.IsDBNull(0)) groupTemp.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) groupTemp.CreatorId = reader.GetInt64(1); if (!reader.IsDBNull(2)) groupTemp.MaxMemberNum = reader.GetInt32(2); if (!reader.IsDBNull(3)) groupTemp.Type = reader.GetInt32(3); if (!reader.IsDBNull(4)) groupTemp.DateCreated = reader.GetDateTime(4); if (!reader.IsDBNull(5)) groupTemp.IsChecked = reader.GetBoolean(5); if (!reader.IsDBNull(6)) groupTemp.ManageSite = reader.GetBoolean(6); if (!reader.IsDBNull(7)) groupTemp.ManageAccount = reader.GetBoolean(7); if (!reader.IsDBNull(8)) groupTemp.ManageGroup = reader.GetBoolean(8); if (!reader.IsDBNull(9)) groupTemp.ManageSchool = reader.GetBoolean(9); if (!reader.IsDBNull(10)) groupTemp.Name = reader.GetString(10); if (!reader.IsDBNull(11)) groupTemp.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) groupTemp.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) groupTemp.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) groupTemp.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) groupTemp.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) groupTemp.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) groupTemp.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) groupTemp.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) groupTemp.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) groupTemp.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) groupTemp.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) groupTemp.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) groupTemp.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) groupTemp.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) groupTemp.LogoPath = reader.GetString(25); groupTemp.MarkOld(); grouplist.Add(groupTemp); } reader.Close(); } return grouplist; }
public IList<CY.UME.Core.Business.Group> GetCommendGroup(CY.UME.Core.Business.AccountExtend uaccountex) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); string sqlstr = "1=1 and [IsChecked]=1 "; if (!string.IsNullOrEmpty(uaccountex.Interest)) { if (uaccountex.Interest.Contains(",")) { string[] Interst = uaccountex.Interest.Split(','); if (Interst != null && Interst[0] != "") { sqlstr += "and "; for (int i = 0; i < Interst.Length; i++) { if (i == Interst.Length - 1) { if (Interst[i] == "Ӱ��") { sqlstr += " Name like '%��Ӱ%' "; } else { sqlstr += " Name like '%" + Interst[i] + "%' "; } } else { if (Interst[i] == "Ӱ��") { sqlstr += " Name like'%��Ӱ%' or"; } else { sqlstr += " Name like'%" + Interst[i] + "%' or "; } } } } } else { if (uaccountex.Interest == "Ӱ��") { sqlstr = " Name like'%��Ӱ%'"; } else { sqlstr = " Name like'%" + uaccountex.Interest + "%'"; } } } string sqlwhere = "SELECT * FROM [dbo].[Group] where "; sqlwhere += sqlstr + " and ViewPermission = 1"; SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere); if (reader != null) { while (reader.Read()) { Core.Business.Group groupTemp = new Core.Business.Group(); if (!reader.IsDBNull(0)) groupTemp.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) groupTemp.Name = reader.GetString(1); if (!reader.IsDBNull(2)) groupTemp.CreatorId = reader.GetInt64(2); if (!reader.IsDBNull(3)) groupTemp.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) groupTemp.IsChecked = reader.GetBoolean(4); if (!reader.IsDBNull(5)) groupTemp.MaxMemberNum = reader.GetInt32(5); if (!reader.IsDBNull(6)) groupTemp.Type = reader.GetInt32(6); if (!reader.IsDBNull(7)) groupTemp.ManageSite = reader.GetBoolean(7); if (!reader.IsDBNull(8)) groupTemp.ManageAccount = reader.GetBoolean(8); if (!reader.IsDBNull(9)) groupTemp.ManageGroup = reader.GetBoolean(9); if (!reader.IsDBNull(10)) groupTemp.ManageSchool = reader.GetBoolean(10); if (!reader.IsDBNull(11)) groupTemp.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) groupTemp.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) groupTemp.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) groupTemp.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) groupTemp.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) groupTemp.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) groupTemp.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) groupTemp.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) groupTemp.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) groupTemp.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) groupTemp.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) groupTemp.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) groupTemp.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) groupTemp.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) groupTemp.LogoPath = reader.GetString(25); groupTemp.MarkOld(); grouplist.Add(groupTemp); } reader.Close(); } return grouplist; }
public IList<Core.Business.Group> GetSettleGroup(string StrId, int PageSize) { List<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); String Column = "[Id],[CreatorId],[MaxMemberNum],[Type],[DateCreated],[IsChecked],[ManageSite],[ManageAccount],[ManageGroup],[ManageSchool],[Name],[ViewPermission],[IsRecommended],[MemberNum],[AddPermission],[Level],[PlaCard],[LeaveWordsPermission],[AddPictureReplyPermission],[AddPicturePermission],[AddTopicPermission],[AddTopicReplyPermission],[UrlName],[Slogan],[HeadPicPath],[LogoPath]"; string[] Id = StrId.Split(','); for (int i = 0; i < Id.Length; i++) { SqlDataReader reader = sql.ExecuteSqlReader("SELECT " + Column + " FROM [Group] WHERE Id = " + Id[i].ToString()); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.CreatorId = reader.GetInt64(1); if (!reader.IsDBNull(2)) group.MaxMemberNum = reader.GetInt32(2); if (!reader.IsDBNull(3)) group.Type = reader.GetInt32(3); if (!reader.IsDBNull(4)) group.DateCreated = reader.GetDateTime(4); if (!reader.IsDBNull(5)) group.IsChecked = reader.GetBoolean(5); if (!reader.IsDBNull(6)) group.ManageSite = reader.GetBoolean(6); if (!reader.IsDBNull(7)) group.ManageAccount = reader.GetBoolean(7); if (!reader.IsDBNull(8)) group.ManageGroup = reader.GetBoolean(8); if (!reader.IsDBNull(9)) group.ManageSchool = reader.GetBoolean(9); if (!reader.IsDBNull(10)) group.Name = reader.GetString(10); if (!reader.IsDBNull(11)) group.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) group.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) group.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) group.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) group.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) group.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) group.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) group.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) group.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) group.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) group.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) group.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) group.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) group.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) group.LogoPath = reader.GetString(25); reader.Close(); grouplist.Add(group); } else { if (reader != null && !reader.IsClosed) reader.Close(); } } // ������������ﲻ��Ԥ��ֵ if (grouplist != null && grouplist.Count < PageSize) { PageSize = PageSize - grouplist.Count; sql.AddParameter("@PageSize", SqlDbType.Int, PageSize); sql.AddParameter("@Id", SqlDbType.NVarChar, StrId); // �ų���Id SqlDataReader reader = sql.ExecuteSPReader("USP_GetTopGroup_By_TopicReply"); if (reader != null) { while (reader.Read()) { Core.Business.Group groupTemp = new Core.Business.Group(); if (!reader.IsDBNull(0)) groupTemp.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) groupTemp.Name = reader.GetString(1); if (!reader.IsDBNull(2)) groupTemp.CreatorId = reader.GetInt64(2); if (!reader.IsDBNull(3)) groupTemp.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) groupTemp.IsChecked = reader.GetBoolean(4); if (!reader.IsDBNull(5)) groupTemp.MaxMemberNum = reader.GetInt32(5); if (!reader.IsDBNull(6)) groupTemp.Type = reader.GetInt32(6); if (!reader.IsDBNull(7)) groupTemp.ManageSite = reader.GetBoolean(7); if (!reader.IsDBNull(8)) groupTemp.ManageAccount = reader.GetBoolean(8); if (!reader.IsDBNull(9)) groupTemp.ManageGroup = reader.GetBoolean(9); if (!reader.IsDBNull(10)) groupTemp.ManageSchool = reader.GetBoolean(10); if (!reader.IsDBNull(11)) groupTemp.ViewPermission = reader.GetInt32(11); if (!reader.IsDBNull(12)) groupTemp.IsRecommended = reader.GetInt32(12); if (!reader.IsDBNull(13)) groupTemp.MemberNum = reader.GetInt32(13); if (!reader.IsDBNull(14)) groupTemp.AddPermission = reader.GetInt32(14); if (!reader.IsDBNull(15)) groupTemp.Level = reader.GetInt32(15); if (!reader.IsDBNull(16)) groupTemp.PlaCard = reader.GetString(16); if (!reader.IsDBNull(17)) groupTemp.LeaveWordsPermission = reader.GetInt32(17); if (!reader.IsDBNull(18)) groupTemp.AddPictureReplyPermission = reader.GetInt32(18); if (!reader.IsDBNull(19)) groupTemp.AddPicturePermission = reader.GetInt32(19); if (!reader.IsDBNull(20)) groupTemp.AddTopicPermission = reader.GetInt32(20); if (!reader.IsDBNull(21)) groupTemp.AddTopicReplyPermission = reader.GetInt32(21); if (!reader.IsDBNull(22)) groupTemp.UrlName = reader.GetString(22); if (!reader.IsDBNull(23)) groupTemp.Slogan = reader.GetString(23); if (!reader.IsDBNull(24)) groupTemp.HeadPicPath = reader.GetString(24); if (!reader.IsDBNull(25)) groupTemp.LogoPath = reader.GetString(25); groupTemp.MarkOld(); grouplist.Add(groupTemp); } reader.Close(); } } return grouplist; }
public IList<Group> GetJionGroupTop(int activeID, int top) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(connectionString); string sqlwhere = "select top " + top + " c.Id,c.[Name] from [Group] c inner join(select a.GroupId as Id from AccountGroup a inner join( select AccountId from ActivitieParticipants where ActivitieId=" + activeID + " group by AccountId) b on a.AccountId=b.AccountId group by GroupId )d on c.Id=d.Id order by newid()"; SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere); if (reader != null) { while (reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.Name = reader.GetString(1); group.MarkOld(); grouplist.Add(group); } reader.Close(); } return grouplist; }
public IList<Group> GetJionGroup(int activeID, CY.UME.Core.PagingInfo pageinfo) { IList<Core.Business.Group> grouplist = new List<Core.Business.Group>(); SqlServerUtility sql = new SqlServerUtility(connectionString); string sqlwhere = string.Empty; StringBuilder strb = new StringBuilder(); strb.Append("declare @LowerBand int declare @UpperBand int declare @CurrentPage int declare @PageSize int"); strb.Append(" Set @CurrentPage=" + pageinfo.CurrentPage + " Set @PageSize=" + pageinfo.PageSize + ""); strb.Append(" SET @LowerBand = (@CurrentPage - 1) * @PageSize"); strb.Append(" SET @UpperBand = (@CurrentPage * @PageSize) + 1"); strb.Append(" ;WITH tempPagedUsers AS("); strb.Append(" select c.Id,c.[Name],ROW_NUMBER() over(order by c.Id desc) as RowNumber from [Group] c inner join( select a.GroupId as Id from AccountGroup a inner join"); strb.Append(" ( select AccountId from ActivitieParticipants where ActivitieId=" + activeID + " group by AccountId) b on a.AccountId=b.AccountId group by GroupId )d on c.Id=d.Id "); strb.Append(") SELECT * FROM tempPagedUsers WHERE RowNumber > @LowerBand AND RowNumber < @UpperBand"); SqlDataReader reader = sql.ExecuteSqlReader(strb.ToString()); if (reader != null) { while (reader.Read()) { Core.Business.Group group = new Core.Business.Group(); if (!reader.IsDBNull(0)) group.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) group.Name = reader.GetString(1); group.MarkOld(); grouplist.Add(group); } reader.Close(); } return grouplist; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CY.UME.Core.Business.Group group = new Core.Business.Group(); CY.UME.Core.Business.Activities activities = new Core.Business.Activities(); if (int.TryParse(Request.QueryString["activeID"], out activeId)) { activities = CY.UME.Core.Business.Activities.Load(activeId); } if (activities == null) { if (group != null) LBLGroupName.Text = group.Name + "群组";//群组名称 } else if (activities != null) LBLGroupName.Text = activities.Name + "活动";//活动名称 if (Request.QueryString["topicId"] == null) { if ((Request.QueryString["groupId"] == null || !int.TryParse(Request.QueryString["groupId"].ToString(), out groupId)) && activeId == 0) { throw new Exception("您所访问的页面不存在"); } group = CY.UME.Core.Business.Group.Load(groupId); if (group == null) { throw new Exception("您所访问的页面不存在"); } uc_GroupInfo.group = group; uc_NewestTopices.group = group; HF_GroupId.Value = groupId.ToString(); SetTitle("发起话题"); } else { Guid topicId = Guid.Empty; if (Request.QueryString["topicId"] == null) { throw new Exception("您所访问的页面不存在"); } topicId = new Guid(Request.QueryString["topicId"]); CY.UME.Core.Business.Topic topic = CY.UME.Core.Business.Topic.Load(topicId); if (topic == null) { throw new Exception("您所访问的页面不存在"); } group = CY.UME.Core.Business.Group.GetGroupByTopicId(topicId.ToString()); uc_GroupInfo.group = group; uc_NewestTopices.group = group; if (!IsPostBack) { TBXTopicName.Text = topic.Title; wysiwyg.Value = topic.Content; HF_SiteUrl.Value = SiteUrl; SetTitle("编辑话题"); HF_TopicId.Value = topicId.ToString(); } ExecuteClientScript("$('#wysiwyg').focus();"); SetTitle("编辑话题"); } //base.CSSName = "ume2"; } }