示例#1
0
        public void UpdatePercentDed(float pValue)
        {
            PercentValue  value  = Value as PercentValue;
            MonetaryValue mValue = new MonetaryValue(value.Amount * pValue);

            Value   = mValue;
            DedType = TermValueType.Numeric;
        }
示例#2
0
        public static Cover GetCoverForTerm(Dictionary <string, object> coverDictionary)
        {
            int index = Convert.ToInt32(coverDictionary["Index"]);
            //bool franchise = Convert.ToBoolean(coverDictionary["IsFranchise"]);

            bool unlimited = false;
            bool franchise = false;

            if (coverDictionary.ContainsKey("isFranchise"))
            {
                franchise = true;
            }

            //if (!GetValueFromJSONExp(Convert.ToBoolean(coverDictionary["IsFranchise"]), out franchise))
            //    throw new InvalidOperationException("IsGranchise with index " + index.ToString() + " is not coded as monetary amount in CDL, cannot be supported at this time...");

            TermValueType vType = TermValueType.Numeric;
            Value         attpoint;
            Value         limit = null;
            Value         proRata;

            string name = coverDictionary["Label"].ToString();

            if (coverDictionary.ContainsKey("AttachmentSpecification"))
            {
                GetInfoFromJSONCoverExp(coverDictionary["AttachmentSpecification"], out attpoint, out vType);
            }
            else
            {
                attpoint = new MonetaryValue(0);
            }

            if (coverDictionary.ContainsKey("LimitSpecification"))
            {
                GetInfoFromJSONCoverExp(coverDictionary["LimitSpecification"], out limit, out vType);
            }
            else
            {
                unlimited = true;
            };

            if (coverDictionary.ContainsKey("Participation"))
            {
                GetInfoFromJSONCoverExp(coverDictionary["Participation"], out proRata, out vType);
            }
            else
            {
                proRata = new PercentValue(100);
            }

            TimeBasis attTimeBasis;
            TimeBasis limitTimeBasis;

            if (coverDictionary.ContainsKey("AttachmentTimeBasis"))
            {
                attTimeBasis = (TimeBasis)Enum.Parse(typeof(TimeBasis), coverDictionary["AttachmentTimeBasis"].ToString());
            }
            else
            {
                attTimeBasis = TimeBasis.Occurrence;
            }

            if (coverDictionary.ContainsKey("LimitTimeBasis"))
            {
                limitTimeBasis = (TimeBasis)Enum.Parse(typeof(TimeBasis), coverDictionary["LimitTimeBasis"].ToString());
            }
            else
            {
                limitTimeBasis = TimeBasis.Occurrence;
            }

            return(new Cover(name, franchise, attpoint, limit, (PercentValue)proRata, unlimited, attTimeBasis, limitTimeBasis, vType));
        }