Beispiel #1
0
        protected Offer(string productCode, DateTime policyFrom, DateTime policyTo, PolicyHolder policyHolder, Price price, string agentLogin)
        {
            this._covers = price.Prices
                           .Select(c => new Cover(c.Key, c.Value))
                           .ToList();

            this.Number               = Guid.NewGuid().ToString();
            this.ProductCode          = productCode;
            this.PolicyValidityPeriod = ValidityPeriod.Between(policyFrom, policyTo);
            this.PolicyHolder         = policyHolder;
            this.Status               = OfferStatus.New;
            this.TotalPrice           = price.Prices.Sum(c => c.Value);
            this.AgentLogin           = agentLogin;
        }
Beispiel #2
0
        public PolicyVersion EndsOn(DateTime date)
        {
            var endedCovers = this._covers.Select(x => x.EndsOn(date)).ToList();

            return(new PolicyVersion
            {
                Policy = this.Policy,
                VersionNumber = this.VersionNumber,
                PolicyHolder = this.PolicyHolder,
                CoverPeriod = this.CoverPeriod,
                VersionValidityPeriod = ValidityPeriod.Between(date.AddDays(1), this.VersionValidityPeriod.ValidTo),
                _covers = endedCovers,
                TotalPremiumAmount = endedCovers.Sum(x => x.Premium)
            });
        }