示例#1
0
        private void OnCellEditEnded()
        {
            // calculate all columns and identify differences
            double         totalCommitment = 0;
            CashFlowDetail sums            = CashFlowInformation.DetailSummary;

            DifferenceCapitalCall     = Math.Abs(sums.CashFlowAmountCall);
            DifferenceExpenses        = Math.Abs(sums.PartnershipExpenses);
            DifferenceLookback        = Math.Abs(sums.LookbackInterests);
            DifferenceDistribution    = Math.Abs(sums.CashFlowAmountDistribution);
            DifferenceReturnOfCapital = Math.Abs(sums.ReturnOfCapital);
            DifferenceCapitalGain     = Math.Abs(sums.CapitalGain);
            DifferenceDividends       = Math.Abs(sums.Dividends);
            DifferenceWithholdingTax  = Math.Abs(sums.WithholdingTax);
            DifferenceRecallable      = Math.Abs(sums.RecallableAmount);
            foreach (CashFlowDetail detail in CashFlowInformation.InvestorDetails)
            {
                if (detail.InvestorId != 0 && detail.Investor == null)
                {
                    detail.Investor = Investors.FirstOrDefault(i => i.Id == detail.InvestorId);
                    if (detail.Investor != null)
                    {
                        detail.Reference        = detail.Investor.InvestorReference;
                        investorCommitments     = new ObservableCollection <InvestorCommitment>(investorAccess.GetCommitmentsForInvestor(detail.InvestorId));
                        NewInvestorCommitments  = CollectionViewSource.GetDefaultView(investorCommitments);
                        newInvestorId           = detail.InvestorId;
                        ShowInvestorCommitments = WindowState.Open;
                    }
                }
                DifferenceCapitalCall     -= Math.Abs(detail.CashFlowAmountCall);
                DifferenceExpenses        -= Math.Abs(detail.PartnershipExpenses);
                DifferenceLookback        -= Math.Abs(detail.LookbackInterests);
                totalCommitment           += Math.Abs(detail.CommitmentAmount);
                DifferenceDistribution    -= Math.Abs(detail.CashFlowAmountDistribution);
                DifferenceReturnOfCapital -= Math.Abs(detail.ReturnOfCapital);
                DifferenceCapitalGain     -= Math.Abs(detail.CapitalGain);
                DifferenceDividends       -= Math.Abs(detail.Dividends);
                DifferenceWithholdingTax  -= Math.Abs(detail.WithholdingTax);
                DifferenceRecallable      -= Math.Abs(detail.RecallableAmount);
            }
            DifferenceCapitalCall     = Math.Round(DifferenceCapitalCall, 2);
            DifferenceExpenses        = Math.Round(DifferenceExpenses, 2);
            DifferenceLookback        = Math.Round(DifferenceLookback, 2);
            DifferenceDistribution    = Math.Round(DifferenceDistribution, 2);
            DifferenceReturnOfCapital = Math.Round(DifferenceReturnOfCapital, 2);
            DifferenceCapitalGain     = Math.Round(DifferenceCapitalGain, 2);
            DifferenceDividends       = Math.Round(DifferenceDividends, 2);
            DifferenceWithholdingTax  = Math.Round(DifferenceWithholdingTax, 2);
            DifferenceRecallable      = Math.Round(DifferenceRecallable, 2);
            sums.CommitmentAmount     = totalCommitment;
            FundHeader = $"{CashFlowInformation.Fund.FundShortName} ({CashFlowInformation.DetailSummary.CommitmentAmount:n0})";
            if (DifferenceCapitalCall == 0 && DifferenceExpenses == 0 && DifferenceLookback == 0)
            {
                CanGotoNextStep = true;
            }
            else
            {
                CanGotoNextStep = false;
            }
        }
示例#2
0
 public _Links()
 {
     Self      = new Self();
     Investors = new Investors();
     CreateortransferAccount = new CreateOrTransferAccount();
     CloseAccount            = new CloseAccount();
     Lifeevents    = new LifeEvents();
     Bonuspayments = new BonusPayments();
 }
        public override void OnNavigatedTo(NavigationContext navigationContext)
        {
            int clientAdvisorId = (int)navigationContext.Parameters["ClientAdvisorId"];

            SelectedInvestor = null;

            investorList = new ObservableCollection <Investor>(investorAccess.GetInvestorsByClientAdvisorId(clientAdvisorId));

            if (Investors != null)
            {
                Investors.CurrentChanged -= Investors_CurrentChanged;
            }

            Investors = CollectionViewSource.GetDefaultView(investorList);
            Investors.CurrentChanged += Investors_CurrentChanged;
            Investors.MoveCurrentToFirst();     // Select first element
            SelectedInvestor = Investors.CurrentItem as Investor;
            TabTitle         = SelectedInvestor.ClientAdvisor.AdvisorName.FullName + "(Investors)";
        }
        private void SendEmailNotification(Loans project, Investors backer, Users creator, decimal amount)
        {
            if (project == null || backer == null || creator == null)
            {
                Print("PARAMETERS FOR SENDING EMAIL ARE MISSSING!");
                return;
            }

            Task.Run(() => {
                try {
                    var emails        = new EmailNotificationsHelper();
                    var backer_email  = emails.GetEmailNotification(AppConfig.NotifyBackerEmailTemplate, backer.User.Language);
                    var caretor_email = emails.GetEmailNotification(AppConfig.NotifyCreatorEmailTemplate, creator.Language);

                    if (backer_email == null || caretor_email == null)
                    {
                        Print("EMAILS TEMPLATES ARE MISSSING!");
                        return;
                    }

                    backer_email.Message = backer_email.Message.Replace("[amount]", amount.ToString());
                    backer_email.Message = backer_email.Message.Replace("[project_url]", project.UrlTitle);
                    backer_email.Message = backer_email.Message.Replace("[project]", project.LoanTitle);
                    backer_email.Message = backer_email.Message.Replace("[eth_address]", backer.Eth);
                    backer_email.Message = backer_email.Message.Replace("[currency]", "ETH");

                    caretor_email.Message = caretor_email.Message.Replace("[amount]", amount.ToString());
                    caretor_email.Message = caretor_email.Message.Replace("[project_url]", project.UrlTitle);
                    caretor_email.Message = caretor_email.Message.Replace("[project]", project.LoanTitle);
                    caretor_email.Message = caretor_email.Message.Replace("[backer]", backer.User.Username);
                    caretor_email.Message = caretor_email.Message.Replace("[currency]", "ETH");

                    var email_to_backer  = new Email(backer_email.Subject, backer_email.Message, backer.User.Email);
                    var email_to_creator = new Email(caretor_email.Subject, caretor_email.Message, creator.Email);

                    int sending_tries = 10;
                    while (!email_to_backer.Send() && sending_tries > 0)
                    {
                        sending_tries--;
                        Print("Failed to send email, resending... " + sending_tries);
                    }
                    if (sending_tries == 0)
                    {
                        Print("UNABLE TO SENT EMAIL  " + backer_email.Subject + " TO " + backer.User.Email);
                    }
                    else
                    {
                        Print("Notification email " + backer_email.Subject + " sent to " + backer.User.Email);
                    }

                    sending_tries = 10;
                    while (!email_to_creator.Send() && sending_tries > 0)
                    {
                        sending_tries--;
                        Print("Failed to send email, resending... " + sending_tries);
                    }
                    if (sending_tries == 0)
                    {
                        Print("UNABLE TO SENT EMAIL  " + caretor_email.Subject + " TO " + creator.Email);
                    }
                    else
                    {
                        Print("Notification email " + caretor_email.Subject + " sent to " + creator.Email);
                    }
                } catch (Exception ex) {
                    Logger.LogStatus(ConsoleColor.Red, ex.ToString());
                }
            });
        }
示例#5
0
文件: Observer.cs 项目: Premsjce/DJP
 public void Dettach(IInvestor investor) => Investors.Remove(investor);
示例#6
0
文件: Observer.cs 项目: Premsjce/DJP
 public void Attach(IInvestor investor) => Investors.Add(investor);