Example #1
0
        /// <summary>删除基本单位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void UnitsGrid_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            var editedItem = e.Item as GridEditableItem;

            if (editedItem != null)
            {
                var webRudderInfo = _webRudder.GetWebRudder();
                var unitsId       = new Guid(editedItem.GetDataKeyValue("UnitsId").ToString());
                if (unitsId != webRudderInfo.DefaultUnitsId)
                {
                    try
                    {
                        _unitsWirte.Delete(unitsId);
                    }
                    catch
                    {
                        RAM.Alert("数量单位信息数据删除失败!");
                    }
                }
                else
                {
                    RAM.Alert("该数量单位为默认使用积分规则,不允许删除!");
                }
            }
        }
Example #2
0
        /// <summary>
        /// 调整金额分角
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public decimal CurrencyValue(decimal value)
        {
            var webRudderInfo = _webRudder.GetWebRudder() ?? new WebRudderInfo();

            switch (webRudderInfo.CurrencyDecimalType)
            {
            case 1:    //四舍五入
                value = Math.Round(value, webRudderInfo.CurrencyDecimalDigits);
                break;

            case 2:    //向上取整
                value = Math.Round(value, webRudderInfo.CurrencyDecimalDigits, MidpointRounding.AwayFromZero);
                break;

            case 3:    //向下取整
                value = Math.Round(value, webRudderInfo.CurrencyDecimalDigits, MidpointRounding.ToEven);
                break;
            }
            return(value);
        }