当前位置: 首页>>代码示例>>C#>>正文


C# SavingBookContract.CalculateInterest方法代码示例

本文整理汇总了C#中OpenCBS.CoreDomain.Contracts.Savings.SavingBookContract.CalculateInterest方法的典型用法代码示例。如果您正苦于以下问题:C# SavingBookContract.CalculateInterest方法的具体用法?C# SavingBookContract.CalculateInterest怎么用?C# SavingBookContract.CalculateInterest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenCBS.CoreDomain.Contracts.Savings.SavingBookContract的用法示例。


在下文中一共展示了SavingBookContract.CalculateInterest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PostingInterests_12Posting

        public void PostingInterests_12Posting()
        {
            //            Assert.Ignore();
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfMonth,
                Periodicity = new InstallmentType("Monthly", 0, 1)

            };

            User user = new User() {Id = 1};
            DateTime creationDate = new DateTime(2009, 01, 01);
            SavingBookContract saving = new SavingBookContract(
                                                                    ApplicationSettings.GetInstance(""),
                                                                    user,
                                                                    creationDate,
                                                                    null
                                                                )
                                                            {
                                                                Product = product,
                                                                InterestRate = 0.1
                                                            };
            DateTime closureDate = new DateTime(2010, 01, 01);
            saving.NextMaturity = saving.CreationDate.Date;
            saving.NumberOfPeriods = 1;
            saving.FirstDeposit(1000, creationDate, 0, user, new Teller());
            saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(
                                                                        saving.CreationDate.Date,
                                                                        saving.Product.Periodicity,
                                                                        saving.NumberOfPeriods);
            List<SavingInterestsAccrualEvent> interestsAccrualEvents =
                                    saving.CalculateInterest(closureDate, new User {Id = 1});
            foreach (var accrualEvent in interestsAccrualEvents)
            {
                saving.Events.Add(accrualEvent);
            }
            List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
            List<SavingInterestsPostingEvent> postingEvents = new List<SavingInterestsPostingEvent>();

            while (saving.NextMaturity.Value <= closureDate)
            {
                list = saving.PostingInterests(saving.NextMaturity.Value, new User() {Id = 1});
                postingEvents.AddRange(list);
                foreach (var postingEvent in list)
                {
                    saving.Events.Add(postingEvent);
                }
                saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(saving.NextMaturity.Value, saving.Periodicity, 1);
            }

            list = saving.PostingInterests(new DateTime(2010, 01, 01), new User { Id = 1 });

            Assert.AreEqual(12, postingEvents.Count);
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:56,代码来源:EndOfMonth.cs

示例2: CalculateInterest_NoDay

        public void CalculateInterest_NoDay()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfYear
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                new DateTime(2009, 07, 01), null) { Product = product, InterestRate = 0.1 };

            List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>();
            list = saving.CalculateInterest(new DateTime(2009, 07, 01), new User { Id = 1 });

            Assert.AreEqual(list.Count, 0);
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:16,代码来源:Daily.cs

示例3: CalculateInterest_OneMonth

        public void CalculateInterest_OneMonth()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1 };
            saving.FirstDeposit(100, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>();
            list = saving.CalculateInterest(new DateTime(2009, 02, 01), new User { Id = 1 });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 10);
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:19,代码来源:Monthly.cs

示例4: CalculateInterest_TwoOperation_In_OneDay

        public void CalculateInterest_TwoOperation_In_OneDay()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount,
                WithdrawFeesType = OSavingsFeesType.Flat,
                FlatWithdrawFees = 0
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1, FlatWithdrawFees = 0 };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Withdraw(250, new DateTime(2009, 01, 15), "retrait", new User(), false, null);
            //            saving.Deposit(100, new DateTime(2009, 01, 15), "depot", new User(), true, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(100, new DateTime(2009, 01, 15), "depot", new User(), true, false, OSavingsMethods.Cash, null, null);

            List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>();
            list = saving.CalculateInterest(new DateTime(2009, 02, 01), new User { Id = 1 });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 75);
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:25,代码来源:Monthly.cs

示例5: CalculateInterest_OneWeek_Withdraw_FirstDayOfMonth

        public void CalculateInterest_OneWeek_Withdraw_FirstDayOfMonth()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Weekly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount,
                WithdrawFeesType = OSavingsFeesType.Flat,
                FlatWithdrawFees = 0
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1, FlatWithdrawFees = 0 };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Withdraw(100, new DateTime(2009, 01, 01), "retrait", new User(), false, null, new PaymentMethod());

            List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>();
            list = saving.CalculateInterest(new DateTime(2009, 01, 08), new User { Id = 1 });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 90);
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:23,代码来源:Weekly.cs

示例6: PostingInterests_TenPosting

        public void PostingInterests_TenPosting()
        {
            //            Assert.Ignore();
            SavingsBookProduct product = new SavingsBookProduct
                                            {
                                                Id = 1,
                                                InterestBase = OSavingInterestBase.Daily,
                                                InterestFrequency = OSavingInterestFrequency.EndOfDay,
                                                Periodicity = new InstallmentType("Daily", 1, 0)
                                             };
            DateTime postingDate = new DateTime(2009, 01, 10);
            SavingBookContract saving = new SavingBookContract(
                                                                ApplicationSettings.GetInstance(""),
                                                                new User(),
                                                                new DateTime(2009, 01, 01),
                                                                null)
                                            {
                                                Product = product,
                                                InterestRate = 0.1,
                                                NextMaturity = new DateTime(2009, 01, 01)

                                            };

            List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
            List<SavingInterestsAccrualEvent> savingInterestsAccrualEvents = saving.CalculateInterest(
                                                                                        new DateTime(2009, 01, 10),
                                                                                        new User {Id = 1});
            foreach (SavingInterestsAccrualEvent accrualEvent in savingInterestsAccrualEvents)
            {
                saving.Events.Add(accrualEvent);
            }

            saving.NextMaturity = saving.CreationDate.AddDays(-1);

            while (
                    DateCalculationStrategy.GetNextMaturity(saving.NextMaturity.Value, saving.Product.Periodicity, 1)
                    <=
                    postingDate)
            {
                saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(saving.NextMaturity.Value,
                                                                              saving.Product.Periodicity, 1);
                list.AddRange(saving.PostingInterests(saving.NextMaturity.Value, new User { Id = 1 }));
                foreach (var postingEvent in list)
                {
                    saving.Events.Add(postingEvent);
                }
                list.Clear();
            }

            Assert.AreEqual(10, saving.Events.FindAll(item =>item is SavingInterestsPostingEvent).Count);
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:51,代码来源:EndOfDay.cs

示例7: PostingInterests_OnePosting

        public void PostingInterests_OnePosting()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfWeek,
                Periodicity = new InstallmentType("Weekly", 7, 0)

            };
            User user = new User(){Id=1};

            SavingBookContract saving = new SavingBookContract(
                                                                ApplicationSettings.GetInstance(""),
                                                                user,
                                                                new DateTime(2009, 01, 01),
                                                                null)
                                                                {
                                                                    Product = product, InterestRate = 0.1
                                                                };
            saving.NextMaturity = saving.GetNextMaturity(saving.CreationDate, saving.Periodicity);
            saving.FirstDeposit(1000, saving.CreationDate, 0, user, new Teller());
            List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
            List<SavingInterestsPostingEvent> postingEvents = new List<SavingInterestsPostingEvent>();
            DateTime closureDate = new DateTime(2009, 01, 05);
            List<SavingInterestsAccrualEvent> accrualEvents = saving.CalculateInterest(closureDate, user);
            foreach (var accrualEvent in accrualEvents)
            {
                saving.Events.Add(accrualEvent);
            }

            list = saving.PostingInterests(saving.NextMaturity.Value, user);
            postingEvents.AddRange(list);
            foreach (var postingEvent in list)
            {
                saving.Events.Add(postingEvent);
            }

            Assert.AreEqual( 1, postingEvents.Count);
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:40,代码来源:EndOfWeek.cs

示例8: PostingInterests_OnePosting

        public void PostingInterests_OnePosting()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfMonth,
                Periodicity = new InstallmentType("Monthly",0,1)

            };
            User user = new User() { Id = 1 };
            DateTime closureDate = new DateTime(2009, 02, 01);
            SavingBookContract saving = new SavingBookContract(
                                                                ApplicationSettings.GetInstance(""),
                                                                user,
                                                                new DateTime(2009, 01, 01),
                                                                null
                                                              )
                                                            {
                                                                Product = product,
                                                                InterestRate = 0.1
                                                            };
            saving.NextMaturity = DateCalculationStrategy.GetNextMaturity(saving.CreationDate.Date,
                saving.Periodicity, 1);

            List<SavingInterestsAccrualEvent> savingInterestsAccrualEvents =
                saving.CalculateInterest(closureDate, user);
            foreach (var accrualEvent in savingInterestsAccrualEvents)
            {
                saving.Events.Add(accrualEvent);
            }
            List<SavingInterestsPostingEvent> list = new List<SavingInterestsPostingEvent>();
            list = saving.PostingInterests(closureDate, user);

            Assert.AreEqual(1, list.Count);
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:36,代码来源:EndOfMonth.cs


注:本文中的OpenCBS.CoreDomain.Contracts.Savings.SavingBookContract.CalculateInterest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。