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


C# SavingBookContract.FirstDeposit方法代码示例

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


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

示例1: CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek

        public void CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
            _product.InterestFrequency = OSavingInterestFrequency.EndOfYear;
            SavingBookContract saving =
                new SavingBookContract(
                    ApplicationSettings.GetInstance(""),
                     new User(),
                    new DateTime(2009, 01, 01),
                    null)
                    {
                        Product = _product,
                        InterestRate = 0.1,
                        AgioFees = 8
                    };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Closure(new DateTime(2009, 01, 08), new User() { Id = 1 });

            int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
            int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count;

            Assert.AreEqual(7, accrualEvents);
            Assert.AreEqual(0, postingEvents);
            Assert.AreEqual(1000m, saving.GetBalance().Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:26,代码来源:TestSaving.cs

示例2: 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

示例3: AddSavingBook

        public void AddSavingBook()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                new User() { Id = 1 }, new DateTime(2009, 01, 01), _savingsBookProduct, null)
            {
                Code = "S/CR/2009/SAVIN-1/BAR-1", Status = OSavingsStatus.Active, InterestRate = 0.01, FlatWithdrawFees = 3, FlatTransferFees = 3
            };
            saving.InitialAmount = 1000;
            saving.EntryFees = 10;
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            User user = new User {Id = 1};
            saving.Events[0].User = user;
            saving.Events[0].Id = 400;
            saving.SavingsOfficer = user;
            saving.Id = _savingManager.Add(saving, new Person { Id = 6 });
            _savingEventManager.Add(saving.Events[0], saving.Id);

            SavingBookContract retrievedSaving = (SavingBookContract)_savingManager.Select(saving.Id);

            _compareSavings(saving, retrievedSaving);
        }
开发者ID:TalasZh,项目名称:opencbs,代码行数:22,代码来源:TestSavingsManager.cs

示例4: CalculateInterest_AccrualMode_Weekly_EndOfYear_OneClosure_DayOfCreation

        public void CalculateInterest_AccrualMode_Weekly_EndOfYear_OneClosure_DayOfCreation()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);

            _product.InterestBase = OSavingInterestBase.Weekly;
            _product.InterestFrequency = OSavingInterestFrequency.EndOfYear;
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                new DateTime(2009, 01, 15), null) { Product = _product, InterestRate = 0.1 };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 15), null, new User(), Teller.CurrentTeller);

            List<SavingEvent> events = saving.Closure(new DateTime(2009, 01, 15, 1, 1, 1), new User() { Id = 1 });

            int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
            int postingEvents = saving.Events.FindAll(item => item is SavingInterestsPostingEvent).Count;

            Assert.AreEqual(events.Count, 1);
            Assert.AreEqual(accrualEvents, 0);
            Assert.AreEqual(postingEvents, 0);
            Assert.AreEqual(saving.GetBalance(), 1000);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:20,代码来源:TestSaving.cs

示例5: CalculateInterest_AccrualMode_Weekly_EndOfWeek_OneClosure_AfterOneWeek

        public void CalculateInterest_AccrualMode_Weekly_EndOfWeek_OneClosure_AfterOneWeek()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
            _product.InterestBase = OSavingInterestBase.Weekly;
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                new DateTime(2009, 01, 01), null) { Product = _product, InterestRate = 0.1, ManagementFees = 10, AgioFees = 0.1 };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            List<SavingEvent> events = saving.Closure(new DateTime(2009, 01, 08, 1, 1, 1), new User() { Id = 1 });

            int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
            int postingEvents = saving.Events.FindAll(item => item is SavingInterestsPostingEvent).Count;

            Assert.AreEqual(3, events.Count);
            Assert.AreEqual(1, accrualEvents);
            Assert.AreEqual(1, postingEvents);
            Assert.AreEqual(1100m, saving.GetBalance().Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:18,代码来源:TestSaving.cs

示例6: Get_Balance_At_Date

        public void Get_Balance_At_Date()
        {
            SavingsBookProduct product = new SavingsBookProduct()
            {
                WithdrawFeesType = OSavingsFeesType.Flat,
                FlatWithdrawFees = 0
            };

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(), new DateTime(2009, 01, 01),
                product, null) { FlatWithdrawFees = 0, DepositFees = 5, CloseFees = 6, ManagementFees = 7};
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            //            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), false, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), false, false, OSavingsMethods.Cash, null, null);
            saving.Withdraw(230, new DateTime(2009, 02, 03), "retrait", new User(), false, null);

            Assert.AreEqual(saving.GetBalance(new DateTime(2009, 01, 31)), 1000);
            Assert.AreEqual(saving.GetBalance(new DateTime(2009, 02, 01)), 1100);
            Assert.AreEqual(saving.GetBalance(new DateTime(2009, 02, 02)), 1100);
            Assert.AreEqual(saving.GetBalance(new DateTime(2009, 02, 03)), 870);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:21,代码来源:TestSaving.cs

示例7: Get_Set_CreationDate

 public void Get_Set_CreationDate()
 {
     SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(), new DateTime(2008, 10, 21), null);
     saving.FirstDeposit(12m, new DateTime(2008, 10, 21), 0, new User(), Teller.CurrentTeller);
     Assert.AreEqual(new DateTime(2008, 10, 21), saving.CreationDate);
 }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:6,代码来源:TestSaving.cs

示例8: TestSaving_When_InitialAmount_IsNull

        public void TestSaving_When_InitialAmount_IsNull()
        {
            Assert.Ignore();
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                                new User())
                                            {
                                                CreationDate = TimeProvider.Today,
                                                InterestRate = 0.13,
                                                Product = _savingsProduct
                                            };

            _savingServices = new SavingServices(null, null, new User { Id = 6 });

            try
            {
                _savingServices.SaveContract(saving, new Person { Id = 6 });
                saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);
                Assert.Fail("Saving Contract shouldn't pass validation test before save (Initial Amount is Null).");
            }
            catch (OpenCbsSavingException exception)
            {
                Assert.AreEqual(exception.Code, OpenCbsSavingExceptionEnum.EntryFeesIsInvalid);
            }
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:24,代码来源:TestSavingServices.cs

示例9: 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

示例10: SetUp

        public void SetUp()
        {
            ApplicationSettings dataParam = ApplicationSettings.GetInstance("");
            dataParam.DeleteAllParameters();
            dataParam.AddParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);

            Currency currency = new Currency() { UseCents = true, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" };

            _product = new SavingsBookProduct
            {
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount,
                Id = 1,
                InterestBase = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfWeek,
                ManagementFeeFreq = new InstallmentType
                {
                    Id = 1,
                    Name = "Monthly",
                    NbOfDays = 0,
                    NbOfMonths = 1
                },
                AgioFeesFreq = new InstallmentType
                {
                    Id = 2,
                    Name = "Daily",
                    NbOfDays = 1,
                    NbOfMonths = 0
                },
                WithdrawFeesType = OSavingsFeesType.Flat,
                FlatWithdrawFees = 0,
                Currency = currency
            };

            _saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                             new DateTime(2007, 08, 11), _product, null);
            _saving.FirstDeposit(12m, new DateTime(2007, 08, 11), 0, new User(), new Teller());

            User.CurrentUser = new User {Id = 1};

            Teller.CurrentTeller = new Teller();
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:41,代码来源:TestSaving.cs

示例11: CalculateInterest_AccrualMode_Daily_EndOfMonth_OneClosure_65Days_AfterCreation

        public void CalculateInterest_AccrualMode_Daily_EndOfMonth_OneClosure_65Days_AfterCreation()
        {
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
            _product.InterestFrequency = OSavingInterestFrequency.EndOfMonth;
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(),
                new DateTime(2009, 01, 01), null) { Product = _product, InterestRate = 1, ManagementFees = 0, AgioFees = 0 };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Closure(new DateTime(2009, 03, 07), new User() { Id = 1 });

            int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
            int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count;
            //OCurrency interests = saving.Events.Where(item => item is SavingInterestsAccrualEvent).Sum(item => item.Amount.Value);

            Assert.AreEqual(accrualEvents, 65);
            Assert.AreEqual(postingEvents, 2);
            Assert.AreEqual(saving.GetBalance(), 929000);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:18,代码来源:TestSaving.cs

示例12: Get_Set_Product

 public void Get_Set_Product()
 {
     SavingsBookProduct product = new SavingsBookProduct { Id = 1 };
     SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                        new User(), TimeProvider.Today, null) {Product = product};
     saving.FirstDeposit(12m, TimeProvider.Today, 0, new User(), Teller.CurrentTeller);
     Assert.AreEqual(product, saving.Product);
 }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:8,代码来源:TestSaving.cs

示例13: OneMgmtFeeEvent

        public void OneMgmtFeeEvent()
        {
            // Fix
            //            Assert.Ignore();

            _saving = new SavingBookContract(
                                                ApplicationSettings.GetInstance(""),

                                                new User(),
                                                new DateTime(2007, 08, 11),
                                                _product,
                                                null
                                            );
            _saving.FirstDeposit(10000m, new DateTime(2007, 08, 11), 0, new User(), Teller.CurrentTeller);
            _saving.AgioFees = 0.1;
            _saving.ManagementFees = 50;
            _saving.Closure(new DateTime(2007, 9, 11), new User());
            List<SavingEvent> events = _saving.Events.FindAll(item => item is SavingManagementFeeEvent);
            Assert.AreEqual(events.Count, 1);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:20,代码来源:TestSaving.cs

示例14: Get_Set_InitialAmount

        public void Get_Set_InitialAmount()
        {
            List<SavingEvent> events = new List<SavingEvent>
               	{
               		new SavingWithdrawEvent {Amount = 75, Date = new DateTime(2008, 10, 21)},
               		new SavingDepositEvent {Amount = 12.46m, Date = new DateTime(2008, 08, 18)},
               		new SavingDepositEvent {Amount = 86, Date = new DateTime(2008, 09, 01)}
               	};
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(), new DateTime(2008, 07, 18), null);
            saving.InitialAmount = 1000;
            saving.FirstDeposit(1000, new DateTime(2008, 07, 18), null, new User(), Teller.CurrentTeller);

            saving.Events.AddRange(events);

            Assert.AreEqual(1023.46m, saving.GetBalance().Value);
            Assert.AreEqual(1000m, saving.InitialAmount.Value);
        }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:17,代码来源:TestSaving.cs

示例15: Get_Set_Id

 public void Get_Set_Id()
 {
     SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                        new User(), TimeProvider.Today, null) {Id = 1};
     saving.FirstDeposit(12m, TimeProvider.Today, 0, new User(), Teller.CurrentTeller);
     Assert.AreEqual(1, saving.Id);
 }
开发者ID:himmelreich-it,项目名称:opencbs,代码行数:7,代码来源:TestSaving.cs


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