コード例 #1
0
ファイル: FinancialInstitution.cs プロジェクト: zibler/zibler
 /// <summary>
 /// Removes a PojectFeasibilityParameters from the list of
 /// ProjectFeasibilityParameters in this Financial Institution
 /// </summary>
 /// <param name="projectFeasibilityParameters">ProjectFeasibilityParameters to be removed</param>
 public virtual void RemoveProjectFeasibilityParameters(
     ProjectFeasibilityParameters projectFeasibilityParameters)
 {
     ProjectFeasibilityParameters.Remove (projectFeasibilityParameters);
 }
コード例 #2
0
        /// <summary>
        /// Updates the Project Feasibility parameters to the database
        /// </summary>
        /// <param name="parametersToUpdate">Parameters to update</param>
        /// <exception cref="ZiblerBusinessComponentsException" />
        public void UpdateProjectFeasibilityParameters(
            ProjectFeasibilityParameters parametersToUpdate)
        {
            try
            {
                IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO ();
                IProjectFeasibilityParametersDAO projectFeasibilityParametersDAO = _daoFactory.GetProjectFeasibilityParametersDAO ();

                DateTime? oldValidFrom = projectFeasibilityParametersDAO.GetProjectFeasibilityParametersDate (
                    parametersToUpdate.Id);

                if (oldValidFrom == null)
                    throw new ZiblerBusinessComponentsException (Resources.RecordNotFound);
                else
                {
                    //If the dates are the same then just go ahead and update
                    if (DateTime.Compare (oldValidFrom.Value,
                                          parametersToUpdate.ValidFrom.Value) == 0)
                    {
                        projectFeasibilityParametersDAO.MakePersistent (parametersToUpdate);
                    }
                    else
                    {
                        if (financialInstitutionDAO.ProjectFeasibilityParameterExists (
                            parametersToUpdate.FinancialInstitution.Name,
                            parametersToUpdate.ValidFrom))
                        {
                            throw new ZiblerBusinessComponentsException (
                                Resources.LoanTrackingParameterOperationsMsgProjectFeasibilityParameterExists);
                        }
                        else
                        {
                            //Go ahead and update.
                            projectFeasibilityParametersDAO.MakePersistent (parametersToUpdate);
                        }
                    }
                }
            }
            /* 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;
            }
        }
コード例 #3
0
ファイル: FinancialInstitution.cs プロジェクト: zibler/zibler
 /// <summary>
 /// Adds a new PojectFeasibilityParameters to the list of
 /// ProjectFeasibilityParameters in this Financial Institution
 /// </summary>
 /// <param name="projectFeasibilityParameters">ProjectFeasibilityParameters to be added</param>
 public virtual void AddProjectFeasibilityParameters(
     ProjectFeasibilityParameters projectFeasibilityParameters)
 {
     projectFeasibilityParameters.FinancialInstitution = this;
     ProjectFeasibilityParameters.Add (projectFeasibilityParameters);
 }
コード例 #4
0
        /// <summary>
        /// Create new project feasibility parameter in the system
        /// </summary>
        /// <param name="financialInstitution">Financial Institution name</param>
        /// <param name="username">user name</param>
        /// <param name="projectFeasibilityParameters">Project Feasibility parameters to be created</param>
        public void CreateNewProjectFeasibilityParameter(string financialInstitutionName,
            string username,
            ProjectFeasibilityParameters projectFeasibilityParameters)
        {
            try
            {
                IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO ();

                //Verify the user does not exist in the system first.
                if (financialInstitutionDAO.ProjectFeasibilityParameterExists (financialInstitutionName,
                                                                               projectFeasibilityParameters.ValidFrom))
                {
                    throw new ZiblerBusinessComponentsException (
                        Resources.LoanTrackingParameterOperationsMsgProjectFeasibilityParameterExists);
                }
                else
                {
                    //TODO: This may cause performance issues if they have a lot of financial forecast parameters items
                    //		the Add operation retrieves all the items from the database.
                    //Get the financial institution, and add the new compliance checklist
                    FinancialInstitution financialInstitution = financialInstitutionDAO.GetFinancialInstitutionByName (
                        financialInstitutionName);
                    financialInstitution.AddProjectFeasibilityParameters (projectFeasibilityParameters);
                }
            }
            /* 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;
            }
        }