Exemple #1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<ForKids.DB.Model.COURSEBASE> DataTableToList(DataTable dt)
 {
     List<ForKids.DB.Model.COURSEBASE> modelList = new List<ForKids.DB.Model.COURSEBASE>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         ForKids.DB.Model.COURSEBASE model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new ForKids.DB.Model.COURSEBASE();
             if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
             {
                 model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
             }
             if(dt.Rows[n]["NAME"]!=null && dt.Rows[n]["NAME"].ToString()!="")
             {
             model.NAME=dt.Rows[n]["NAME"].ToString();
             }
             if(dt.Rows[n]["GRADEID"]!=null && dt.Rows[n]["GRADEID"].ToString()!="")
             {
                 model.GRADEID=int.Parse(dt.Rows[n]["GRADEID"].ToString());
             }
             if(dt.Rows[n]["DESCRIPTION"]!=null && dt.Rows[n]["DESCRIPTION"].ToString()!="")
             {
             model.DESCRIPTION=dt.Rows[n]["DESCRIPTION"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemple #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ForKids.DB.Model.COURSEBASE> DataTableToList(DataTable dt)
        {
            List <ForKids.DB.Model.COURSEBASE> modelList = new List <ForKids.DB.Model.COURSEBASE>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ForKids.DB.Model.COURSEBASE model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ForKids.DB.Model.COURSEBASE();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["NAME"] != null && dt.Rows[n]["NAME"].ToString() != "")
                    {
                        model.NAME = dt.Rows[n]["NAME"].ToString();
                    }
                    if (dt.Rows[n]["GRADEID"] != null && dt.Rows[n]["GRADEID"].ToString() != "")
                    {
                        model.GRADEID = int.Parse(dt.Rows[n]["GRADEID"].ToString());
                    }
                    if (dt.Rows[n]["DESCRIPTION"] != null && dt.Rows[n]["DESCRIPTION"].ToString() != "")
                    {
                        model.DESCRIPTION = dt.Rows[n]["DESCRIPTION"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ForKids.DB.Model.COURSEBASE model)
 {
     return(dal.Update(model));
 }
Exemple #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(ForKids.DB.Model.COURSEBASE model)
 {
     return(dal.Add(model));
 }