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