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

            if (rowsCount > 0)
            {
                ForKids.DB.Model.KIDATTENDANCE model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ForKids.DB.Model.KIDATTENDANCE();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["KIDID"] != null && dt.Rows[n]["KIDID"].ToString() != "")
                    {
                        model.KIDID = int.Parse(dt.Rows[n]["KIDID"].ToString());
                    }
                    if (dt.Rows[n]["COURSEID"] != null && dt.Rows[n]["COURSEID"].ToString() != "")
                    {
                        model.COURSEID = int.Parse(dt.Rows[n]["COURSEID"].ToString());
                    }
                    if (dt.Rows[n]["ISATTEND"] != null && dt.Rows[n]["ISATTEND"].ToString() != "")
                    {
                        if ((dt.Rows[n]["ISATTEND"].ToString() == "1") || (dt.Rows[n]["ISATTEND"].ToString().ToLower() == "true"))
                        {
                            model.ISATTEND = true;
                        }
                        else
                        {
                            model.ISATTEND = false;
                        }
                    }
                    if (dt.Rows[n]["ATTENDDATE"] != null && dt.Rows[n]["ATTENDDATE"].ToString() != "")
                    {
                        model.ATTENDDATE = DateTime.Parse(dt.Rows[n]["ATTENDDATE"].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.KIDATTENDANCE> DataTableToList(DataTable dt)
 {
     List<ForKids.DB.Model.KIDATTENDANCE> modelList = new List<ForKids.DB.Model.KIDATTENDANCE>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         ForKids.DB.Model.KIDATTENDANCE model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new ForKids.DB.Model.KIDATTENDANCE();
             if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
             {
                 model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
             }
             if(dt.Rows[n]["KIDID"]!=null && dt.Rows[n]["KIDID"].ToString()!="")
             {
             //model.KIDID=dt.Rows[n]["KIDID"].ToString();
             }
             if(dt.Rows[n]["COURSEID"]!=null && dt.Rows[n]["COURSEID"].ToString()!="")
             {
             //model.COURSEID=dt.Rows[n]["COURSEID"].ToString();
             }
             if(dt.Rows[n]["ISATTEND"]!=null && dt.Rows[n]["ISATTEND"].ToString()!="")
             {
                 if((dt.Rows[n]["ISATTEND"].ToString()=="1")||(dt.Rows[n]["ISATTEND"].ToString().ToLower()=="true"))
                 {
                 model.ISATTEND=true;
                 }
                 else
                 {
                     model.ISATTEND=false;
                 }
             }
             if(dt.Rows[n]["ATTENDDATE"]!=null && dt.Rows[n]["ATTENDDATE"].ToString()!="")
             {
                 model.ATTENDDATE=DateTime.Parse(dt.Rows[n]["ATTENDDATE"].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.KIDATTENDANCE model)
 {
     return(dal.Update(model));
 }
Exemple #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(ForKids.DB.Model.KIDATTENDANCE model)
 {
     return(dal.Add(model));
 }