示例#1
0
            public override object Evaluate(object[] arguments, ICalcContext context)
            {
                int           count         = 0;
                CalcReference calcReference = arguments[0] as CalcReference;

                foreach (IRange srcRange in calcReference.GetRanges())
                {
                    object[,] values = srcRange.Value as object[, ];
                    for (int row = 0; row < srcRange.Rows.Count; row++)
                    {
                        for (int col = 0; col < srcRange.Columns.Count; col++)
                        {
                            if (values[row, col] is double)
                            {
                                double num = (double)values[row, col];
                                if (num > 70)
                                {
                                    count++;
                                }
                            }
                        }
                    }
                }
                return(count);
            }
示例#2
0
            public override object Evaluate(object[] arguments, ICalcContext context)
            {
                double sum = 0d;

                foreach (var argument in arguments)
                {
                    foreach (var item in Enumerate(argument))
                    {
                        if (item is CalcError)
                        {
                            return(item);
                        }
                        if (item is double)
                        {
                            double value = (double)item;
                            if (value >= 500)
                            {
                                sum += (double)item;
                            }
                        }
                    }
                }

                return(sum);
            }
示例#3
0
            public override object Evaluate(object[] arguments, ICalcContext context)
            {
                if (arguments[0] is CalcReference)
                {
                    IEnumerable <IRange> ranges = (arguments[0] as CalcReference).GetRanges();

                    foreach (var range in ranges)
                    {
                        return(range.MergeCells);
                    }
                }

                return(false);
            }
示例#4
0
            public override object Evaluate(object[] arguments, ICalcContext context)
            {
                if (arguments[0] is CalcError)
                {
                    if ((CalcError)arguments[0] != CalcError.None && (CalcError)arguments[0] != CalcError.GettingData)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(false);
            }
示例#5
0
        /// <summary>
        /// Performs the necessary actions before the calculation.
        /// </summary>
        public void BeginCalculation(ICalcContext calcContext)
        {
            try
            {
                Monitor.Enter(this);

                foreach (CalcEngine calcEngine in calcEngines)
                {
                    calcEngine.BeginCalculation(calcContext);
                }
            }
            catch (Exception ex)
            {
                log.WriteError(ex, Locale.IsRussian ?
                               "Ошибка при выполнении действий перед расчётом" :
                               "Error performing actions before the calculation");
            }
        }
            public override object Evaluate(object[] arguments, ICalcContext context)
            {
                StringBuilder sb = new StringBuilder();

                string result = string.Empty;

                foreach (var argument in arguments)
                {
                    if (argument is CalcError)
                    {
                        return(argument);
                    }
                    if (argument is string || argument is double)
                    {
                        sb.Append(argument);
                    }
                }

                return(sb.ToString());
            }
示例#7
0
 public override object Evaluate(object[] arguments, ICalcContext context)
 {
     return((double)arguments[0] + (double)arguments[1]);
 }
示例#8
0
 /// <summary>
 /// Performs the necessary actions after the calculation.
 /// </summary>
 public void EndCalculation()
 {
     calcContext = null;
 }
示例#9
0
 /// <summary>
 /// Performs the necessary actions before the calculation.
 /// </summary>
 public void BeginCalculation(ICalcContext calcContext)
 {
     this.calcContext = calcContext;
 }