public IList<Core.Business.DetectionRepository> GetAllDetectionRepository()
        {
            IList<Core.Business.DetectionRepository> detectionRepositorylist = new List<Core.Business.DetectionRepository>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectDetectionRepositoriesAll");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.DetectionRepository detectionRepository = new Core.Business.DetectionRepository();

                    if (!reader.IsDBNull(0)) detectionRepository.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) detectionRepository.Head = reader.GetString(1);
                    if (!reader.IsDBNull(2)) detectionRepository.Subhead = reader.GetString(2);
                    if (!reader.IsDBNull(3)) detectionRepository.PublishDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) detectionRepository.StandardNumber = reader.GetString(4);
                    if (!reader.IsDBNull(5)) detectionRepository.Publisher = reader.GetString(5);
                    if (!reader.IsDBNull(6)) detectionRepository.TradeSortID = reader.GetGuid(6);
                    if (!reader.IsDBNull(7)) detectionRepository.Content = reader.GetString(7);
                    if (!reader.IsDBNull(8)) detectionRepository.Remark = reader.GetString(8);
                    if (!reader.IsDBNull(9)) detectionRepository.DranscriberID = reader.GetGuid(9);
                    if (!reader.IsDBNull(10)) detectionRepository.DranscribeDate = reader.GetDateTime(10);
                    if (!reader.IsDBNull(11)) detectionRepository.StandardTypeID = reader.GetGuid(11);

                    detectionRepository.MarkOld();
                    detectionRepositorylist.Add(detectionRepository);
                }
                reader.Close();
            }
            return detectionRepositorylist;
        }
        public IList<Core.Business.DetectionRepository> SelectDetectionRepositoryDynamic(string topcondition, string whereCondition, string orderByExpression)
        {
            IList<Core.Business.DetectionRepository> detectionRepositorylist = new List<Core.Business.DetectionRepository>();
            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_SelectDetectionRepositoriesDynamic");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.DetectionRepository detectionRepository = new Core.Business.DetectionRepository();

                    if (!reader.IsDBNull(0)) detectionRepository.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) detectionRepository.Head = reader.GetString(1);
                    if (!reader.IsDBNull(2)) detectionRepository.Subhead = reader.GetString(2);
                    if (!reader.IsDBNull(3)) detectionRepository.PublishDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) detectionRepository.StandardNumber = reader.GetString(4);
                    if (!reader.IsDBNull(5)) detectionRepository.Publisher = reader.GetString(5);
                    if (!reader.IsDBNull(6)) detectionRepository.TradeSortID = reader.GetGuid(6);
                    if (!reader.IsDBNull(7)) detectionRepository.Content = reader.GetString(7);
                    if (!reader.IsDBNull(8)) detectionRepository.Remark = reader.GetString(8);
                    if (!reader.IsDBNull(9)) detectionRepository.DranscriberID = reader.GetGuid(9);
                    if (!reader.IsDBNull(10)) detectionRepository.DranscribeDate = reader.GetDateTime(10);
                    if (!reader.IsDBNull(11)) detectionRepository.StandardTypeID = reader.GetGuid(11);

                    detectionRepository.MarkOld();
                    detectionRepositorylist.Add(detectionRepository);
                }
                reader.Close();
            }
            return detectionRepositorylist;
        }
        public Core.Business.DetectionRepository Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectDetectionRepository");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.DetectionRepository detectionRepository = new Core.Business.DetectionRepository();

                if (!reader.IsDBNull(0)) detectionRepository.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) detectionRepository.Head = reader.GetString(1);
                if (!reader.IsDBNull(2)) detectionRepository.Subhead = reader.GetString(2);
                if (!reader.IsDBNull(3)) detectionRepository.PublishDate = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) detectionRepository.StandardNumber = reader.GetString(4);
                if (!reader.IsDBNull(5)) detectionRepository.Publisher = reader.GetString(5);
                if (!reader.IsDBNull(6)) detectionRepository.TradeSortID = reader.GetGuid(6);
                if (!reader.IsDBNull(7)) detectionRepository.Content = reader.GetString(7);
                if (!reader.IsDBNull(8)) detectionRepository.Remark = reader.GetString(8);
                if (!reader.IsDBNull(9)) detectionRepository.DranscriberID = reader.GetGuid(9);
                if (!reader.IsDBNull(10)) detectionRepository.DranscribeDate = reader.GetDateTime(10);
                if (!reader.IsDBNull(11)) detectionRepository.StandardTypeID = reader.GetGuid(11);

                reader.Close();
                return detectionRepository;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
        public IList<Core.Business.DetectionRepository> GetRepositoryBySortID(Guid sortId, int pagenumber, int pagesize)
        {
            IList<Core.Business.DetectionRepository> detectionRepositoryList = new List<Core.Business.DetectionRepository>();
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@Tables", SqlDbType.VarChar, "DetectionRepository");
            sql.AddParameter("@PK", SqlDbType.VarChar, "Id");
            sql.AddParameter("@PageNumber", SqlDbType.Int, pagenumber);
            sql.AddParameter("@PageSize", SqlDbType.Int, pagesize);
            //sql.AddParameter("@LawSortID", SqlDbType.UniqueIdentifier, sortId);
            sql.AddParameter("@Filter", SqlDbType.VarChar, "[StandardTypeID]='" + sortId + "'");
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");
            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.DetectionRepository detectionRepository = new Core.Business.DetectionRepository();

                    if (!reader.IsDBNull(0)) detectionRepository.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) detectionRepository.Head = reader.GetString(1);
                    if (!reader.IsDBNull(2)) detectionRepository.Subhead = reader.GetString(2);
                    if (!reader.IsDBNull(3)) detectionRepository.PublishDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) detectionRepository.StandardNumber = reader.GetString(4);
                    if (!reader.IsDBNull(5)) detectionRepository.Publisher = reader.GetString(5);
                    if (!reader.IsDBNull(6)) detectionRepository.TradeSortID = reader.GetGuid(6);
                    if (!reader.IsDBNull(7)) detectionRepository.Content = reader.GetString(7);
                    if (!reader.IsDBNull(8)) detectionRepository.Remark = reader.GetString(8);
                    if (!reader.IsDBNull(9)) detectionRepository.DranscriberID = reader.GetGuid(9);
                    if (!reader.IsDBNull(10)) detectionRepository.DranscribeDate = reader.GetDateTime(10);
                    if (!reader.IsDBNull(11)) detectionRepository.StandardTypeID = reader.GetGuid(11);

                    detectionRepository.MarkOld();
                    detectionRepositoryList.Add(detectionRepository);
                }
                reader.Close();
            }
            return detectionRepositoryList;
        }