public IList<Core.Business.RelativeGroup> GetAllRelativeGroup() { IList<Core.Business.RelativeGroup> relativeGrouplist = new List<Core.Business.RelativeGroup>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); SqlDataReader reader = sql.ExecuteSPReader("USP_RelativeGroup_SelectAll"); if (reader != null) { while (reader.Read()) { Core.Business.RelativeGroup relativeGroup = new Core.Business.RelativeGroup(); if (!reader.IsDBNull(0)) relativeGroup.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) relativeGroup.GroupId = reader.GetInt32(1); if (!reader.IsDBNull(2)) relativeGroup.RelativeGroupId = reader.GetInt32(2); if (!reader.IsDBNull(3)) relativeGroup.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) relativeGroup.IsChecked = reader.GetBoolean(4); if (!reader.IsDBNull(5)) relativeGroup.Remark = reader.GetString(5); relativeGroup.MarkOld(); relativeGrouplist.Add(relativeGroup); } reader.Close(); } return relativeGrouplist; }
public IList<CY.UME.Core.Business.RelativeGroup> GetRelativeGroups(int groupId, int relativeGroupId, bool isChecked, CY.UME.Core.PagingInfo pageInfo) { IList<Core.Business.RelativeGroup> relativeGrouplist = new List<Core.Business.RelativeGroup>(); SqlServerUtility sql = new SqlServerUtility(SqlConnection); #region 参数 string tables = "RelativeGroup"; string pK = "Id"; string sort = "DateCreated Desc"; int pageNum = pageInfo.CurrentPage; int pageSize = pageInfo.PageSize; string fields = "[Id], [GroupId],[RelativeGroupId],[DateCreated],[IsChecked],[Remark]"; string filter = "1=1 "; if (groupId != 0) { filter += " and GroupId=" + groupId; } if (relativeGroupId != 0) { filter += " and RelativeGroupId=" + relativeGroupId; } filter += " and IsChecked=" + (isChecked ? 1 : 0); string group = String.Empty; #endregion sql.AddParameter("@Tables", SqlDbType.VarChar, tables); sql.AddParameter("@PK", SqlDbType.VarChar, pK); sql.AddParameter("@Sort", SqlDbType.VarChar, sort); sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum); sql.AddParameter("@PageSize", SqlDbType.Int, pageSize); sql.AddParameter("@Fields", SqlDbType.VarChar, fields); sql.AddParameter("@Filter", SqlDbType.VarChar, filter); sql.AddParameter("@Group", SqlDbType.VarChar, group); SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount"); if (reader != null) { while (reader.Read()) { Core.Business.RelativeGroup relativeGroup = new Core.Business.RelativeGroup(); if (!reader.IsDBNull(0)) relativeGroup.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) relativeGroup.GroupId = reader.GetInt32(1); if (!reader.IsDBNull(2)) relativeGroup.RelativeGroupId = reader.GetInt32(2); if (!reader.IsDBNull(3)) relativeGroup.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) relativeGroup.IsChecked = reader.GetBoolean(4); if (!reader.IsDBNull(5)) relativeGroup.Remark = reader.GetString(5); relativeGroup.MarkOld(); relativeGrouplist.Add(relativeGroup); } reader.Close(); } return relativeGrouplist; }