예제 #1
0
 public LoanProduct FindPackage(int idPackage)
 {
     try
     {
         LoanProduct package = _productManager.Select(idPackage);
         if (package == null)
         {
             return(null);
         }
         if (package.FundingLine != null)
         {
             package.FundingLine = _fundingLineManager.SelectFundingLineById(package.FundingLine.Id, false);
         }
         if (package.CycleId != null)
         {
             package.LoanAmountCycleParams = _productManager.SelectLoanAmountCycleParams((int)package.CycleId);
             package.RateCycleParams       = _productManager.SelectRateCycleParams((int)package.CycleId);
             package.MaturityCycleParams   = _productManager.SelectMaturityCycleParams((int)package.CycleId);
         }
         GetEntryFees(package);
         return(package);
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
        public void DeleteFundinLine()
        {
            FundingLineManager fundingLineManager = (FundingLineManager)container["FundingLineManager"];
            FundingLine        fund = new FundingLine
            {
                Purpose   = "Microsoft financement",
                Name      = "XXX",
                Deleted   = false,
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now,
                Currency  = new Currency {
                    Id = 1
                }
            };

            fundingLineManager.AddFundingLine(fund);

            FundingLine fundingLineInitial = fundingLineManager.SelectFundingLineById(fund.Id, false);

            Assert.AreEqual("XXX", fundingLineInitial.Name);
            fundingLineManager.DeleteFundingLine(fundingLineInitial);
            FundingLine fundingLineFinal = fundingLineManager.SelectFundingLineById(fundingLineInitial.Id, false);

            Assert.IsNull(fundingLineFinal);
        }
        public void AddFundingLineRuleForFundingLine()
        {
            Account        genericAccount  = _accountManager.Select(1);
            Account        specificAccount = _accountManager.Select(2);
            FundingLine    fundingLine     = _fundingLineManager.SelectFundingLineById(1, false);
            EventType      eventType       = _eventManager.SelectEventTypeByEventType("RGLE");
            EventAttribute eventAttribute  = _eventManager.SelectEventAttributeByCode("principal");

            FundingLineAccountingRule rule = new FundingLineAccountingRule
            {
                DebitAccount     = genericAccount,
                CreditAccount    = specificAccount,
                FundingLine      = fundingLine,
                BookingDirection = OBookingDirections.Credit,
                EventAttribute   = eventAttribute,
                EventType        = eventType
            };

            rule.Id = _accountingRuleManager.AddAccountingRule(rule);
            Assert.AreNotEqual(0, rule.Id);
        }
        private FundingLineAccountingRule SelectFundingLineAccountingRule(int pId)
        {
            const string sqlText = @"SELECT AccountingRules.id,
                                            AccountingRules.debit_account_number_id, 
                                            AccountingRules.credit_account_number_id,
                                            AccountingRules.booking_direction,
                                            FundingLineAccountingRules.funding_line_id
                                    FROM AccountingRules
                                    INNER JOIN FundingLineAccountingRules ON AccountingRules.id = FundingLineAccountingRules.id
                                    WHERE AccountingRules.id = @id";

            FundingLineAccountingRule rule;

            using (SqlConnection conn = GetConnection())
            {
                using (OpenCbsCommand select = new OpenCbsCommand(sqlText, conn))
                {
                    select.AddParam("@id", pId);

                    using (OpenCbsReader reader = select.ExecuteReader())
                    {
                        if (reader.Empty)
                        {
                            return(null);
                        }

                        reader.Read();
                        rule = _getFundingLineAccountingRule(reader);
                    }
                }
            }

            if (rule.FundingLine != null)
            {
                rule.FundingLine = _fundingLineManager.SelectFundingLineById(rule.FundingLine.Id, false);
            }

            return(rule);
        }
예제 #5
0
        public FundingLine SelectFundingLineById(int id, bool pAddOptionalEventInformations)
        {
            FundingLine fund = _fundingLineManager.SelectFundingLineById(id, pAddOptionalEventInformations);

            return(fund);
        }