Exemplo n.º 1
0
        public double PerformCalculation(double columnValue, DataRow row, DataSheetSettings settings)
        {
            if (IsConditionMet(columnValue) && IsValidForCalculation(row))
            {
                PrepareAmountFromOtherColumn(row, settings);
                switch (_Type)
                {
                case CalculationType.Addition:
                    columnValue = columnValue + _Amount;
                    break;

                case CalculationType.Division:
                    columnValue = columnValue / _Amount;
                    break;

                case CalculationType.Multiplication:
                    columnValue = columnValue * _Amount;
                    break;

                case CalculationType.Subtraction:
                    columnValue = columnValue - _Amount;
                    break;

                case CalculationType.Round:
                    columnValue = Math.Round(columnValue, int.Parse(Math.Ceiling(_Amount).ToString()));
                    break;
                }
            }
            return(columnValue);
        }
Exemplo n.º 2
0
 public double PerformCalculations(double columnValue, DataRow row, DataSheetSettings settings)
 {
     foreach (Calculation calculation in this)
     {
         columnValue = calculation.PerformCalculation(columnValue, row, settings);
     }
     return(columnValue);
 }
Exemplo n.º 3
0
 private void PrepareAmountFromOtherColumn(DataRow row, DataSheetSettings settings)
 {
     if (Column == null)
     {
         return;
     }
     _Amount = double.Parse(Column.FormattedColumnValue(row, settings));
 }