public static IEnumerable <UserModel> GetAll(UserGroupModel group) { var filter = Builders <UserModel> .Filter.AnyEq(x => x.UserGroupsIds, group.Id); var tasks = Mongo.Get(filter).ToList(); return(tasks); }
public static IEnumerable <EventTriggerModel> GetAll(FilterDefinition <EventTriggerModel> filter = null) { if (filter == null) { filter = Builders <EventTriggerModel> .Filter.Eq(x => x.User, (Variables.LoggedUser as UserModel).Id); } var tasks = Mongo.Get(filter).ToList(); return(tasks); }
public static IEnumerable <UserModel> GetAll(FilterDefinition <UserModel> filter = null) { if (filter == null) { filter = Builders <UserModel> .Filter.Empty; } var tasks = Mongo.Get(filter).ToList(); return(tasks); }
public List <CommandRequestModel> GetCommandsToExecute() { var clientFilter = Builders <CommandRequestModel> .Filter.Eq(x => x.ClientId, _client.Id); var waitingResponseFilter = Builders <CommandRequestModel> .Filter.Eq(x => x.Completed, false); var filter = Builders <CommandRequestModel> .Filter.And(clientFilter, waitingResponseFilter); var results = Mongo.Get(filter).ToList(); return(results); }
public void PopulateClients() { ConnectedClients.Clear(); var filter = Builders <ClientModel> .Filter.Gte(x => x.LastSeen, DateTime.Now.AddMinutes(-5)); var onlineClients = Mongo.Get(filter).ToList(); foreach (var c in onlineClients) { ConnectedClients.Add(c); } }
public static IEnumerable <UserGroupModel> GetAll(FilterDefinition <UserGroupModel> filter = null, bool displayonly = false) { if (!displayonly || filter == null) { var loggeduser = (Variables.LoggedUser as UserModel); if (filter == null && !loggeduser.GodMode) { filter = Builders <UserGroupModel> .Filter.Gte(x => x.PermissionRank, loggeduser.HighestRank); } else { filter = Builders <UserGroupModel> .Filter.Empty; } } var tasks = Mongo.Get(filter).ToList(); return(tasks); }
public static bool Exists(FilterDefinition <RconModel> filter = null) => Mongo.Get(filter).Any();
public static RconModel GetOne(FilterDefinition <RconModel> filter = null) => Mongo.Get(filter).SingleOrDefault();
public static RconModel GetOne(string servername) { var filter = Builders <RconModel> .Filter.Eq(x => x.ServerName, servername); return(Mongo.Get(filter).SingleOrDefault()); }
public MainViewModel() { if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { History = new AsyncObservableCollection <CommandHistoryItemModel>(); History.Add(new CommandHistoryItemModel { Action = ActionType.Received, ComputerSender = "asd", CreatedDate = DateTime.Now, Error = false, ModifiedDate = DateTime.Now, ExecutionTime = TimeSpan.FromSeconds(12), RequestedDateTime = DateTime.Now }); History.Add(new CommandHistoryItemModel { Action = ActionType.Executed, ComputerSender = "asd", CreatedDate = DateTime.Now, Error = true, ErrorMessage = "nao deu pra executar", ModifiedDate = DateTime.Now, ExecutionTime = TimeSpan.FromSeconds(12), RequestedDateTime = DateTime.Now, }); History.Add(new CommandHistoryItemModel { Action = ActionType.Returned, ComputerSender = "asd", CreatedDate = DateTime.Now, Error = false, ModifiedDate = DateTime.Now, ExecutionTime = TimeSpan.FromSeconds(12), RequestedDateTime = DateTime.Now }); return; } History = new AsyncObservableCollection <CommandHistoryItemModel>(); var client = GetClientData(); var filter = Builders <ClientModel> .Filter.Eq(x => x.Identifier, client.Identifier); var results = Mongo.Get(filter).ToList(); if (results.Any()) { client = results.FirstOrDefault(); } else { Mongo.InsertOne(client); client = Mongo.Get(filter).FirstOrDefault(); } var manager = new SqlManager(ConexaoGlobalCartorios.StringDeConexaoAoBanco); var listener = new ClientRemoteListener(client, TimeSpan.FromSeconds(5), manager); listener.CommandReceived += CommandReceived; listener.CommandExecuted += CommandExecuted; listener.Start(); }
public static IEnumerable <CommandInfoModel> GetAll() => Mongo.Get <CommandInfoModel>().ToList();
public IEnumerable <Entity> List() { return(Mongo.Get(Builders <ClientModel> .Filter.Empty).ToEnumerable()); }