Example #1
0
        private void UpdateGraphWithDed(Dictionary <string, object> termDictionary, GraphOfNodes graph)
        {
            bool    nodefound = false;
            int     count     = 0;
            Subject cdlSub    = GetSubjectForTerm(termDictionary);

            foreach (GraphNode node in graph.GraphNodes)
            {
                count++;
                if (node is TermNode)
                {
                    TermNode termNode = node as TermNode;

                    if (termNode.Subject.Equals(cdlSub))
                    {
                        nodefound = true;
                        Deductible ded = TermParser.GetDedForTerm(termDictionary, graph.Declarations);
                        termNode.Deductibles.Add(ded);
                        break;
                    }
                }
            }
            if (!nodefound)
            {
                throw new InvalidOperationException("Cannot find Node in fixed graph, for JSON term with subject: (" + cdlSub.ToString() + ")");
            }
        }
Example #2
0
        public override void Extract()
        {
            //Extract Deductibles
            object JSONDeductibles;

            jsonParseResult.TryGetValue("Deductibles", out JSONDeductibles);
            object[] Dedlist = JSONDeductibles as object[];

            foreach (object Obj in Dedlist)
            {
                Dictionary <string, object> Dict = Obj as Dictionary <string, object>;
                Deductible ded = TermParser.GetDedForTerm(Dict, Declarations);
                foreach (PrimarySubject priSub in GetSubjectForTerm(Dict))
                {
                    if (DedComponent.ContainsKey(priSub))
                    {
                        DedComponent[priSub].Add(ded);
                    }
                    else
                    {
                        DedComponent.Add(priSub, new DeductibleCollection(ded));
                    }
                }
            }

            //Extract Sublimits
            object JSONLimits;

            jsonParseResult.TryGetValue("Sublimits", out JSONLimits);
            object[] Limlist = JSONLimits as object[];

            foreach (object Obj in Limlist)
            {
                Dictionary <string, object> Dict = Obj as Dictionary <string, object>;
                Limit ded = TermParser.GetLimitForTerm(Dict, Declarations);
                foreach (PrimarySubject priSub in GetSubjectForTerm(Dict))
                {
                    if (LimComponent.ContainsKey(priSub))
                    {
                        LimComponent[priSub].Add(ded);
                    }
                    else
                    {
                        LimComponent.Add(priSub, new LimitCollection(ded));
                    }
                }
            }

            //Extract Covers
            object JSONCovers;

            jsonParseResult.TryGetValue("Covers", out JSONCovers);
            object[] Coverlist = JSONCovers as object[];

            foreach (object Obj in Coverlist)
            {
                Dictionary <string, object> Dict = Obj as Dictionary <string, object>;
                Cover   cover   = TermParser.GetCoverForTerm(Dict);
                Subject subject = GetSubjectForCover(Dict);
                if (CoverComponent.ContainsKey(subject))
                {
                    CoverComponent[subject].Add(cover.CoverName, cover);
                }
                else
                {
                    CoverComponent.Add(subject, new Dictionary <string, Cover>()
                    {
                        { cover.CoverName, cover }
                    });
                }
            }
        }