private void bAdd_Click(object sender, RoutedEventArgs e)
 {
     model.InstrumentsDBs.Add(new InstrumentsDB()
     {
         Symbol         = this.tbSymbol.Text.ToString().ToUpper(),
         SecurityTypeId = model.SecurityTypeDBs.Where(x => x.TypeName == "Options").Select(x => x.Id).First()
     });
     model.OptionsDBs.Add(new OptionsDB()
     {
         ISIN              = tbIsin.Text.ToString().ToUpper(),
         Issuer            = tbIssuer.Text.ToString(),
         Symbol            = tbSymbol.Text.ToString().ToUpper(),
         UnderlyingID      = (Int64)cbUnderlying.SelectedValue,
         StrikePrice       = this.strike,
         IsTradable        = true,
         MaturityDate      = this.maturityDate,
         OptionType        = this.type,
         LastTradedPrice   = this.lastTradedPrice,
         OptionKindID      = (Int64)cboptionKinds.SelectedValue,
         Rebate            = this.checker4?this.rebateBarrier:-1,
         Barrier           = this.checker5?this.rebateBarrier:-1,
         BarrierOptionType = this.checker6?((ComboBoxItem)cbBarrierOptionKind.SelectedValue).Name.ToString():"Not Valid"
     });
     model.SaveChangesAsync();
     this.Close();
 }
Esempio n. 2
0
 private void bBuy_Click(object sender, RoutedEventArgs e)
 {
     model.OrderBookDBs.Add(new OrderBookDB()
     {
         Position      = "BUY",
         Quantity      = this.quantity,
         TimeStamp     = DateTime.Now,
         Price         = this.price,
         InstrumentsId = (Int64)cbInstrument.SelectedValue
     });
     model.SaveChangesAsync();
     this.Close();
 }
        public virtual async Task <CommandResult <UserProfileData> > Create(UserProfileData data)
        {
            var entity = data.ToEntity();

            _context.Set(entity.GetType()).Attach(entity);
            _context.Entry(entity).State = System.Data.Entity.EntityState.Added;
            await _context.SaveChangesAsync();

            return(new CommandResult <UserProfileData>(data, new UserProfileData(entity)));
        }
        public virtual async Task <CommandResult <UserData> > Update(UserData data)
        {
            var entity = data.ToEntity();

            _context.Set(entity.GetType()).Attach(entity);
            _context.Entry(entity).State = System.Data.Entity.EntityState.Modified;
            var rows = await _context.SaveChangesAsync();

            return(new CommandResult <UserData>(data, new UserData(entity), rows > 0));
        }
        public virtual async Task <CommandResult <RoleData> > Delete(RoleData data)
        {
            var entity = data.ToEntity();

            _context.Set(entity.GetType()).Attach(entity);
            _context.Entry(entity).State = System.Data.Entity.EntityState.Deleted;
            var rows = await _context.SaveChangesAsync();

            return(new CommandResult <RoleData>(data, null, rows > 0));
        }
 private void bAdd_Click(object sender, RoutedEventArgs e)
 {
     model.InstrumentsDBs.Add(new InstrumentsDB()
     {
         Symbol         = this.tbSymbol.Text.ToString().ToUpper(),
         SecurityTypeId = model.SecurityTypeDBs.Where(x => x.TypeName == "Stocks").Select(x => x.Id).First()
     });
     model.StockDBs.Add(new StockDB()
     {
         ISIN                 = this.tbIsin.Text.ToString().ToUpper(),
         Issuer               = this.tbIssuer.Text.ToString(),
         Symbol               = this.tbSymbol.Text.ToString().ToUpper(),
         IsTradable           = true,
         LastTradedPrice      = this.lastTradedPrice,
         HistoricalVolatility = this.historicalVolatility / 100
     });
     model.SaveChangesAsync();
     this.Close();
 }
Esempio n. 7
0
 private void Add_Click(object sender, RoutedEventArgs e)
 {
     model.InterestRateDBs.Add(new InterestRateDB()
     {
         Tenor = dtTenor.SelectedDate.Value,
         Rate  = this.interestRate / 100,
     });
     model.SaveChangesAsync();
     this.Close();
 }