Example #1
0
        /// <summary>
        /// Executes the reduction.
        /// </summary>
        /// <returns>Returns the difference between two dates.</returns>
        public override object Execute()
        {
            List <string> test   = new List <string>();
            object        result = null;

            if (this.ParameterList.Count == 1)
            {
                result = this.ParameterList[0].Execute();
            }
            else
            {
                DateTime date1, date2;
                if (this.ParameterList[0].Execute() != null)
                {
                    if (DateTime.TryParse(this.ParameterList[0].Execute().ToString(), out date1))
                    {
                        if (this.ParameterList[1].Execute() != null)
                        {
                            if (DateTime.TryParse(this.ParameterList[1].Execute().ToString(), out date2))
                            {
                                result = FunctionUtils.GetDateDiff(currentInterval, date1, date2);
                            }
                        }
                    }
                }
            }

            // To prevent a null value in the param list from returning a zero
            //if (result == null)
            //{
            //    result = 0;
            //}

            return(result);
        }