public IList<Core.Business.QualityRepository> GetAllQualityRepository()
        {
            IList<Core.Business.QualityRepository> qualityRepositorylist = new List<Core.Business.QualityRepository>();
            SqlServerUtility sql = new SqlServerUtility();

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

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.QualityRepository qualityRepository = new Core.Business.QualityRepository();

                    if (!reader.IsDBNull(0)) qualityRepository.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) qualityRepository.Head = reader.GetString(1);
                    if (!reader.IsDBNull(2)) qualityRepository.SystemSortID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) qualityRepository.Content = reader.GetString(3);
                    if (!reader.IsDBNull(4)) qualityRepository.Remark = reader.GetString(4);
                    if (!reader.IsDBNull(5)) qualityRepository.DranscriberID = reader.GetGuid(5);
                    if (!reader.IsDBNull(6)) qualityRepository.DranscribeDate = reader.GetDateTime(6);

                    qualityRepository.MarkOld();
                    qualityRepositorylist.Add(qualityRepository);
                }
                reader.Close();
            }
            return qualityRepositorylist;
        }
        public IList<Core.Business.QualityRepository> GetRepositoryByPage(string sqlwhere, int pagenumber, int pagesize)
        {
            IList<Core.Business.QualityRepository> qualityRepositorylist = new List<Core.Business.QualityRepository>();
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@Tables", SqlDbType.VarChar, "QualityRepository");
            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, sqlwhere);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");
            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.QualityRepository qualityRepository = new Core.Business.QualityRepository();

                    if (!reader.IsDBNull(0)) qualityRepository.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) qualityRepository.Head = reader.GetString(1);
                    if (!reader.IsDBNull(2)) qualityRepository.SystemSortID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) qualityRepository.Content = reader.GetString(3);
                    if (!reader.IsDBNull(4)) qualityRepository.Remark = reader.GetString(4);
                    if (!reader.IsDBNull(5)) qualityRepository.DranscriberID = reader.GetGuid(5);
                    if (!reader.IsDBNull(6)) qualityRepository.DranscribeDate = reader.GetDateTime(6);

                    qualityRepository.MarkOld();
                    qualityRepositorylist.Add(qualityRepository);
                }
                reader.Close();
            }
            return qualityRepositorylist;
        }
        public IList<Core.Business.QualityRepository> SelectQualityRepositoryDynamic(string topcondition, string whereCondition, string orderByExpression)
        {
            IList<Core.Business.QualityRepository> qualityRepositorylist = new List<Core.Business.QualityRepository>();
            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_SelectQualityRepositoriesDynamic");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.QualityRepository qualityRepository = new Core.Business.QualityRepository();

                    if (!reader.IsDBNull(0)) qualityRepository.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) qualityRepository.Head = reader.GetString(1);
                    if (!reader.IsDBNull(2)) qualityRepository.SystemSortID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) qualityRepository.Content = reader.GetString(3);
                    if (!reader.IsDBNull(4)) qualityRepository.Remark = reader.GetString(4);
                    if (!reader.IsDBNull(5)) qualityRepository.DranscriberID = reader.GetGuid(5);
                    if (!reader.IsDBNull(6)) qualityRepository.DranscribeDate = reader.GetDateTime(6);

                    qualityRepository.MarkOld();
                    qualityRepositorylist.Add(qualityRepository);
                }
                reader.Close();
            }
            return qualityRepositorylist;
        }
        public Core.Business.QualityRepository Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) qualityRepository.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) qualityRepository.Head = reader.GetString(1);
                if (!reader.IsDBNull(2)) qualityRepository.SystemSortID = reader.GetGuid(2);
                if (!reader.IsDBNull(3)) qualityRepository.Content = reader.GetString(3);
                if (!reader.IsDBNull(4)) qualityRepository.Remark = reader.GetString(4);
                if (!reader.IsDBNull(5)) qualityRepository.DranscriberID = reader.GetGuid(5);
                if (!reader.IsDBNull(6)) qualityRepository.DranscribeDate = reader.GetDateTime(6);

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

                return null;
            }
        }