public async Task <IActionResult> Edit(long id, [Bind("Id,Amount,CashId,Number,Defenition")] CashBalance cashBalance)
        {
            if (id != cashBalance.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cashBalance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CashBalanceExists(cashBalance.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cashBalance));
        }
Exemple #2
0
        private void balanceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var frm = new CashBalance();

            frm.MdiParent = this; // assign MdiParent of FormB to FormC
            frm.Dock      = DockStyle.Fill;
            frm.Show();
        }
        public async Task <IActionResult> Create([Bind("Id,Amount,CashId,Number,Defenition")] CashBalance cashBalance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cashBalance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cashBalance));
        }
Exemple #4
0
 private void btn_CashFlow_Click(object sender, EventArgs e)
 {
     try
     {
         var frm = new CashBalance();
         frm.MdiParent = this; // assign MdiParent of FormB to FormC
         frm.Dock      = DockStyle.Fill;
         frm.Show();
     }
     catch (Exception)
     {
     }
 }
Exemple #5
0
        public void CashBalanceFact()
        {
            var bd         = new DateTime(2019, 06, 14);
            var pillars    = new[] { bd, bd.AddDays(1000) };
            var flatRate   = 0.05;
            var rates      = pillars.Select(p => flatRate).ToArray();
            var usd        = TestProviderHelper.CurrencyProvider["USD"];
            var zar        = TestProviderHelper.CurrencyProvider["ZAR"];
            var discoCurve = new IrCurve(pillars, rates, bd, "USD.BLAH", Interpolator1DType.Linear, usd);
            var fxMatrix   = new FxMatrix(TestProviderHelper.CurrencyProvider);

            fxMatrix.Init(usd, bd, new Dictionary <Currency, double>(), new List <FxPair>(), new Dictionary <Currency, string> {
                { usd, "X" }, { zar, "Y" }
            });
            var fModel = new FundingModel(bd, new[] { discoCurve }, TestProviderHelper.CurrencyProvider, TestProviderHelper.CalendarProvider);

            fModel.SetupFx(fxMatrix);
            var aModel = new AssetFxModel(bd, fModel);

            var notional = 100e6;
            var maturity = bd.AddDays(365);
            var b        = new CashBalance(usd, notional, null);

            var t = bd.CalculateYearFraction(maturity, DayCountBasis.Act365F);

            var pv = b.Pv(fModel, false);

            Assert.Equal(notional, pv);

            Assert.Empty(b.Dependencies(null));
            Assert.Empty(b.AssetIds);
            Assert.Empty(b.PastFixingDates(bd));
            Assert.Equal(0.0, b.CalculateParRate(null));
            Assert.Equal(0.0, b.FlowsT0(null));
            Assert.Equal(string.Empty, b.FxPair(null));
            Assert.Equal(FxConversionType.None, b.FxType(null));
            Assert.Equal(usd, b.Currency);
            Assert.Equal(DateTime.MinValue, b.LastSensitivityDate);

            var y = (CashBalance)b.Clone();

            Assert.True(b.Equals(y));
            y.TradeId = "xxx";
            Assert.False(b.Equals(y));

            Assert.Throws <NotImplementedException>(() => b.Sensitivities(fModel));
            Assert.Throws <NotImplementedException>(() => b.SetStrike(0.0));
            Assert.Equal(b, b.SetParRate(0.0));

            Assert.Single(b.IrCurves(aModel));
        }
Exemple #6
0
 /// <summary>
 /// Returns a string that represents the current object.
 /// </summary>
 /// <returns>
 /// A string that represents the current object.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override string ToString()
 {
     return(string.Format("Account {0} Balance: {1}", CurrencySymbol, CashBalance.ToString("0.00")));
 }
Exemple #7
0
        //public void CreatePlayerForCurrentUser()
        //{
        //    Person person = GetPersonForCurrentUser();
        //    person.IsNullThrowException("No person found for user.");
        //    ICommonWithId entity = Factory();
        //    PlayerAbstract playerAbstract = entity as PlayerAbstract;
        //    playerAbstract.IsNullThrowException("This is not a player!");

        //    playerAbstract.PersonId = person.Id;
        //    playerAbstract.Person = person;

        //    CreateEntity(playerAbstract as TEntity);



        //}

        public CashBalance GetCashBalancePerson(string personId)
        {
            CashBalance cashBal = new CashBalance();

            return(cashBal);
        }