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

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