예제 #1
0
        /// <summary>
        /// 把秒转换成分钟
        /// </summary>
        /// <param name="second">秒</param>
        /// <param name="rectificationType">取整方式</param>
        /// <returns></returns>
        public static int SecondToMinute(int second, RectificationType rectificationType)
        {
            decimal mm = (decimal)second / 60;

            if (rectificationType.Id == RectificationType.Celling.Id)
            {
                return(Convert.ToInt32(Math.Ceiling(mm)));
            }

            if (rectificationType.Id == RectificationType.Floor.Id)
            {
                return(Convert.ToInt32(Math.Floor(mm)));
            }

            throw new BusinessException("不支持的取整方式", HttpStatus.Err.Id);
        }
예제 #2
0
        /// <summary>
        /// 把秒转换成分钟
        /// </summary>
        /// <param name="second">秒</param>
        /// <param name="rectificationType">取整方式</param>
        /// <returns></returns>
        public static int SecondToMinute(int second, RectificationType rectificationType)
        {
            decimal mm = (decimal)second / 60;

            if (rectificationType == RectificationType.Celling)
            {
                return(Convert.ToInt32(Math.Ceiling(mm)));
            }

            if (rectificationType == RectificationType.Floor)
            {
                return(Convert.ToInt32(Math.Floor(mm)));
            }

            throw new BusinessException("不支持的取整方式", ErrorCode.ParamError);
        }