/// <summary> /// Removes a DepreciationForecastParameters from the list of /// DepreciationForecastParameters in this Financial Institution /// </summary> /// <param name="depreciationForecastParameters">DepreciationForecastParameters to be removed</param> public virtual void RemoveDepreciationForecastParameters( DepreciationForecastParameters depreciationForecastParameters) { DepreciationForecastParameters.Remove (depreciationForecastParameters); }
/// <summary> /// Updates the depreciation forecast parameter in the system /// </summary> /// <param name="depFrcstPrmtrsToUpdt">Depreciation parameter to update</param> public void UpdateDepreciationForecastParameters( DepreciationForecastParameters depFrcstPrmtrsToUpdt) { try { IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO (); IDepreciationForecastParametersDAO depreciationForecastParametersDAO = _daoFactory.GetDepreciationForecastParametersDAO (); DateTime? oldValidFrom = depreciationForecastParametersDAO.GetDepreciationForecastParametersDate ( depFrcstPrmtrsToUpdt.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 (Convert.ToDateTime (oldValidFrom), Convert.ToDateTime (depFrcstPrmtrsToUpdt.ValidFrom)) == 0) depreciationForecastParametersDAO.MakePersistent (depFrcstPrmtrsToUpdt); else { if (financialInstitutionDAO.DepreciationForecastParameterExists ( depFrcstPrmtrsToUpdt.FinancialInstitution.Name, depFrcstPrmtrsToUpdt.ValidFrom)) { throw new ZiblerBusinessComponentsException ( Resources.LoanTrackingParameterOperationsMsgDepreciationForecastParameterExists); } else { //Go ahead and update. depreciationForecastParametersDAO.MakePersistent (depFrcstPrmtrsToUpdt); } } } } /* 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; } }
/// <summary> /// Adds a new DepreciationForecastParameters to the list of /// DepreciationForecastParameters in this Financial Institution /// </summary> /// <param name="depreciationForecastParameters">DepreciationForecastParameters to be added</param> public virtual void AddDepreciationForecastParameters( DepreciationForecastParameters depreciationForecastParameters) { depreciationForecastParameters.FinancialInstitution = this; DepreciationForecastParameters.Add (depreciationForecastParameters); }
/// <summary> /// Creates a new depreciation forecast parameter in the system /// </summary> /// <param name="financialInstitutionName">financialInstitution</param> /// <param name="username">username</param> /// <param name="depreciationForecastParameters">depreciationForecastParameters</param> /// <exception cref="ZiblerBusinessComponentsException" /> public void CreateNewDepreciationForecastParameter(string financialInstitutionName, string username, DepreciationForecastParameters depreciationForecastParameters) { try { IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO (); //Verify the user does not exist in the system first. if (financialInstitutionDAO.DepreciationForecastParameterExists ( financialInstitutionName, depreciationForecastParameters.ValidFrom)) { throw new ZiblerBusinessComponentsException ( Resources.LoanTrackingParameterOperationsMsgDepreciationForecastParameterExists); } 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.AddDepreciationForecastParameters ( depreciationForecastParameters); } } /* 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; } }