Esempio n. 1
0
 public ModelHistory(IAccountTypeCustomer account, ILifecycle lifecycle, IPortfolioModel model, 
     bool isExecOnlyCustomer, AccountEmployerRelationship employerRelationship,
     IInternalEmployeeLogin employee, DateTime changeDate)
 {
     Account = account;
     Lifecycle = lifecycle;
     ModelPortfolio = model;
     IsExecOnlyCustomer = isExecOnlyCustomer;
     EmployerRelationship = employerRelationship;
     Employee = employee;
     ChangeDate = changeDate.Date;
 }
Esempio n. 2
0
        /// <summary>
        /// The method to alter the Model portfolio
        /// </summary>
        /// <param name="lifecycle">The current lifecycle</param>
        /// <param name="newModelPortfolio">The new model portfolio</param>
        /// <param name="isExecOnlyCustomer">Is this an execution only customer</param>
        /// <param name="employerRelationship">The relationship that the account has to the company</param>
        /// <param name="employee">The employee who performs the change</param>
        /// <param name="changeDate">The date of the change</param>
        /// <returns></returns>
        public bool SetModelPortfolio(ILifecycle lifecycle, IPortfolioModel newModelPortfolio,
            bool isExecOnlyCustomer, AccountEmployerRelationship employerRelationship,
            IInternalEmployeeLogin employee, DateTime changeDate)
        {
            ModelPortfolioChanges.Add(new ModelHistory.ModelHistory(this, lifecycle, newModelPortfolio, isExecOnlyCustomer, employerRelationship, employee, changeDate));
            IsExecOnlyCustomer = isExecOnlyCustomer;
            if (this.AccountType == AccountTypes.Customer)
                ((ICustomerAccount)this).EmployerRelationship = employerRelationship;
            ModelPortfolio = newModelPortfolio;

            if (CurrentManagementFeePeriod == null && Util.IsNotNullDate(FirstManagementStartDate) && Util.IsNullDate(FinalManagementEndDate))
                createManagementFeePeriod(changeDate);
            return true;
        }
Esempio n. 3
0
        public bool Edit(IPortfolioModel model, bool isExecOnlyCustomer, AccountEmployerRelationship employerRelationship,
            IInternalEmployeeLogin employee, DateTime changeDate)
        {
            // It is not possible to edit the model, IsExecOnlyCustomer || EmployerRelationship for the latest item
            if (EndDate == DateTime.MinValue)
            {
                if (this.ModelPortfolio != model ||
                    this.IsExecOnlyCustomer != isExecOnlyCustomer ||
                    this.EmployerRelationship != employerRelationship)
                    throw new ApplicationException("It is not possible to update data on the latest history item. Otherwise the data would no longer be in sync");

                if (changeDate != this.ChangeDate && Account != null && Account.ModelPortfolioChanges != null && Account.ModelPortfolioChanges.Count > 0)
                {
                    int check = (from a in Account.ModelPortfolioChanges
                                where a.Key != this.Key && a.ChangeDate > changeDate
                                select a).Count();
                    if (check > 0)
                        throw new ApplicationException("It is not possible to change the date of the latest history item to a date prior a previous history items.");
                }
            }

            this.ModelPortfolio = model;
            this.IsExecOnlyCustomer = isExecOnlyCustomer;
            this.EmployerRelationship = employerRelationship;
            this.ChangeDate = changeDate;
            this.Employee = employee;
            return true;
        }