Esempio n. 1
0
        public List <Guid> GetUnreceivedIds(string userName, string deviceId, Func <T, bool> predicate)
        {
            var received = ReceivedItemIds.FirstOrDefault(x => (x.UserName == userName) && (x.DeviceId == deviceId));

            if (received == null)
            {
                received = new ReceivedItemIds()
                {
                    UserName = userName, DeviceId = deviceId
                };
                ReceivedItemIds.Add(received);
            }
            var ids = received.ItemsIds;

            var results = Items.Where(predicate).Where(x => !ids.Contains(x.Id)).Select(x => x.Id).ToList();

            received.ItemsIds.AddRange(results);
            return(results);
        }
Esempio n. 2
0
        public List <Guid> GetUnReceivedUploadCommands(string userName, string deviceId)
        {
            string _userName = userName.ToLower();

            var received = ReceivedUploadCommandIds.FirstOrDefault(x => (x.UserName == userName) && (x.DeviceId == deviceId));

            if (received == null)
            {
                received = new ReceivedItemIds()
                {
                    UserName = userName, DeviceId = deviceId
                };
                ReceivedUploadCommandIds.Add(received);
            }
            var ids = received.ItemsIds;

            var results = Items.Where(x => !x.UploadCompletedDate.HasValue && (x.SourceUserName.ToLower() == _userName)).Where(x => !ids.Contains(x.Id)).Select(x => x.Id).ToList();

            received.ItemsIds.AddRange(results);
            return(results);
        }