Example #1
0
        public static List<SymbolModel> GetSymbolsInGroup(int groupId)
        {
            var symbolsList = new List<SymbolModel>();

            string sql = "SELECT * FROM " + TblSymbolsInGroups + " WHERE GroupID = '" + groupId + "' ; COMMIT;";
            lock (LockReader)
            {
                var reader = GetReader(sql);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        var symbol = new SymbolModel
                        {
                            SymbolId = reader.GetInt32(2),
                            SymbolName = reader.GetString(3)
                        };
                        symbolsList.Add(symbol);
                    }
                    reader.Close();
                }
            }
            return symbolsList;
        }
Example #2
0
        public static List<SymbolModel> GetSymbolsForUser(int userId, bool tnOrDN)
        {
            var symbolsList = new List<SymbolModel>();
            string sql = "SELECT * FROM " + TblSymbolsForUsers
                        + " LEFT JOIN " + TblSymbols
                        + " ON " + TblSymbolsForUsers + ".SymbolID = "
                        + TblSymbols + ".ID" + " WHERE " + TblSymbolsForUsers + ".UserID = '" + userId + "' AND TNorDN = " + tnOrDN + "; COMMIT;";
            lock (LockReader)
            {
                MySqlDataReader reader = GetReader(sql);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        var symbol = new SymbolModel { SymbolId = reader.GetInt32(4), SymbolName = reader.GetString(5) };
                        symbolsList.Add(symbol);
                    }

                    reader.Close();
                }
            }
            return symbolsList;
        }
Example #3
0
        public static List<SymbolModel> GetSymbols()
        {
            var symbolsList = new List<SymbolModel>();
            Commit();
            const string sql = "SELECT * FROM " + TblSymbols;
            lock (LockReader)
            {
                MySqlDataReader reader = GetReader(sql);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        var symbol = new SymbolModel {SymbolId = reader.GetInt32(0), SymbolName = reader.GetString(1)};
                        symbolsList.Add(symbol);
                    }

                    reader.Close();
                }
            }
            return symbolsList;
        }
Example #4
0
        public static bool AddSymbolIntoGroup(int groupId, SymbolModel symbol)
        {
            var sql = "INSERT IGNORE INTO " + TblSymbolsInGroups
                    + " (`GroupID`, `SymbolID`, `SymbolName`)"
                    + "VALUES('" + groupId + "',"
                    + " '" + symbol.SymbolId + "',"
                    + " '" + symbol.SymbolName + "');COMMIT;";

            return DoSql(sql);
        }
Example #5
0
        private void AddUserAndActivate(CollectorClient user, SymbolModel smb)
        {
            _adminService.TickNetSymbolAccesRank[smb.SymbolName].Add(user);
            try
            {
                user.TickNetProxy.ActivateClient(smb.SymbolName);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                ActivateNextClient(smb);
            }
            DataManager.AddNewLog(new LogModel
                                      {
                                          Application = "TickNet",
                                          Date = DateTime.Now,
                                          Status = 3,
                                          Symbol = smb.SymbolName,
                                          UserId = _users.Find(oo => oo.Name == user.UserName).Id,
                                          LogId = 2,
                                          MsgType = 2

                                      });
            AddSymbolToBusySymbols(smb);
        }
Example #6
0
 private void AddSymbolToBusySymbols(SymbolModel smb)
 {
     var bsm = new BusySymbol
     {
         ID = smb.SymbolId,
         IsTickNet = true
     };
     if (!_busySymbols.Exists(a => a.ID == bsm.ID)) _busySymbols.Add(bsm);
     else
     {
         var fsmb = _busySymbols.Find(o => o.ID == bsm.ID);
         fsmb.IsTickNet = true;
     }
 }