Esempio n. 1
0
        /// <summary>
        /// Makes the default response.
        /// </summary>
        /// <param name="evaluationValue">The evaluation value.</param>
        /// <param name="okStyle">The default style.</param>
        /// <returns></returns>
        protected tableStyleSetterResponse makeDefaultResponse(Double evaluationValue, dataTableStyleEntry okStyle, dataTableStyleEntry noStype)
        {
            //if (okStyle == null) okStyle = new dataTableStyleEntry();

            tableStyleSetterResponse output = null;

            if (evaluationValue == 0)
            {
                output = new tableStyleSetterResponse(noStype, this);
            }
            else if (evaluationValue > 0)
            {
                if (colorGradientDictionary != null)
                {
                    if (output == null)
                    {
                        output = new tableStyleSetterResponse(okStyle, this);
                    }

                    output.style.Background.Color    = ColorWorks.GetColor(colorGradientDictionary.GetColor(evaluationValue));
                    output.style.BackgroundAlt.Color = ColorWorks.GetColor(colorGradientDictionary.GetColor(evaluationValue)); //.ColorFromHex();
                }
                else
                {
                    output = new tableStyleSetterResponse(customStyleEntry, this);
                }
            }

            return(output);
        }
        /// <summary>
        /// Evaluates the specified row.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="table">The table.</param>
        /// <param name="defaultStyle">The default style.</param>
        /// <returns></returns>
        public tableStyleSetterResponse evaluate(DataRow row, DataTable table, dataTableStyleEntry defaultStyle)
        {
            tableStyleSetterResponse output = new tableStyleSetterResponse(defaultStyle, null);

            try
            {
                foreach (var unit in units)
                {
                    output = unit.evaluate(row, table, output);
                    if (output.style != defaultStyle)
                    {
                        return(output);
                    }
                }

                foreach (var item in items)
                {
                    output = item(row, table, output);
                    if (output.style != defaultStyle)
                    {
                        return(output);
                    }
                }
            }
            catch (Exception ex)
            {
                output.notes.Add(GetType().Name + "EVALUATE" + ex.Message);
                output.notes.Add(ex.StackTrace);
            }
            return(output);
        }