private void BuildUserProfileBasedOnLdap() { var gameStockConfig = new StockGameConfiguration(); var ldapService = new LdapService(gameStockConfig); ldapService.Init(); var userProfile = ldapService.FindRuleEmployee("wasztemborski"); //var a = ldapService.AuthenticateUser("RULE", "wasztemborski", "rule2financial!"); var userProfileDao = new GenericDAO<UserProfile>(); userProfile = userProfileDao.FindById(userProfileDao.Save(userProfile)); var instrument = new Instrument(); instrument.Ask = new Random().Next(); instrument.Bid = new Random().Next(); instrument.Name = "Procom " + new Random().Next(); var orderDbo = new GenericDAO<Order>(); var order = new Order(); order.Owner = userProfile; order.OrderStategy = OrderStategy.StopLost; orderDbo.SaveOrUpdate(order); }
private void FillDB() { Console.WriteLine("FillDB "); var random = new Random(); // Create user porfiles for (var i= 0; i< 5; i++) { var userProfile = _ldapService.FindRuleEmployee("employee" + i); _userProfileDAO.Save(userProfile); } // Create Intruments for (var i = 0; i < 5; i++) { var instument = new Instrument(); instument.Ask = random.Next(0, 100); instument.Bid = instument.Ask *1.1; instument.Name = "Company " +random.Next(); _instrumentDAO.Save(instument); } // Create Intrument History var currentInstrument = _instrumentDAO.FindAll().FirstOrDefault<Instrument>(); Console.WriteLine(currentInstrument); for (var i = 0; i < 5; i++) { var instumentHistory = new InstrumentHistory(); instumentHistory.Instrument = currentInstrument; instumentHistory.RefereceValue = random.Next(20, 40); instumentHistory.Scope = ScopeKind.Kind1D; instumentHistory.Sales = random.Next(20); instumentHistory.DateStamp = DateTime.Now.AddDays(- i); _instrumentHistoryDAO.Save(instumentHistory); } for (var i = 0; i < 5; i++) { var instumentHistory = new InstrumentHistory(); instumentHistory.Instrument = currentInstrument; instumentHistory.RefereceValue = random.Next(20, 40); instumentHistory.Scope = ScopeKind.Kind1M; instumentHistory.Sales = random.Next(20); instumentHistory.Sales = random.Next(20); instumentHistory.DateStamp = DateTime.Now.AddMinutes(-i*30); _instrumentHistoryDAO.Save(instumentHistory); } // Create Intrument History var currentUser = _userProfileDAO.FindAll().FirstOrDefault<UserProfile>(); // Create Orders for (var i = 0; i < 5; i++) { var order = new Order(); order.OrderStategy = OrderStategy.StopLost; order.Status = OrderStatus.Open; order.Owner = currentUser; order.Amount = random.Next(1, 20); _orderDAO.Save(order); } // Create Alerts for (var i = 0; i < 5; i++) { var alert = new Alert(); alert.Status = AlertStatus.Open; alert.AlertType = AlertType.Above; alert.Owner = currentUser; alert.Instrument = currentInstrument; alert.Treshhold = 1000; alert.Description = "Alert Description " + i; _alertDAO.Save(alert); } }