示例#1
0
        private COLCollection GetContractCOLs()
        {
            COLCollection CausesofLoss;

            object Component;

            _contractJSON.TryGetValue("Declarations", out Component);
            Dictionary <String, Object> cdl_declarations = Component as Dictionary <String, object>;

            if (cdl_declarations.ContainsKey("CausesOfLoss"))
            {
                CausesofLoss = new COLCollection(Convert.ToString(cdl_declarations["CausesOfLoss"]));
            }
            else
            {
                CausesofLoss = CauseOfLoss.GetDefaultCOLs();
            }

            return(CausesofLoss);
        }
示例#2
0
        private bool SetDeclarations(Declarations graph_declarations, Dictionary <String, Object> cdl_declarations, out string message)
        {
            message = "";
            try
            {
                graph_declarations.Name = Convert.ToString(cdl_declarations["Name"]);

                if (cdl_declarations.ContainsKey("Currency"))
                {
                    graph_declarations.Currency = Convert.ToString(cdl_declarations["Currency"]);
                }
                if (cdl_declarations.ContainsKey("Inception"))
                {
                    graph_declarations.Inception = Convert.ToDateTime(cdl_declarations["Inception"]);
                }
                else
                {
                    graph_declarations.Inception = DateTime.Now;
                }
                if (cdl_declarations.ContainsKey("Expiration"))
                {
                    graph_declarations.Expiration = Convert.ToDateTime(cdl_declarations["Expiration"]);
                }
                else
                {
                    graph_declarations.Expiration = graph_declarations.Inception.AddYears(1);
                }

                if (cdl_declarations.ContainsKey("ContractType"))
                {
                    graph_declarations.ContractType = Convert.ToString(cdl_declarations["ContractType"]);
                }
                else
                {
                    throw new NotSupportedException("This prototype requies CDL to specify a recognized Contract Type");
                }

                if (cdl_declarations.ContainsKey("CausesOfLoss"))
                {
                    graph_declarations.CausesofLoss = new COLCollection(Convert.ToString(cdl_declarations["CausesOfLoss"]));
                }
                else
                {
                    graph_declarations.CausesofLoss = CauseOfLoss.GetDefaultCOLs();
                }

                if (cdl_declarations.ContainsKey("ExposureTypes"))
                {
                    graph_declarations.ExposureTypes = ExposureTypeCollection.BuildFromString(Convert.ToString(cdl_declarations["ExposureTypes"]));
                }
                else
                {
                    graph_declarations.ExposureTypes = ExposureTypeCollection.GetDefaultExposureTypes();
                }

                if (cdl_declarations.ContainsKey("Schedule"))
                {
                    try { graph_declarations.Schedule = expData.GetSchedule(Convert.ToString(cdl_declarations["Schedule"])); }
                    catch (Exception ex) { graph_declarations.Schedule = null; }
                }

                if (cdl_declarations.ContainsKey("GrossPosition"))
                {
                    graph_declarations.GrossPosition = Convert.ToString(cdl_declarations["GrossPosition"]).Split(',').ToList();
                }
                else
                {
                    graph_declarations.GrossPosition = new List <string>();
                }

                if (cdl_declarations.ContainsKey("CededPosition"))
                {
                    graph_declarations.CededPosition = Convert.ToString(cdl_declarations["CededPosition"]).Split(',').ToList();
                }
                else
                {
                    graph_declarations.CededPosition = new List <string>();
                }

                //Handle Claims Adjustment Options
                if (cdl_declarations.ContainsKey("Claims Adjustment Options"))
                {
                    Dictionary <String, Object> ClaimsAdjustmentOptions = cdl_declarations["Claims Adjustment Options"] as Dictionary <String, Object>;
                    if (ClaimsAdjustmentOptions.ContainsKey("Claims Adjustment Sublimits"))
                    {
                        string sublimitAdjustment = ClaimsAdjustmentOptions["Claims Adjustment Sublimits"].ToString();
                        if (sublimitAdjustment == "Net Of Deductible")
                        {
                            graph_declarations.GroundUpSublimits = false;
                        }
                        else if (sublimitAdjustment == "GroundUp")
                        {
                            graph_declarations.GroundUpSublimits = true;
                        }
                        else
                        {
                            throw new JSONParseException("Cannot support Claims Adjustment Option for Sublimits: " + sublimitAdjustment);
                        }
                    }

                    if (ClaimsAdjustmentOptions.ContainsKey("Claims Adjustment Deductibles"))
                    {
                        string dedAdjustment = ClaimsAdjustmentOptions["Claims Adjustment Deductibles"].ToString();
                        if (dedAdjustment == "Absorbable")
                        {
                            graph_declarations.MinimumAbsorbingDed = true;
                        }
                        else
                        {
                            throw new JSONParseException("Cannot support Claims Adjustment Option for Deductibles: " + dedAdjustment);
                        }
                    }
                }

                //Get Hours clause declarations
                graph_declarations.HoursClauses = new List <HoursClause>();
                Object[] hoursclauses;
                if (cdl_declarations.ContainsKey("Hours Clauses"))
                {
                    hoursclauses = cdl_declarations["Hours Clauses"] as object[];
                    List <Object> lst_hoursclauses = hoursclauses.OfType <Object>().ToList();

                    foreach (Dictionary <String, Object> hc in lst_hoursclauses)
                    {
                        HoursClause objHC = new HoursClause();
                        objHC.SetHoursClause(hc);
                        graph_declarations.HoursClauses.Add(objHC);
                    }

                    graph_declarations.IsHoursClause = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(true);
        }