public IList<Core.Business.LawRepository> GetAllLawRepository(int pagenumber, int pagesize) { IList<Core.Business.LawRepository> lawRepositorylist = new List<Core.Business.LawRepository>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Tables", SqlDbType.VarChar, "LawRepository"); sql.AddParameter("@PK", SqlDbType.VarChar, "Id"); sql.AddParameter("@PageNumber", SqlDbType.Int, pagenumber); sql.AddParameter("@PageSize", SqlDbType.Int, pagesize); SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount"); if (reader != null) { while (reader.Read()) { Core.Business.LawRepository lawRepository = new Core.Business.LawRepository(); if (!reader.IsDBNull(0)) lawRepository.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) lawRepository.Head = reader.GetString(1); if (!reader.IsDBNull(2)) lawRepository.Subhead = reader.GetString(2); if (!reader.IsDBNull(3)) lawRepository.PublishDate = reader.GetDateTime(3); if (!reader.IsDBNull(4)) lawRepository.EffectiveDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) lawRepository.LawNumber = reader.GetString(5); if (!reader.IsDBNull(6)) lawRepository.Publisher = reader.GetString(6); if (!reader.IsDBNull(7)) lawRepository.LawSortID = reader.GetGuid(7); if (!reader.IsDBNull(8)) lawRepository.TradeSortID = reader.GetGuid(8); if (!reader.IsDBNull(9)) lawRepository.Content = reader.GetString(9); if (!reader.IsDBNull(10)) lawRepository.Remark = reader.GetString(10); if (!reader.IsDBNull(11)) lawRepository.DranscriberID = reader.GetGuid(11); if (!reader.IsDBNull(12)) lawRepository.DranscribeDate = reader.GetDateTime(12); lawRepository.MarkOld(); lawRepositorylist.Add(lawRepository); } reader.Close(); } return lawRepositorylist; }
public IList<Core.Business.LawRepository> SelectLawRepositoryDynamic(string topcondition,string whereCondition, string orderByExpression) { IList<Core.Business.LawRepository> lawRepositorylist = new List<Core.Business.LawRepository>(); SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@topCondition", SqlDbType.NVarChar, topcondition); sql.AddParameter("@WhereCondition", SqlDbType.NVarChar, whereCondition); sql.AddParameter("@OrderByExpression", SqlDbType.NVarChar, orderByExpression); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectLawRepositoriesDynamic"); if (reader != null) { while (reader.Read()) { Core.Business.LawRepository lawRepository = new Core.Business.LawRepository(); if (!reader.IsDBNull(0)) lawRepository.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) lawRepository.Head = reader.GetString(1); if (!reader.IsDBNull(2)) lawRepository.Subhead = reader.GetString(2); if (!reader.IsDBNull(3)) lawRepository.PublishDate = reader.GetDateTime(3); if (!reader.IsDBNull(4)) lawRepository.EffectiveDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) lawRepository.LawNumber = reader.GetString(5); if (!reader.IsDBNull(6)) lawRepository.Publisher = reader.GetString(6); if (!reader.IsDBNull(7)) lawRepository.LawSortID = reader.GetGuid(7); if (!reader.IsDBNull(8)) lawRepository.TradeSortID = reader.GetGuid(8); if (!reader.IsDBNull(9)) lawRepository.Content = reader.GetString(9); if (!reader.IsDBNull(10)) lawRepository.Remark = reader.GetString(10); if (!reader.IsDBNull(11)) lawRepository.DranscriberID = reader.GetGuid(11); if (!reader.IsDBNull(12)) lawRepository.DranscribeDate = reader.GetDateTime(12); lawRepository.MarkOld(); lawRepositorylist.Add(lawRepository); } reader.Close(); } return lawRepositorylist; }