Пример #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() + ")");
            }
        }
Пример #2
0
        private void UpdateGraphWithCover(Dictionary <string, object> coverDictionary, GraphOfNodes graph)
        {
            bool    nodefound = false;
            Type    type      = typeof(DedInteractionType);
            Subject sub       = GetSubjectForCover(coverDictionary);

            foreach (GraphNode node in graph.GraphNodes)
            {
                if (node is CoverNode)
                {
                    CoverNode coverNode = node as CoverNode;
                    Cover     cover     = TermParser.GetCoverForTerm(coverDictionary);
                    if (coverNode.Subject.Equals(sub) &&
                        coverNode.CoverName.Trim() == cover.CoverName.Trim())
                    {
                        nodefound       = true;
                        coverNode.Cover = cover;
                        break;
                    }
                }
            }
            if (!nodefound)
            {
                throw new InvalidOperationException("Cannot find Node in fixed graph, for JSON cover with subject: (" + sub.ToString() + ")");
            }
        }
Пример #3
0
        private void UpdateGraphWithLim(Dictionary <string, object> termDictionary, Graph graph)
        {
            bool    nodefound = false;
            Subject cdlSub    = GetSubjectForTerm(termDictionary);

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

                    if (termNode.Subject.Equals(cdlSub))
                    {
                        nodefound = true;
                        Limit limit = TermParser.GetLimitForTerm(termDictionary, graph.Declarations);
                        termNode.Limits.Add(limit);
                        break;
                    }
                }
            }
            if (!nodefound)
            {
                throw new InvalidOperationException("Cannot find Node in fixed graph, for JSON term with subject: (" + cdlSub.ToString() + ")");
            }
        }
Пример #4
0
        public override void Extract()
        {
            //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 }
                    });
                }
            }
        }
Пример #5
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 }
                    });
                }
            }
        }