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


C# Loan.GetFirstUnpaidInstallment方法代码示例

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


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

示例1: CalculatePrincipalAndInterest

        private KeyValuePair<Loan, RepaymentEvent> CalculatePrincipalAndInterest(Loan loan, decimal amount, bool disableFees, decimal manualFees, int paymentOption)
        {
            try
            {
                int installmentNumber = loan.GetFirstUnpaidInstallment().Number;
                DateTime date = TimeProvider.Now;

                PaymentMethod paymentMethod =
                    ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(1);

                bool keepIntialSchedule = true;
                bool payProportion = false;

                switch (paymentOption)
                {
                    case 1:
                        keepIntialSchedule = true;
                        payProportion = false;
                        break;
                    case 2:
                        keepIntialSchedule = false;
                        payProportion = false;
                        break;
                    case 3:
                        keepIntialSchedule = false;
                        payProportion = true;
                        break;
                }

                return ServicesProvider.GetInstance().GetContractServices().ShowNewContract(loan,
                                                                                            installmentNumber,
                                                                                            date,
                                                                                            amount,
                                                                                            disableFees,
                                                                                            manualFees,
                                                                                            0,
                                                                                            false,
                                                                                            0,
                                                                                            keepIntialSchedule,
                                                                                            payProportion,
                                                                                            paymentMethod,
                                                                                            false,
                                                                                            false);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                LoadContracts();
            }

            return new KeyValuePair<Loan, RepaymentEvent>();
        }
开发者ID:aelhadi,项目名称:opencbs,代码行数:52,代码来源:FastRepaymentForm.cs

示例2: lvContracts_SubItemEndEditing

        private void lvContracts_SubItemEndEditing(object sender, UserControl.SubItemEndEditingEventArgs e)
        {
            if (4 == e.SubItem && e.Item.Tag != null)
            {
                e.Item.SubItems[e.SubItem].Tag = (OCurrency)decimal.Parse(e.DisplayText);
                e.Item.SubItems[e.SubItem].Text = e.DisplayText;
            }
            if (5 == e.SubItem && e.Item.Tag != null)
            {
                e.Item.SubItems[e.SubItem].Tag = (OCurrency)decimal.Parse(e.DisplayText);
                e.Item.SubItems[e.SubItem].Text = e.DisplayText;
            }

            var loan = new Loan();
            if (4 == e.SubItem || 5 == e.SubItem || 9 == e.SubItem && e.Item.Tag != null)
            {
                loan = e.Item.Tag as Loan;
            }

            if (loan != null && loan.Id != 0)
            {
                Installment i = loan.GetFirstUnpaidInstallment();
                bool disableFees = false;
                var result = new KeyValuePair<Loan, RepaymentEvent>();

                OCurrency penalties = (OCurrency)e.Item.SubItems[4].Tag;
                OCurrency principal = result.Value == null ? i.PrincipalHasToPay : result.Value.Principal;
                OCurrency interest = result.Value == null ? i.InterestHasToPay : result.Value.InterestPrepayment;
                OCurrency total;

                if (penalties != loan.CalculateDuePenaltiesForInstallment(i.Number, TimeProvider.Today))
                    disableFees = true;

                total = (OCurrency)e.Item.SubItems[5].Tag;
                if (e.SubItem == 5)
                {
                    if (total < 0)
                        throw new ArithmeticException("Total cannot be negative.");
                    if (total > penalties)
                    {
                        OCurrency remainder = total - penalties;
                        if (remainder > interest)
                        {
                            remainder -= interest;
                            principal = remainder > principal ? principal : remainder;
                            remainder -= principal;
                            total = principal + interest + penalties + remainder;
                        }
                        else
                        {
                            interest = remainder;
                            principal = 0;
                        }
                    }
                    else
                    {
                        penalties = total;
                        principal = 0;
                        interest = 0;
                    }
                }

                e.Item.SubItems[2].Text = principal.GetFormatedValue(loan.UseCents);
                e.Item.SubItems[2].Tag = principal;
                e.Item.SubItems[3].Text = interest.GetFormatedValue(loan.UseCents);
                e.Item.SubItems[3].Tag = interest;
                e.Item.SubItems[4].Text = penalties.GetFormatedValue(loan.UseCents);
                e.Item.SubItems[4].Tag = penalties;
                e.Item.SubItems[5].Text = total.GetFormatedValue(loan.UseCents);
                e.Item.SubItems[5].Tag = total;

                if (e.Item.SubItems.Count > 9)
                    e.Item.SubItems[9].Tag = cbItem.SelectedItem;

                if (5 == e.SubItem)
                    e.DisplayText = total.GetFormatedValue(loan.UseCents);

                if (9 == e.SubItem)
                    e.DisplayText = cbItem.SelectedItem.ToString();
                if (10 == e.SubItem)
                    e.Item.SubItems[10].Text = e.DisplayText;
                
                
                int paymentOption = cbItem.SelectedIndex + 1;

                KeyValuePair<Loan, RepaymentEvent> keyValuePair = CalculatePrincipalAndInterest(loan,
                                                                                                total.Value, 
                                                                                                disableFees, 
                                                                                                penalties.Value, 
                                                                                                paymentOption);
                if (keyValuePair.Value != null)
                {
                    e.Item.SubItems[2].Text =
                        keyValuePair.Value.Principal.GetFormatedValue(loan.Product.UseCents);
                    e.Item.SubItems[2].Tag = keyValuePair.Value.Principal;
                    e.Item.SubItems[3].Text =
                        keyValuePair.Value.Interests.GetFormatedValue(loan.Product.UseCents);
                    e.Item.SubItems[3].Tag = keyValuePair.Value.Interests;
                    e.Item.SubItems[4].Text =
                        keyValuePair.Value.Penalties.GetFormatedValue(loan.Product.UseCents);
//.........这里部分代码省略.........
开发者ID:aelhadi,项目名称:opencbs,代码行数:101,代码来源:FastRepaymentForm.cs


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