namespace Admin.NET.Core; /// /// 通用工具类 /// public static class CommonUtil { /// /// 生成百分数 /// /// /// /// public static string ExecPercent(decimal PassCount, decimal allCount) { string res = ""; if (allCount > 0) { var value = (double)Math.Round(PassCount / allCount * 100, 1); if (value < 0) res = Math.Round(value + 5 / Math.Pow(10, 0 + 1), 0, MidpointRounding.AwayFromZero).ToString(); else res = Math.Round(value, 0, MidpointRounding.AwayFromZero).ToString(); } if (res == "") res = "0"; return res + "%"; } }