Exemplo n.º 1
0
 public override bool Approve(IInternalEmployeeLogin employee, bool raiseStornoLimitExceptions)
 {
     bool success = approve(employee, raiseStornoLimitExceptions);
     if (success && !IsStorno)
         setOrderStatus(OrderStateEvents.CheckFill);
     return success;
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
 public RemisierHistory(IRemisierEmployee remisierEmployee, 
     decimal kickBack, decimal introductionFee, decimal introductionFeeReduction,
     decimal subsequentDepositFee, decimal subsequentDepositFeeReduction,
     IInternalEmployeeLogin employee, DateTime changeDate)
 {
     RemisierEmployee = remisierEmployee;
     KickBack = kickBack;
     IntroductionFee = introductionFee;
     SubsequentDepositFee = subsequentDepositFee;
     IntroductionFeeReduction = introductionFeeReduction;
     SubsequentDepositFeeReduction = subsequentDepositFeeReduction;
     Employee = employee;
     ChangeDate = changeDate.Date;
 }
Exemplo n.º 4
0
 public abstract IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry);
Exemplo n.º 5
0
 public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry)
 {
     CashDividend newStorno = new CashDividend();
     newStorno.DividendDetails = this.DividendDetails;
     newStorno.UnitsInPossession = this.UnitsInPossession;
     return this.storno(employee, reason, journalEntry, newStorno);
 }
Exemplo n.º 6
0
 public override bool Approve(IInternalEmployeeLogin employee, bool raiseStornoLimitExceptions)
 {
     return approve(employee, raiseStornoLimitExceptions);
 }
Exemplo n.º 7
0
 public override bool Approve(IInternalEmployeeLogin employee)
 {
     return Approve(employee, false);
 }
Exemplo n.º 8
0
        public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry)
        {
            if (Status != BondCouponPaymentStati.Settled)
                throw new ApplicationException("It is not possible to storno a bond interest payements that has not a status of paid.");

            if (Position.BondCouponPayments.Where(x =>
                x.CouponHistory.StartAccrualDate > this.CouponHistory.EndAccrualDate &&
                ((x.Status == BondCouponPaymentStati.Settled &&
                !(x.StornoBooking != null || x.IsStorno)) ||
                x.Status == BondCouponPaymentStati.Active)).Count() > 0)
                throw new ApplicationException(string.Format("Bond interest payements exists after {0} that should be stornoed first.", CouponHistory.EndAccrualDate.ToShortDateString()));

            BondCouponPayment newStorno = new BondCouponPayment();
            newStorno.Position = this.Position;
            newStorno.CouponHistory = this.CouponHistory;
            newStorno.Status = this.Status;
            newStorno.IsNotarizable = this.IsNotarizable;

            DateTime newLastDate = CouponHistory.StartAccrualDate.AddDays(-1);
            if (newLastDate < Position.OpenDate) newLastDate = Position.OpenDate;
            Position.LastBondCouponCalcDate = newLastDate;

            return this.storno(employee, reason, journalEntry, newStorno);
        }
Exemplo n.º 9
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;
        }
Exemplo n.º 10
0
 public static bool StornoBondTransaction(IDalSession session, ITransaction storno, IInternalEmployeeLogin employee)
 {
     bool success = false;
     if (storno.Approved)
     {
         IList<IBondCouponPayment> bondPaymentsToStorno = storno.GetBondPaymentsToStorno();
         if (bondPaymentsToStorno != null && bondPaymentsToStorno.Count > 0)
         {
             IGLLookupRecords lookups = null;
             int journalID = int.Parse((string)(System.Configuration.ConfigurationManager.AppSettings.Get("DefaultAccruedInterestJournal")));
             IJournal journal = JournalMapper.GetJournal(session, journalID);
             foreach (IBondCouponPayment payment in bondPaymentsToStorno.OrderByDescending(x => x.CouponHistory.StartAccrualDate))
             {
                 if (payment.Status == BondCouponPaymentStati.Active || payment.Status == BondCouponPaymentStati.ToBeSettled)
                 {
                     if (lookups == null)
                         lookups = GlLookupRecordMapper.GetGLLookupRecords(session, BookingComponentParentTypes.AccruedInterest);
                     payment.Cancel();
                     success = true;
                 }
                 else if (payment.Status == BondCouponPaymentStati.Settled)
                 {
                     string nextJournalEntryNumber = JournalEntryMapper.GetNextJournalEntryNumber(session, journal);
                     IMemorialBooking memorialBooking = new MemorialBooking(journal, nextJournalEntryNumber);
                     memorialBooking.TransactionDate = payment.CouponHistory.EndAccrualDate;
                     payment.Storno(employee, storno.StornoReason, memorialBooking);
                     success = true;
                 }
             }
         }
     }
     return success;
 }
Exemplo n.º 11
0
 public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry)
 {
     CashTransfer newStorno = new CashTransfer();
     return this.storno(employee, reason, journalEntry, newStorno);
 }
Exemplo n.º 12
0
 public override IGeneralOperationsBooking Storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry)
 {
     ManagementFee newStorno = new ManagementFee();
     newStorno.StartDate = this.StartDate;
     newStorno.EndDate = this.EndDate;
     newStorno.Units = this.Units;
     IManagementFee stornoBooking = (IManagementFee)this.storno(employee, reason, journalEntry, newStorno);
     stornoBooking.BookLines();
     return stornoBooking;
 }
Exemplo n.º 13
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;
        }
Exemplo n.º 14
0
        protected IGeneralOperationsBooking storno(IInternalEmployeeLogin employee, string reason, IMemorialBooking journalEntry, IGeneralOperationsBooking stornoBooking)
        {
            if (employee == null)
                throw new ApplicationException(
                    "Creating a Storno is not possible if employee not specified.");

            if (employee != null)
                employee.VerifyStornoLimit(this.Components.TotalBaseAmount.Abs(), true);

            stornoBooking.Account = Account;
            stornoBooking.GeneralOpsJournalEntry = journalEntry;
            stornoBooking.Description = Description;
            stornoBooking.TaxPercentage = TaxPercentage;
            stornoBooking.IsStorno = true;
            stornoBooking.StornoReason = reason;
            stornoBooking.OriginalBooking = this;
            stornoBooking.CreationDate = DateTime.Now;

            foreach (IGeneralOperationsComponent comp in this.Components)
            {
                IGeneralOperationsComponent newComp = comp.CloneAndStorno(stornoBooking);
                newComp.MainLine = newComp.JournalLines.Where(x => x.GiroAccount != null).FirstOrDefault();
                stornoBooking.Components.Add(newComp);
                newComp.ParentBooking = stornoBooking;
            }
            this.StornoBooking = stornoBooking;
            return StornoBooking;
        }
Exemplo n.º 15
0
        /// <summary>
        /// The method to alter the Model portfolio
        /// </summary>
        /// <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>
        /// <returns>true when successfull</returns>
        public bool SetModelPortfolio(IPortfolioModel newModelPortfolio, IInternalEmployeeLogin employee, DateTime changeDate)
        {
            AccountEmployerRelationship employerRelationship = AccountEmployerRelationship.None;
            if (this.AccountType == AccountTypes.Customer)
                employerRelationship = ((ICustomerAccount)this).EmployerRelationship;
            if (Util.IsNullDate(changeDate))
                changeDate = DateTime.Now;

            return SetModelPortfolio(Lifecycle, newModelPortfolio, this.IsExecOnlyCustomer, employerRelationship, employee, changeDate);
        }
Exemplo n.º 16
0
 public override ITransaction Storno(IAccountTypeInternal stornoAccount, IInternalEmployeeLogin employee, string reason, ITradingJournalEntry tradingJournalEntry)
 {
     ITransactionNTM newStorno = new TransactionNTM();
     this.storno(stornoAccount, employee, reason, tradingJournalEntry, newStorno);
     return newStorno;
 }
Exemplo n.º 17
0
 public override bool Approve(IInternalEmployeeLogin employee, bool raiseStornoLimitExceptions)
 {
     createPositionTxs(AccountA, AccountB, ConvertedInstrumentSize, PositionsTxValueTypes.Conversion);
     return approve(employee, raiseStornoLimitExceptions);
 }