コード例 #1
0
ファイル: DomainRule.cs プロジェクト: geffzhang/Wonka
        /// <summary>
        ///
        /// This method will use the provided values to set the domain of this rule.  More importantly,
        /// it will assist with the initialization of the rule by interpreting the provided values
        /// to detect which provided values are literal and which of them are Attribute names (which
        /// will be used to dynamically update the domain on every processed pair of records).
        ///
        /// <param name="asDomainValues">The set of values that are the domain for this particular rule</param>
        /// <returns>None</returns>
        /// </summary>
        public void SetDomain(string[] asDomainValues)
        {
            DomainCache.Clear();
            DomainValueProps.Clear();

            foreach (string sTempDomainVal in asDomainValues)
            {
                int nLiteralValueStartIdx = sTempDomainVal.IndexOf("'");
                if (nLiteralValueStartIdx >= 0)
                {
                    int nLiteralValueEndIdx = sTempDomainVal.LastIndexOf("'");

                    if (nLiteralValueEndIdx > nLiteralValueStartIdx)
                    {
                        string sLiteralValue =
                            sTempDomainVal.Substring(nLiteralValueStartIdx + 1, nLiteralValueEndIdx - nLiteralValueStartIdx - 1);

                        AddDomainValue(sLiteralValue, true, TARGET_RECORD.TRID_NONE);
                    }
                }
                else
                {
                    char[] acAttrNameDelim = new char[1] {
                        '.'
                    };

                    string        sAttrName     = sTempDomainVal;
                    TARGET_RECORD eTargetRecord = TARGET_RECORD.TRID_NEW_RECORD;

                    if (sTempDomainVal.Contains(acAttrNameDelim[0]))
                    {
                        string[] asAttrNameParts = sTempDomainVal.Split(acAttrNameDelim);

                        if (asAttrNameParts.Length > 1)
                        {
                            string sTargetRecord = asAttrNameParts[0];

                            sAttrName = asAttrNameParts[1];

                            if (sTargetRecord == "O")
                            {
                                eTargetRecord = TARGET_RECORD.TRID_OLD_RECORD;
                            }
                        }
                    }
                    else
                    {
                        sAttrName = sTempDomainVal;
                    }

                    AddDomainValue(sAttrName, false, eTargetRecord);
                }
            }
        }
コード例 #2
0
ファイル: DomainRule.cs プロジェクト: geffzhang/Wonka
        public WonkaBizRuleValueProps GetDomainValueProps(string psValue)
        {
            WonkaBizRuleValueProps oValueProps = null;

            if (!String.IsNullOrEmpty(psValue) && DomainValueProps.ContainsKey(psValue))
            {
                oValueProps = DomainValueProps[psValue];
            }

            return(oValueProps);
        }