private void ConvertToModel(IDataReader reader, MyPracticeInfo model)
 {
     if (reader["Id"] != DBNull.Value)
         model.Id = Convert.ToInt32(reader["Id"]);
     if (reader["Title"] != DBNull.Value)
         model.Title = reader["Title"].ToString();
     if (reader["Content"] != DBNull.Value)
         model.Content = reader["Content"].ToString();
     if (reader["IsBatch"] != DBNull.Value)
         model.IsBatch = Convert.ToBoolean(reader["IsBatch"]);
     if (reader["OrganId"] != DBNull.Value)
         model.OrganId = Convert.ToInt32(reader["OrganId"]);
     if (reader["AccountId"] != DBNull.Value)
         model.AccountId = Convert.ToInt32(reader["AccountId"]);
     if (reader["PlanId"] != DBNull.Value)
         model.PlanId = Convert.ToInt32(reader["PlanId"]);
     if (reader["People"] != DBNull.Value)
         model.People = Convert.ToInt32(reader["People"]);
     if (reader["Display"] != DBNull.Value)
         model.Display = Convert.ToBoolean(reader["Display"]);
     if (reader["Delflag"] != DBNull.Value)
         model.Delflag = Convert.ToBoolean(reader["Delflag"]);
     if (reader["CreateDate"] != DBNull.Value)
         model.CreateDate = Convert.ToDateTime(reader["CreateDate"]);
     if (reader["AccountName"] != DBNull.Value)
         model.AccountName = reader["AccountName"].ToString();
     if (reader["Credits"] != DBNull.Value)
         model.Credits = Convert.ToDouble(reader["Credits"]);
     if (reader["Status"] != DBNull.Value)
         model.Status = Convert.ToInt32(reader["Status"]);
     if (reader["MpcId"] != DBNull.Value)
         model.MpcId = Convert.ToInt32(reader["MpcId"]);
     if (reader["Creater"] != DBNull.Value)
     {
         model.Creater = Convert.ToInt32(reader["Creater"]);
     }
     else
     {
         model.Creater = -1;
     }
     if (reader["CategoryName"] != DBNull.Value)
         model.CategoryName = reader["CategoryName"].ToString();
     if (reader["SubjectName"] != DBNull.Value)
         model.SubjectName = reader["SubjectName"].ToString();
     if (reader["RoleName"] != DBNull.Value)
         model.RoleName = reader["RoleName"].ToString();
     if (reader["NationTitle"] != DBNull.Value)
         model.NationTitle = reader["NationTitle"].ToString();
     if (reader["NationContent"] != DBNull.Value)
         model.NationContent = reader["NationContent"].ToString();
 }
        /// <summary>
        /// 获取我的实践分页数据集
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        /// <param name="where"></param>
        /// <param name="orderBy"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public List<MyPracticeInfo> GetMyPracticeList(int pageSize, int pageIndex, string where, string orderBy)
        {
            if (string.IsNullOrEmpty(orderBy))
                throw new ArgumentNullException();
            int start = (pageIndex - 1) * pageSize + 1;
            int end = pageIndex * pageSize;
            StringBuilder sql = new StringBuilder();
            sql.Append("select * from (select ROW_NUMBER() over (order by " + orderBy + ") as [RowNum],");
            sql.Append("A.*,");
            sql.Append("B.Status,B.Id as MpcId,B.Creater,");
            sql.Append("C.NickName as AccountName,");
            sql.Append("D.Credits,");
            sql.Append("E.Title as CategoryName,");
            sql.Append("F.Title as SubjectName,");
            sql.Append("G.Title as RoleName,");
            sql.Append("(select Title from NationalAbility_Course where Id=A.NationalCoursId) as NationTitle,");
            sql.Append("(select Content from NationalAbility_Course where Id=A.NationalCoursId) as NationContent");
            sql.Append(" from [dbo].[PracticalCourse_Detail] A");
            sql.Append(" join Member_PracticalCourse B on A.Id=B.PracticalCourseId");
            sql.Append(" join Member_Account C on B.AccountId=C.Id");
            sql.Append(" join PracticalCourse_RoleCredits D on B.RoleId=D.RoleId and A.TraingTopic=D.TraingTopic");
            sql.Append(" join Traning_Category E on E.Id=A.TraingCategory");
            sql.Append(" join Traning_Topic F on F.Id=A.TraingTopic");
            sql.Append(" join PracticalCourse_Role G on G.Id=B.RoleId");
            if (!string.IsNullOrEmpty(where))
                sql.Append(" where " + where);
            sql.Append(") as T where [RowNum] between " + start + " and " + end);

            List<MyPracticeInfo> list = new List<MyPracticeInfo>();
            using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql.ToString()))
            {
                while (reader.Read())
                {
                    MyPracticeInfo model = new MyPracticeInfo();
                    ConvertToModel(reader, model);
                    list.Add(model);
                }
            }
            return list;
        }