Exemple #1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="cur2"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        protected TRptSwitch ParseSwitch(XmlNode cur2, int order)
        {
            TRptSwitch ReturnValue;
            XmlNode cur;
            Object rg;
            Object r;
            TRptSwitch element;

            ReturnValue = null;
            cur = cur2;

            if (cur.Name == "switch")
            {
                element = new TRptSwitch(order);
                cur = NextNotBlank(cur.FirstChild);
                rg = ParseGroup(cur, ref report.casesId, "case", out cur);

                if (rg != null)
                {
                    element.rptGrpCases = ((List <TRptCase> )rg);
                }

                r = Parse(cur, ref report.casesId, "default");

                if (r != null)
                {
                    element.rptDefault = (TRptCase)r;
                }

                ReturnValue = element;
            }

            return ReturnValue;
        }
Exemple #2
0
        /// <summary>
        /// calculate the value of a switch
        /// </summary>
        /// <param name="rptSwitch"></param>
        /// <returns></returns>
        public TVariant Calculate(TRptSwitch rptSwitch)
        {
            TVariant ReturnValue;
            TRptDataCalcField rptDataCalcField;
            TRptDataCalcValue rptDataCalcValue;
            TRptDataCalcSwitch rptDataCalcSwitch;
            TRptCase rptCase;

            ReturnValue = new TVariant();
            rptCase = GetFittingCase(rptSwitch);

            if (rptCase == null)
            {
                return ReturnValue;
            }

            if (rptCase.rptSwitch != null)
            {
                rptDataCalcSwitch = new TRptDataCalcSwitch(this);
                ReturnValue.Add(rptDataCalcSwitch.Calculate(rptCase.rptSwitch));
            }
            else
            {
                if (rptCase.rptGrpField != null)
                {
                    rptDataCalcField = new TRptDataCalcField(this);
                    rptDataCalcField.Calculate(rptCase.rptGrpField);
                }

                if (rptCase.rptGrpValue != null)
                {
                    rptDataCalcValue = new TRptDataCalcValue(this);
                    ReturnValue.Add(rptDataCalcValue.Calculate(rptCase.rptGrpValue));
                }
            }

            return ReturnValue;
        }
Exemple #3
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="cur"></param>
        /// <param name="group"></param>
        /// <param name="groupId"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        protected List <TRptSwitch>ParseIfGroup(XmlNode cur, List <TRptSwitch>group, int groupId, int order)
        {
            TRptSwitch element;
            TRptCase ifcase;

            if (group == null)
            {
                group = new List <TRptSwitch>();
            }

            element = new TRptSwitch(order);
            element.rptGrpCases = new List <TRptCase>();
            ifcase = ParseCase(cur, 0);
            element.rptGrpCases.Add(ifcase);
            group.Add(element);
            return group;
        }
Exemple #4
0
        /// <summary>
        /// this procedure should be used in levels only
        /// </summary>
        /// <returns>void</returns>
        public void Calculate(TRptSwitch rptSwitch, out List <TRptLowerLevel>rptGrpLowerLevel, out List <TRptField>rptGrpField)
        {
            TRptDataCalcSwitch calcSwitch;
            TRptCase rptCase;

            rptGrpField = null;
            rptGrpLowerLevel = null;
            rptCase = GetFittingCase(rptSwitch);

            if (rptCase != null)
            {
                rptGrpField = rptCase.rptGrpField;
                rptGrpLowerLevel = rptCase.rptGrpLowerLevel;

                if (rptCase.rptSwitch != null)
                {
                    calcSwitch = new TRptDataCalcSwitch(this);
                    calcSwitch.Calculate(rptCase.rptSwitch, out rptGrpLowerLevel, out rptGrpField);
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// based on the evaluation of the condition for each case, return the one case that fits
        /// </summary>
        /// <param name="rptSwitch"></param>
        /// <returns></returns>
        protected TRptCase GetFittingCase(TRptSwitch rptSwitch)
        {
            TRptCase ReturnValue;
            TRptCase rptCase;
            int counter;

            counter = 0;
            ReturnValue = null;

            if (rptSwitch.rptGrpCases != null)
            {
                while ((counter < rptSwitch.rptGrpCases.Count) && (ReturnValue == null))
                {
                    rptCase = (TRptCase)rptSwitch.rptGrpCases[counter];

                    if (EvaluateCondition(rptCase.strCondition))
                    {
                        ReturnValue = rptCase;
                    }

                    counter++;
                }
            }

            if (ReturnValue == null)
            {
                ReturnValue = rptSwitch.rptDefault;
            }

            return ReturnValue;
        }
Exemple #6
0
 /// <summary>
 /// constructor
 /// </summary>
 public TRptCase(int order)
 {
     rptGrpLowerLevel = null;
     rptGrpField = null;
     rptGrpValue = null;
     rptSwitch = null;
 }
Exemple #7
0
 /// <summary>
 /// constructor
 /// </summary>
 public TRptFieldDetail(int order)
 {
     rptSwitch = null;
     rptIf = null;
     rptGrpValue = null;
 }
Exemple #8
0
 /// <summary>
 /// constructor
 /// </summary>
 public TRptDetail(int order)
 {
     rptSwitch = null;
     rptGrpLowerLevel = null;
     rptGrpField = null;
 }