示例#1
0
        public void RemoveBrokenLinks(CommandSystem.ExecutionInformation info)
        {
            using (var trans = database.BeginTrans())
            {
                const int iterations  = 3;
                var       currentIter = audioLogEntries.FindAll();

                for (int i = 0; i < iterations; i++)
                {
                    info.Write("Filter iteration " + i);
                    currentIter = FilterList(info, currentIter);
                }

                foreach (var entry in currentIter)
                {
                    RemoveEntry(entry);
                    info.Bot.PlaylistManager.AddToTrash(new PlaylistItem(entry.AudioResource));
                    info.Write($"Removed: {entry.Id} - {entry.AudioResource.ResourceTitle}");
                }

                trans.Commit();
            }
        }
        public Dictionary <string, T> GetDictionary()
        {
            try
            {
                lock (_lock)
                {
                    using (var db = new LiteDatabase(_dataBaseFile))
                    {
                        _fileHashCollection = db.GetCollection <FileHashTableEntry <T> >(_databaseName);

                        FileHashTableEntry <T>[] all = _fileHashCollection.FindAll().ToArray();

                        return(all.ToDictionary(fileHashTableContent => fileHashTableContent.Key,
                                                fileHashTableContent => fileHashTableContent.Tag));
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error("LifeTimeStorage.GetDictionary() - " + ex.Message);
                return(null);
            }
        }
示例#3
0
        public void LoadTenantsFromDump()
        {
            try
            {
                _log.Debug("LoadTenantsFromDump()");

                lock (_locker)
                {
                    var list = _tenants.FindAll().ToList();

                    foreach (var tenantData in list)
                    {
                        AddTenantToCache(tenantData, false);
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error("LoadTenantsFromDump: {0}", ex.ToString());

                ReCreateDump();
            }
        }
示例#4
0
        public MOTR_Sessions(MOTR_Users Users)
        {
            //Storing the users variable, used to check the ID etc..
            m_Users            = Users;
            aTemporarySessions = new ArrayList();
            //WindowsService.LogEventInformation("Starting to read sessions...");

            //Opening the database
            string sGlobalPath = MOTR_Settings.GetGlobalApplicationPath();

            m_db = new LiteDatabase(sGlobalPath + @"\Sessions.db");

            //Check for expired sessions
            LiteCollection <SessionStruct> aDBValues = m_db.GetCollection <SessionStruct>("session");

            foreach (SessionStruct item in aDBValues.FindAll())
            {
                if (SessionExpired(item.sLastUsed))
                {
                    RemoveSession(item.sID);
                }
            }
        }
示例#5
0
        public void RemoveBrokenLinks(UserSession session)
        {
            using (var trans = database.BeginTrans())
            {
                const int iterations  = 3;
                var       currentIter = audioLogEntries.FindAll();

                for (int i = 0; i < iterations; i++)
                {
                    session.Write("Filter iteration " + i, true);
                    currentIter = FilterList(session, currentIter);
                }

                foreach (var entry in currentIter)
                {
                    RemoveEntry(entry);
                    session.Bot.PlaylistManager.AddToTrash(new PlaylistItem(entry.AudioResource));
                    session.Write($"Removed: {entry.Id} - {entry.AudioResource.ResourceTitle}", true);
                }

                trans.Commit();
            }
        }
示例#6
0
        public Task ListRegisteredUsers()
        {
            LiteCollection <Streamer> db = null;

            lock (dbLock)
            {
                db = database.GetCollection <Streamer>("streamers");
            }

            if (db == null)
            {
                ReplyAsync("Could not access users in database");
                return(Task.CompletedTask);
            }

            List <string> users = new List <string>();

            foreach (var s in db.FindAll())
            {
                users.Add(s.Name);
            }

            return(ReplyAsync($"[ {string.Join(", ", users)} ]"));
        }
        public void ModificaBot_Clicked(object sender, EventArgs e)
        {
            LiteCollection <Bot> Bots = _dataBase.GetCollection <Bot>();

            if (Bots.Count() > 0)
            {
                var bot = Bots.FindAll().FirstOrDefault();
                bot.Nome = "Renato Groffe";
                Bots.Upsert(bot);

                Stream stream = GetImageStreamFromUrl("http://azureweekexperience.azurewebsites.net/wp-content/uploads/2017/06/Renato-Grofe.jpg");
                if (stream != null)
                {
                    //Verfica se ja existe a imagem,se existir apaga
                    if (_dataBase.FileStorage.Exists(bot.BotId.ToString()))
                    {
                        _dataBase.FileStorage.Delete(bot.BotId.ToString());
                    }
                    _dataBase.FileStorage.Upload(bot.BotId.ToString(), "Teste", stream);
                }

                lbStatusBot.Text = "Bot modificado";
            }
        }
示例#8
0
 public IEnumerable <Minyan> getMinyanim()
 {
     return(mMinyan.FindAll());
 }
示例#9
0
 public List <Group> getAllGroups()
 {
     return(groups.FindAll().ToList());
 }
示例#10
0
 public List <PortalInfo> getAll()
 {
     return(AllPortals.FindAll().ToList());
 }
示例#11
0
 public virtual Task <TUser> FindAsync(UserLoginInfo login)
 {
     return(Task.FromResult(_Users.FindAll().FirstOrDefault(u => u.Logins != null && u.Logins.Any(l => l.LoginProvider == login.LoginProvider && l.ProviderKey == login.ProviderKey))));
 }
示例#12
0
 public virtual IEnumerable <T> List()
 {
     return(collection.FindAll());
 }
        //Get All Persons
        public List <Person> GetAllPersons()
        {
            var persons = new List <Person>(personCollection.FindAll());

            return(persons);
        }
 public IEnumerable <T> FindAll()
 {
     return(_lite.FindAll());
 }
示例#15
0
 public IEnumerable <string> EnlistItems()
 {
     return(System.Linq.Enumerable.Select(_Items.FindAll(), s => s.Name));
 }
 protected virtual IEnumerable <DocumentReference> GetAllItem(LiteCollection <BsonDocument> liteCollection)
 {
     return(LiteCollection.FindAll().Select(bsonDocument => new DocumentReference(bsonDocument, this)));
 }
示例#17
0
        public void PersonListBindDataGrid(LiteCollection <Personel> _personalListItemsCollection)
        {
            var personAllList = _personalListItemsCollection.FindAll().ToList();

            dgpersonellist.DataSource = personAllList;
        }
示例#18
0
 public IEnumerable <MailContentEntity> FindAll()
 {
     return(_mailContentEntity.FindAll());
 }
示例#19
0
 public IEnumerable <T> FindAll(Func <T, bool> condition = null)
 {
     return(condition == null?_data.FindAll() : _data.Find(x => condition(x)));
 }
示例#20
0
 public IEnumerable <WebPush.PushSubscription> GetAll()
 {
     return(_subscriptions.FindAll());
 }
 public IEnumerable <Room> GetRooms()
 {
     return(rooms.FindAll().ToList().OrderBy(r => r.Name));
 }
示例#22
0
 public IEnumerable <User> getUsers()
 {
     return(mUsers.FindAll());
 }
示例#23
0
 /// <inheritdoc />
 public IEnumerable <TDoc> GetAll()
 {
     return(_documents.FindAll());
 }
示例#24
0
        /// <summary>
        /// Returns all elements of the collection.
        /// </summary>
        /// <returns></returns>
        public virtual IEnumerable <T> GetAll()
        {
            var results = cmCollection.FindAll();

            return(results);
        }
示例#25
0
 private void FetchTodos(FetchTodosAction action)
 {
     action.Todos = _todoCollection.FindAll();
 }
示例#26
0
 public IReadOnlyList <T> GetAll()
 {
     return(_collection.FindAll().ToList());
 }
示例#27
0
 /// <summary>
 /// Queryable object for fetching more than one document, or complex searching.
 /// </summary>
 /// <returns>Queryable LiteCollection of all documents</returns>
 public IEnumerable <T> GetAll()
 {
     return(Collection.FindAll());
 }
示例#28
0
        public virtual IEnumerable <T> ReadAllItems()
        {
            var all = _collection.FindAll();

            return(new List <T>(all));
        }
示例#29
0
        public IEnumerable <AuditEvent> GetAllEvents()
        {
            LiteCollection <AuditEvent> col = db.GetCollection <AuditEvent>(auditCollectionName);

            return(col.FindAll());
        }
示例#30
0
 public IEnumerable <DeviceIdBufferedJobLink> GetDeviceIdBufferedJobLinks()
 {
     return(DeviceIdBufferedJobLinksBase.FindAll());
 }