Exemple #1
0
        private void PrepareRunCond(List <ParBase> nonFootnotePar)
        {
            coParRunCond = GetUniquePar <ParCond>(DefPar.Common.Run_Cond);
            if (coParRunCond == null)
            {
                return;
            }

            coParRunCond.CheckAndPrepare(this);
            if (!coParRunCond.IsGlobal())
            {
                infoStore.communicator.ReportError(new Communicator.ErrorInfo()
                {
                    isWarning = true, message = $"{coParRunCond.description.Get()}: condition must use global variables only"
                });
            }
            else if (coParRunCond.IsGlobal(true)) // if read-time checking is possible (e.g. for IsUsedDataset, GetSystemYear, ...)
            {
                runCondMet_ReadTime = IsRunCondMet();
            }
            nonFootnotePar.Remove(coParRunCond); // remove, to not check and prepare again with the other parameters
        }
        protected override void PrepareNonCommonPar()
        {
            ParCateg parType = GetUniquePar <ParCateg>(DefPar.DefTu.Type);

            if (parType != null)
            {
                tuType = parType.GetCateg();
            }

            if (tuType != DefPar.Value.TUTYPE_IND)
            {
                // get the INCOME used to define the head
                headDefInc = GetUniquePar <ParVarIL>(DefPar.DefTu.HeadDefInc);
                if (headDefInc == null) // if no income defined, use ils_origy as default
                {
                    headDefInc             = new ParVarIL(infoStore);
                    headDefInc.xmlValue    = infoStore.country.sys.headDefInc == string.Empty ? DefVarName.ILSORIGY : infoStore.country.sys.headDefInc;
                    headDefInc.description = description;
                    headDefInc.CheckAndPrepare(this);
                }

                // get all the conditions and set the defaults if they did not exist before
                if (extHeadCond == null)
                {
                    extHeadCond = new ParCond(infoStore)
                    {
                        xmlValue = DefPar.DefTu.DEFAULT_CONDITION.EXTHEAD, description = description
                    };
                    extHeadCond.CheckAndPrepare(this);
                }
            }

            if (partnerCond == null)
            {
                partnerCond = new ParCond(infoStore)
                {
                    xmlValue = DefPar.DefTu.DEFAULT_CONDITION.PARTNER, description = description
                };
                partnerCond.CheckAndPrepare(this);
            }

            if (depChildCond == null)
            {
                depChildCond = new ParCond(infoStore)
                {
                    xmlValue = "{0}", description = description
                };
                depChildCond.CheckAndPrepare(this);
            }

            if (ownChildCond == null)
            {
                ownChildCond = new ParCond(infoStore)
                {
                    xmlValue = DefPar.DefTu.DEFAULT_CONDITION.OWNCHILD, description = description
                };
                ownChildCond.CheckAndPrepare(this);
            }

            if (ownDepChildCond == null)
            {
                ownDepChildCond = new ParCond(infoStore)
                {
                    xmlValue = DefPar.DefTu.DEFAULT_CONDITION.OWNDEPCHILD, description = description
                };
                ownDepChildCond.CheckAndPrepare(this);
            }

            if (looseDepChildCond == null)
            {
                looseDepChildCond = new ParCond(infoStore)
                {
                    xmlValue = DefPar.DefTu.DEFAULT_CONDITION.LOOSEDEPCHILD, description = description
                };
                looseDepChildCond.CheckAndPrepare(this);
            }

            if (depParentCond == null)
            {
                depParentCond = new ParCond(infoStore)
                {
                    xmlValue = DefPar.DefTu.DEFAULT_CONDITION.DEPPARENT, description = description
                };
                depParentCond.CheckAndPrepare(this);
            }

            if (depRelativeCond == null)
            {
                depRelativeCond = new ParCond(infoStore)
                {
                    xmlValue = DefPar.DefTu.DEFAULT_CONDITION.DEPRELATIVE, description = description
                };
                depRelativeCond.CheckAndPrepare(this);
            }

            if (loneParentCond == null)
            {
                loneParentCond = new ParCond(infoStore)
                {
                    xmlValue = DefPar.DefTu.DEFAULT_CONDITION.LONEPARENT, description = description
                };
                loneParentCond.CheckAndPrepare(this);
            }

            // get all the booleans and set the values
            ParBool noChildIfHeadPar = GetUniquePar <ParBool>(DefPar.DefTu.NoChildIfHead);

            noChildIfHead = noChildIfHeadPar != null && noChildIfHeadPar.GetBoolValue();
            ParBool noChildIfPartnerPar = GetUniquePar <ParBool>(DefPar.DefTu.NoChildIfPartner);

            noChildIfPartner = noChildIfPartnerPar != null && noChildIfPartnerPar.GetBoolValue();
            ParBool assignDepChOfDependentsPar = GetUniquePar <ParBool>(DefPar.DefTu.AssignDepChOfDependents);

            assignDepChOfDependents = assignDepChOfDependentsPar != null && assignDepChOfDependentsPar.GetBoolValue();
            ParBool assignPartnerOfDependentsPar = GetUniquePar <ParBool>(DefPar.DefTu.AssignPartnerOfDependents);

            assignPartnerOfDependents = assignPartnerOfDependentsPar != null && assignPartnerOfDependentsPar.GetBoolValue();
            ParBool stopIfNoHeadFoundPar = GetUniquePar <ParBool>(DefPar.DefTu.StopIfNoHeadFound);

            stopIfNoHeadFound = stopIfNoHeadFoundPar != null && stopIfNoHeadFoundPar.GetBoolValue();
            ParCateg multiplePartnersPar = GetUniquePar <ParCateg>(DefPar.DefTu.MultiplePartners);

            multiplePartners = multiplePartnersPar == null ? string.Empty : multiplePartnersPar.GetCateg();
        }