當前位置: 首頁>>代碼示例>>C#>>正文


C# SavingBookContract.GetBalance方法代碼示例

本文整理匯總了C#中OpenCBS.CoreDomain.Contracts.Savings.SavingBookContract.GetBalance方法的典型用法代碼示例。如果您正苦於以下問題:C# SavingBookContract.GetBalance方法的具體用法?C# SavingBookContract.GetBalance怎麽用?C# SavingBookContract.GetBalance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenCBS.CoreDomain.Contracts.Savings.SavingBookContract的用法示例。


在下文中一共展示了SavingBookContract.GetBalance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio

        public void CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio()
        {
            Assert.Ignore();
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
            _bookProduct.InterestFrequency = OSavingInterestFrequency.EndOfYear;
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(),
                new DateTime(2009, 01, 01), null) { Product = _bookProduct, InterestRate = 0.1, AgioFees = 0.1 };

            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;

            List<SavingEvent> agioEvents = saving.Events.FindAll(items => items is SavingAgioEvent);
            Assert.AreEqual(agioEvents.Count, 7);
            Assert.AreEqual(agioEvents[0].Fee, 10);
            Assert.AreEqual(saving.GetBalance(), -170);

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

            saving.Closure(new DateTime(2009, 01, 15), new User() { Id = 1 });
            List<SavingEvent> agioEvents2 = saving.Events.FindAll(items => items is SavingAgioEvent);
            Assert.AreEqual(agioEvents2.Count, 13);
            Assert.AreEqual(agioEvents2[9].Fee, 13);
            Assert.AreEqual(saving.GetBalance(), -51);
        }
開發者ID:TalasZh,項目名稱:opencbs,代碼行數:28,代碼來源:TestSavingFees.cs

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

示例3: CalculateInterest_AccrualMode_Daily_EndOfWeek_OneClosure_On_PostingDate

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

            saving.Closure(new DateTime(2009, 01, 05), 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, 4);
            Assert.AreEqual(postingEvents, 0);
            Assert.AreEqual(saving.GetBalance(), 1000);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:17,代碼來源:TestSaving.cs

示例4: CalculateInterest_AccrualMode_Daily_EndOfMonth_OneClosure_TwoMonthsAndOneBrouette_AfterCreation

        public void CalculateInterest_AccrualMode_Daily_EndOfMonth_OneClosure_TwoMonthsAndOneBrouette_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 = 0.01, ManagementFees = 10, AgioFees = 0.1 };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Closure(new DateTime(2009, 02, 04), 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(accrualEvents, 34);
            Assert.AreEqual(postingEvents, 1);
            Assert.AreEqual(saving.GetBalance(), 1299.9);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:17,代碼來源:TestSaving.cs

示例5: CalculateInterest_CashMode_Daily_EndOfWeek_OneClosure_On_PostingDate

        public void CalculateInterest_CashMode_Daily_EndOfWeek_OneClosure_On_PostingDate()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                new DateTime(2009, 01, 01), null) { Product = _product, InterestRate = 0.01, ManagementFees = 0, AgioFees = 0 };
            saving.FirstDeposit(100, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Closure(new DateTime(2009, 01, 05), 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, 5);
            Assert.AreEqual(postingEvents, 0);
            Assert.AreEqual(saving.GetBalance(), 100);
        }
開發者ID:TalasZh,項目名稱:opencbs,代碼行數:16,代碼來源:TestSaving.cs

示例6: RateWithdrawFees

        public void RateWithdrawFees()
        {
            SavingsBookProduct product = new SavingsBookProduct()
            {
                WithdrawFeesType = OSavingsFeesType.Rate,
                RateWithdrawFeesMin = 0.01,
                RateWithdrawFeesMax = 0.05
            };

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(), new DateTime(2009, 01, 01), product, null) { RateWithdrawFees = 0.03 };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);
            List<SavingEvent> withdrawEvents = saving.Withdraw(10, new DateTime(2009, 01, 02), "withdraw", new User(), false, null);

            Assert.AreEqual(1, withdrawEvents.Count);
            Assert.AreEqual(10, withdrawEvents[0].Amount.Value);
            Assert.AreEqual(0.3, ((ISavingsFees)withdrawEvents[0]).Fee.Value);
            Assert.AreEqual(989.7, saving.GetBalance().Value);
        }
開發者ID:TalasZh,項目名稱:opencbs,代碼行數:18,代碼來源:TestSavingFees.cs

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

示例8: CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio

        public void CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio()
        {
            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 = 0.1};
            saving.FirstDeposit(-100, new DateTime(2009, 01, 01), 0, 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(accrualEvents, 7);
            Assert.AreEqual(postingEvents, 0);
            Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.ACCOUNT_PAYABLE_INTERESTS_ON_SAVINGS_BOOKS, 1).Balance.Value, 700);
            Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.SAVINGS, 1).Balance.Value, 1000);
            Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.CASH, 1).Balance.Value, 1000);
            Assert.AreEqual(saving.ChartOfAccounts.GetAccountByNumber(OAccounts.INTERESTS_ON_DEPOSIT_ACCOUNT, 1).Balance.Value, 700);
             */

            List<SavingEvent> agioEvents = saving.Events.FindAll(items => items is SavingAgioEvent);
            Assert.AreEqual(agioEvents.Count, 7);
            Assert.AreEqual(agioEvents[0].Fee, 10);
            Assert.AreEqual(saving.GetBalance(), -194.88);

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

            saving.Closure(new DateTime(2009, 01, 15), new User() { Id = 1 });
            List<SavingEvent> agioEvents2 = saving.Events.FindAll(items => items is SavingAgioEvent);
            Assert.AreEqual(agioEvents2.Count, 7);
            Assert.AreEqual(saving.GetBalance(), 5.12);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:37,代碼來源:TestSaving.cs

示例9: Cancel_Last_Withdraw_Event_After_Closure

        public void Cancel_Last_Withdraw_Event_After_Closure()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(), new DateTime(2009, 01, 01),
                _product, null) { InterestRate = 0.1, FlatWithdrawFees = 0, AgioFees = 0.1 };
            saving.FirstDeposit(100, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Closure(new DateTime(2009, 01, 02), new User());
            saving.Withdraw(50, new DateTime(2009, 01, 02), "retrait", new User(), false, null);

            Assert.AreEqual(saving.GetBalance(), 50);

            saving.Closure(new DateTime(2009, 01, 05), new User());
            Assert.AreEqual(saving.GetBalance(), 50);
            saving.CancelLastEvent();
            Assert.AreEqual(saving.GetBalance(), 50);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:16,代碼來源:TestSaving.cs

示例10: Cancel_Last_Event

        public void Cancel_Last_Event()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Daily,
                InterestFrequency = OSavingInterestFrequency.EndOfWeek
            };

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                new User(), new DateTime(2009, 01, 01), product, null) { InterestRate = 0.1 };
            saving.FirstDeposit(100, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            Assert.AreEqual(saving.GetBalance(), 100);

            saving.CancelLastEvent();

            Assert.AreEqual(saving.GetBalance(), 100);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:19,代碼來源:TestSaving.cs

示例11: Cancel_Last_Deposit_Event_After_Closure

        public void Cancel_Last_Deposit_Event_After_Closure()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),  new User(), new DateTime(2009, 01, 01),
                _product, null) { InterestRate = 0.1, DepositFees = 5, CloseFees = 6, ManagementFees = 7, AgioFees = 8, OverdraftFees = 9};
            saving.FirstDeposit(100, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Closure(new DateTime(2009, 01, 02), new User());
            //            saving.Deposit(50, new DateTime(2009, 01, 02), "depot", new User(), false, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(50, new DateTime(2009, 01, 02), "depot", new User(), false, false, OSavingsMethods.Cash, null, null);

            Assert.AreEqual(saving.GetBalance(), 150);

            saving.Closure(new DateTime(2009, 01, 05), new User());
            Assert.AreEqual(saving.GetBalance(), 150);

            saving.CancelLastEvent();
            Assert.AreEqual(saving.GetBalance(), 150);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:18,代碼來源:TestSaving.cs

示例12: CalculateInterest_CashMode_Weekly_EndOfYear_OneClosure_AfterOnDay

        public void CalculateInterest_CashMode_Weekly_EndOfYear_OneClosure_AfterOnDay()
        {
            _product.InterestBase = OSavingInterestBase.Weekly;
            _product.InterestFrequency = OSavingInterestFrequency.EndOfYear;
            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, 02, 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,代碼行數:18,代碼來源:TestSaving.cs

示例13: CalculateInterest_CashMode_Daily_EndOfWeek_OneClosure_DayOfCreation

        public void CalculateInterest_CashMode_Daily_EndOfWeek_OneClosure_DayOfCreation()
        {
            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,代碼行數:16,代碼來源:TestSaving.cs

示例14: CalculateInterest_CashMode_Daily_EndOfDay_OneClosure_AfterOneDay

        public void CalculateInterest_CashMode_Daily_EndOfDay_OneClosure_AfterOneDay()
        {
            _product.InterestFrequency = OSavingInterestFrequency.EndOfDay;
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                                new User(),
                                                               new DateTime(2009, 01, 01), null)
                                            {Product = _product, InterestRate = 0.1};
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

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

            Assert.AreEqual(accrualEvents, 0);
            Assert.AreEqual(postingEvents, 0);
            Assert.AreEqual(saving.GetBalance(), 1000);
        }
開發者ID:himmelreich-it,項目名稱:opencbs,代碼行數:16,代碼來源:TestSaving.cs

示例15: CheckVirtualBalance

        private static decimal CheckVirtualBalance(SavingBookContract saving, OCurrency totalAmount)
        {
            // Virtual balance
            saving.Loans = ServicesProvider.GetInstance().GetSavingServices().SelectLoansBySavingsId(saving.Id);
            decimal totalAmountPercentage = 0;

            if ((saving.Loans != null && (saving.Loans.Count > 0)))
            {
                decimal balance = saving.GetBalance().Value;
                foreach (Loan assosiatedLoan in saving.Loans)
                {
                    if (assosiatedLoan.ContractStatus == OContractStatus.Active)
                    {
                        if (assosiatedLoan.CompulsorySavingsPercentage != null)
                            totalAmountPercentage += (assosiatedLoan.Amount.Value * (decimal)assosiatedLoan.CompulsorySavingsPercentage) / 100;
                    }
                }

                if ((balance - totalAmountPercentage) < totalAmount)
                {
                    return totalAmountPercentage;
                }
            }

            // should be 0 in case we can do operation
            return 0;
        }
開發者ID:TalasZh,項目名稱:opencbs,代碼行數:27,代碼來源:SavingServices.cs


注:本文中的OpenCBS.CoreDomain.Contracts.Savings.SavingBookContract.GetBalance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。