public List <UserPermission> GetUserPermissionInfoByUid(IDbCommand icmd, Guid uid) { icmd.Parameters.Clear(); MySqlCommand cmd = icmd as MySqlCommand; cmd.CommandType = CommandType.Text; string sql = @"select id,uid,pid,updatetime from t_user_permission where uid = '{0}'"; DataTable dt = new DataTable(); List <UserPermission> list = new List <UserPermission>(); dt.Load(cmd.ExecuteReader()); if (dt.Rows.Count > 0) { UserPermission info = null; foreach (DataRow dr in dt.Rows) { info = new UserPermission(); info.AllParse(dr); if (info != null) { list.Add(info); } } } return(list); }
public UserPermission GetUserPermissionInfoById(IDbCommand icmd, Guid id) { icmd.Parameters.Clear(); MySqlCommand cmd = icmd as MySqlCommand; cmd.CommandType = CommandType.Text; string sql = @"select id,uid,pid,updatetime from t_user_permission where id = '{0}'"; cmd.CommandText = string.Format(sql, id); DataTable dt = new DataTable(); UserPermission info = null; dt.Load(cmd.ExecuteReader()); if (dt.Rows.Count > 0) { info = new UserPermission(); info.AllParse(dt.Rows[0]); } return(info); }