Example #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DiDaJiangCheng.Model.tbCourseInfo> DataTableToList(DataTable dt)
        {
            List <DiDaJiangCheng.Model.tbCourseInfo> modelList = new List <DiDaJiangCheng.Model.tbCourseInfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DiDaJiangCheng.Model.tbCourseInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DiDaJiangCheng.Model.tbCourseInfo();
                    if (dt.Rows[n]["CourseId"].ToString() != "")
                    {
                        model.CourseId = int.Parse(dt.Rows[n]["CourseId"].ToString());
                    }
                    if (dt.Rows[n]["ClassId"].ToString() != "")
                    {
                        model.ClassId = int.Parse(dt.Rows[n]["ClassId"].ToString());
                    }
                    model.CourseName = dt.Rows[n]["CourseName"].ToString();
                    model.Semester   = dt.Rows[n]["Semester"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DiDaJiangCheng.Model.tbCourseInfo model)
 {
     return(dal.Update(model));
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DiDaJiangCheng.Model.tbCourseInfo model)
 {
     return(dal.Add(model));
 }