string sqlstring = "select * from endpoint_policy where HEX([UserGuid]) =‘" + CommonHelper.ConvertGuid(uguid) + "‘"; var query = db.Database.SqlQuery<endpoint_policy>(sqlstring).AsQueryable(); var endpoint_policy = new PagedList<endpoint_policy>(query.OrderByDescending(c => c.CreatedOnUtc), pageIndex, pageSize);
public static string ConvertGuid(Guid gd) { string sgd = gd.ToString().ToUpper(); string sVar = ""; int i; foreach (string sv in new string[] { sgd.Substring(0, 8), sgd.Substring(9, 4), sgd.Substring(14, 4) }) { for (i = sv.Length - 2; i >= 0; i -= 2) { sVar += sv.Substring(i, 2); } } sgd = sgd.Substring(19).Replace("-", ""); for (i = 0; i < 8; i++) { sVar += sgd.Substring(2 * i, 2); } return sVar; }
时间: 2024-10-11 22:16:14