Exemplo n.º 1
0
        //public void StandardTrickle()
        //{
        //    TrickleService trickle = new TrickleService();
        //    var fundAccountList = trickle.GetFundAccounts();

        //    foreach (var fund in fundAccountList)
        //    {
        //        var startup = trickle.GetStartup(fund.StartupID);
        //        var backer = trickle.GetBacker(fund.BackerID);

        //        if (backer.TotalMoney >= fund.TrickleAmount)
        //        {
        //            startup.TotalReceived += fund.TrickleAmount;
        //            backer.TotalMoney -= fund.TrickleAmount;
        //            fund.TotalMoney -= fund.TrickleAmount;
        //        }
        //        trickle.UpdateBacker(backer);
        //        trickle.UpdateStartup(startup);
        //        trickle.CreateDeposit(fund);
        //        trickle.UpdateChain(backer, startup, fund, block);
        //        CheckMilestones(backer,startup);


        //        // add logic for depositing money into a bitcoin wallet
        //        // add an else statement to send an email to the backer saying he's pledged all the money in his account
        //        // add logic to create a deposit object linked with the transaction

        //    }
        //}
        public void CheckMilestones(Backer backer, Startup startup)
        {
            var milestoneList = trickle.GetMilestoneByStartupID(startup.ID);

            foreach (Milestone mile in milestoneList)
            {
                var back = trickle.GetBackerByFunding(mile.StartupID);

                if (mile.Fulfilled == true & mile.FulfilledCompleted == false)
                {
                    mile.FulfilledCompleted = true;
                    trickle.UpdateMilestone(mile);
                    foreach (Backer b in back)
                    {
                        trickle.SendMilestoneCompletionEmail(b, startup, mile);
                    }
                }
                if (mile.PromisedDate < DateTime.UtcNow & mile.Fulfilled == false)
                {
                    foreach (Backer b in back)
                    {
                        trickle.SendFailedMilestoneEmail(b, startup, mile);
                    }
                }
            }
        }
Exemplo n.º 2
0
 public void UpdateDatabase(Backer backer, Startup startup, FundAccount fund)
 {
     trickle.UpdateFundAccount(fund);
     trickle.UpdateBacker(backer);
     trickle.UpdateStartup(startup);
     trickle.CreateDeposit(fund);
     trickle.UpdateChain(backer, startup, fund, block);
 }
Exemplo n.º 3
0
 public void PercentageTrickle(FundAccount fund, Startup start, Backer backer)
 {
     if (fund.hasCapped == false &
         fund.TotalDonated <= (fund.TrickleCap - fund.TrickleAmount))
     {
         Trickle(fund, start, backer);
     }
     CheckMilestones(fund);
 }
Exemplo n.º 4
0
        public void MilestoneTrickle(FundAccount fund, Startup startup, Backer backer)
        {
            var milestoneList = trickle.GetMilestoneByStartupID(startup.ID);

            foreach (Milestone mile in milestoneList)
            {
                if (mile.Fulfilled == true & mile.FulfilledCompleted == false)
                {
                    Trickle(fund, startup, backer);
                    mile.FulfilledCompleted = true;
                }
            }
        }
Exemplo n.º 5
0
        public void Trickle(FundAccount fund, Startup startup, Backer backer)
        {
            if (fund.TotalDonated >= fund.TrickleCap)
            {
                fund.hasCapped = true;
                trickle.UpdateFundAccount(fund);
            }

            if (fund.TotalMoney >= fund.TrickleAmount && fund.hasCapped == false)
            {
                decimal bitcoin = currency.FiatToBTC("USD", fund.TrickleAmount);
                TransactionBTC.SendTransaction(bitcoin, startup.BTCAddress);
                startup.TotalReceived += fund.TrickleAmount;
                fund.TotalDonated     += fund.TrickleAmount;
                backer.TotalMoney     -= fund.TrickleAmount;
                fund.TotalMoney       -= fund.TrickleAmount;
                UpdateDatabase(backer, startup, fund);
            }
        }
Exemplo n.º 6
0
 public Deposit(double Amount, Backer From, DateTime Date)
 {
     this.Amount   = Amount;
     this.BackerID = BackerID;
     this.Date     = Date;
 }