コード例 #1
0
ファイル: FinancialInstitution.cs プロジェクト: zibler/zibler
 /// <summary>
 /// Removes a Loan Commission from the list of Loan Commissions
 /// in this Financial Institution
 /// </summary>
 /// <param name="commission">Loan Commission to be removed</param>
 public virtual void RemoveLoanCommission(LoanCommission commission)
 {
     LoanCommissions.Remove (commission);
 }
コード例 #2
0
ファイル: FinancialInstitution.cs プロジェクト: zibler/zibler
 /// <summary>
 /// Adds a new Loan Commission to the list of Loan Commissions
 /// in this Financial Institution
 /// </summary>
 /// <param name="commission">Loan Commission to be added</param>
 public virtual void AddLoanCommission(LoanCommission commission)
 {
     commission.FinancialInstitution = this;
     LoanCommissions.Add (commission);
 }
コード例 #3
0
        /// <summary>
        /// Creates a new LoanCommission and adds it to the system
        /// </summary>
        /// <param name="financialInstitutionName">Financial Institution name</param>
        /// <param name="userName">User name</param>
        /// <param name="loanCommission">New LoanCommission</param>
        /// <exception cref="ZiblerBusinessComponentsException" />
        public void CreateNewLoanCommission(string financialInstitutionName,
            string userName,
            LoanCommission loanCommission)
        {
            try
            {
                IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO ();

                //Verify the user does not exist in the system first.
                if (financialInstitutionDAO.LoanCommissionExists (financialInstitutionName,
                                                                  loanCommission.Concept))
                {
                    throw new ZiblerBusinessComponentsException (
                        Resources.SystemParametersOperationMsgLoanCommissionExists);
                }
                else
                {
                    //Get the financial institution, and add the new interest to it.
                    FinancialInstitution financialInstitution = financialInstitutionDAO.GetFinancialInstitutionByName (
                        financialInstitutionName);
                    financialInstitution.AddLoanCommission (loanCommission);
                }
            }
            /* If the exception was thrown here, just pass it up */
            catch (ZiblerBusinessComponentsException ex)
            {
                throw;
            }
            /* Catch any Data Layer or other exception and throw an unkown exception */
            catch (Exception ex)
            {
                ZiblerBusinessComponentsUnknownException exc
                = new ZiblerBusinessComponentsUnknownException (ex);

                /* Throw the new exception */
                throw exc;
            }
        }
コード例 #4
0
ファイル: LoanParameter.cs プロジェクト: zibler/zibler
 /// <summary>
 /// Adds a new Loan Commission to the list of Loan Commissions
 /// in this Loan Parameter
 /// </summary>
 /// <param name="loanCommission">Loan Commission to be added</param>
 public virtual void AddLoanCommission(LoanCommission loanCommission)
 {
     LoanCommissions.Add(loanCommission);
 }
コード例 #5
0
        /// <summary>
        /// Update the LoanCommission and save it to the system
        /// </summary>
        /// <param name="loanCommisionToUpdate">Loan Commission to be updated</param>
        /// <exception cref="ZiblerBusinessComponentsException" />
        public void UpdateLoanCommission(LoanCommission loanCommisionToUpdate)
        {
            try
            {
                IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO ();
                ILoanCommissionDAO loanCommissionDAO = _daoFactory.GetLoanCommissionDAO ();

                string oldCommissionConcept = loanCommissionDAO.GetLoanCommissionConcept (
                    loanCommisionToUpdate.Id);

                if (String.Compare (oldCommissionConcept, loanCommisionToUpdate.Concept, true) == 0)
                {
                    loanCommissionDAO.MakePersistent (loanCommisionToUpdate);
                }
                else
                {
                    //TODO: Perhaps I should pass the financial institution name to this function,
                    //		since I create another query by accessing the loanCommisionToUpdate.FinancialInstitution.Name
                    //		which I should technically have before.
                    //Verify the user does not exist in the system first.
                    if (financialInstitutionDAO.LoanCommissionExists (
                        loanCommisionToUpdate.FinancialInstitution.Name,
                        loanCommisionToUpdate.Concept))
                    {
                        throw new ZiblerBusinessComponentsException (
                            Resources.SystemParametersOperationMsgLoanCommissionExists);
                    }
                    else
                    {
                        loanCommissionDAO.MakePersistent (loanCommisionToUpdate);
                    }
                }
            }
            /* If the exception was thrown here, just pass it up */
            catch (ZiblerBusinessComponentsException ex)
            {
                throw;
            }
            /* Catch any Data Layer or other exception and throw an unkown exception */
            catch (Exception ex)
            {
                ZiblerBusinessComponentsUnknownException exc
                = new ZiblerBusinessComponentsUnknownException (ex);

                /* Throw the new exception */
                throw exc;
            }
        }