#region 数据四舍五入 /// <summary> /// 四舍五入 /// </summary> /// <param name="dblnum">源数据</param> /// <param name="numberprecision">小数位</param> /// <returns></returns> private double GetRound(object objnum, int numberprecision) { double returnnum = 0; if (objnum != null) { try { double dblnum = double.Parse(objnum.ToString()); int tmpNum = dblnum > 0 ? 5 : -5; double dblreturn = Math.Truncate(dblnum * Math.Pow(10, numberprecision + 1)) + tmpNum; dblreturn = Math.Truncate(dblreturn / 10) / Math.Pow(10, numberprecision); returnnum = dblreturn; } catch { } } return returnnum; } #endregion