Exemple #1
0
        private async Task AddInvestorCashFlowsAsync()
        {
            CashFlowsLoading = true;
            foreach (UniqueCashFlowNumber item in uniqueNumbers)
            {
                item.InvestorCashFlows = await investorAccess.GetInvestorCashFlowsByUniqueNumberAsync(item.Id);

                foreach (InvestorCashFlow cf in item.InvestorCashFlows)
                {
                    item.CashFlowAmount += cf.CashFlowAmount;
                }
                if (item.InvestorCashFlows.Count > 0)
                {
                    item.CashFlowType = item.InvestorCashFlows.ElementAt(0).CashFlowType;
                }
            }
            // remove all UniqueCashFlows where number of InvestorCashFlows == 0
            {
                for (int i = uniqueNumbers.Count - 1; i >= 0; i--)
                {
                    UniqueCashFlowNumber ucn = uniqueNumbers.ElementAt(i);
                    if (ucn.InvestorCashFlows.Count == 0)
                    {
                        uniqueNumbers.RemoveAt(i);
                    }
                }
            }
            CashFlowsLoading = false;
        }
Exemple #2
0
 private void OnDeleteCashFlowConfirmation(IConfirmation obj)
 {
     if (obj.Confirmed)
     {
         try
         {
             int number = investorAccess.DeleteInvestorCashFlows(InvestorCashFlows);
             NotificationRequest.Raise(new Notification()
             {
                 Title   = ApplicationNames.NotificationTitle,
                 Content = $"Es wurden {number.ToString()} Cashflows gelöscht!"
             });
             // remove CurrentItem from List
             UniqueCashFlowNumber item = UniqueCashFlows.CurrentItem as UniqueCashFlowNumber;
             uniqueNumbers.Remove(item);
         }
         catch (Exception ex)
         {
             NotificationRequest.Raise(new Notification()
             {
                 Title   = ApplicationNames.NotificationTitle,
                 Content = $"Beim Löschen von Cashflows trat ein Fehler auf: {ex.Message}"
             });
         }
     }
 }
Exemple #3
0
 public static int GetUniqueCashFlowNumber(DateTime cfDate, int fundId)
 {
     using (HqTrustData dbContext = new HqTrustData())
     {
         UniqueCashFlowNumber record = new UniqueCashFlowNumber()
         {
             CashFlowDate = cfDate,
             PeFundId     = fundId
         };
         dbContext.UniqueCashFlowNumbers.Add(record);
         dbContext.SaveChanges();
         return(record.Id);
     }
 }
Exemple #4
0
 public static bool CashFlowExists(DateTime cfDate, int fundId)
 {
     using (HqTrustData dbContext = new HqTrustData())
     {
         UniqueCashFlowNumber record = dbContext.UniqueCashFlowNumbers.FirstOrDefault(u => u.CashFlowDate == cfDate.Date && u.PeFundId == fundId);
         if (record == null)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
 }
Exemple #5
0
        private void UniqueCashFlows_CurrentChanged(object sender, EventArgs e)
        {
            if (UniqueCashFlows.CurrentItem == null)
            {
                InvestorCashFlows = new List <InvestorCashFlow>();
                return;
            }
            UniqueCashFlowNumber item = UniqueCashFlows.CurrentItem as UniqueCashFlowNumber;

            InvestorCashFlows = new List <InvestorCashFlow>(item.InvestorCashFlows);
            RaisePropertyChanged("InvestorCashFlows");
            CanUserDeleteCashFlows = false;
            foreach (InvestorCashFlow cf in InvestorCashFlows)
            {
                if (cf.PsPlusId != 0)
                {
                    CanUserDeleteCashFlows = false;
                    break;
                }
                CanUserDeleteCashFlows = true;
            }
        }