Exemplo n.º 1
0
        public double GetCustomerPortfolioLiability(int portfolioId)
        {
            double               liabilityValue    = 0;
            AssetDao             assetDao          = new AssetDao();
            Calculator           calculator        = new Calculator();
            List <LiabilitiesVo> listLiabilitiesVo = new List <LiabilitiesVo>();
            LiabilitiesVo        liabilityVo       = new LiabilitiesVo();

            try
            {
                listLiabilitiesVo = assetDao.GetCustomerPortfolioLiability(portfolioId);
                for (int i = 0; i < listLiabilitiesVo.Count; i++)
                {
                    liabilityVo = new LiabilitiesVo();
                    liabilityVo = listLiabilitiesVo[i];
                    if (liabilityVo.PaymentOptionCode == 1)
                    {
                        liabilityValue = liabilityValue + calculator.GetLoanOutstanding(liabilityVo.CompoundFrequency, liabilityVo.LoanAmount, liabilityVo.InstallmentStartDate, liabilityVo.InstallmentEndDate, 1, liabilityVo.LumpsumRepaymentAmount, liabilityVo.NoOfInstallments);
                    }
                    else if (liabilityVo.PaymentOptionCode == 2)
                    {
                        liabilityValue = liabilityValue + calculator.GetLoanOutstanding(liabilityVo.FrequencyCodeEMI, liabilityVo.LoanAmount, liabilityVo.InstallmentStartDate, liabilityVo.InstallmentEndDate, 2, liabilityVo.EMIAmount, liabilityVo.NoOfInstallments);
                    }
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "AssetBo.cs:GetCustomerPortfolioLiability(int portfolioId)");

                object[] objects = new object[1];
                objects[0] = portfolioId;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }

            return(liabilityValue);
        }