Example #1
0
 public MODEL.Users FindUser(MODEL.Users u)
 {
     StringBuilder strSql = new StringBuilder("select uId,uName,uLoginName,uPwd,uAddtime,uIsDel from Users ");
     strSql.Append(" where uLoginName=@uLoginName ");
     MODEL.Users model = new MODEL.Users();
     DataTable dt = DbHelperSQL.GetDataTable(strSql.ToString(), new SqlParameter("@uLoginName", u.ULoginName));
     if (dt.Rows.Count > 0)
     {
         LoadEntityData(model, dt.Rows[0]);
         return model;
     }
     else
     {
         return null;
     }
 }
Example #2
0
 /// <summary>
 /// a01.将数据表转换成泛型集合接口
 /// </summary>
 /// <param name="dt">数据表对象</param>
 /// <returns>泛型集合接口</returns>
 public IList<MODEL.Users> Table2List(DataTable dt)
 {
     List<MODEL.Users> list = null;
     if (dt.Rows.Count > 0)
     {
         list = new List<MODEL.Users>();
         MODEL.Users model = null;
         foreach (DataRow dr in dt.Rows)
         {
             model = new MODEL.Users();
             LoadEntityData(model, dr);
             list.Add(model);
         }
         return list;
     }
     return null;
 }