Esempio n. 1
0
 public override void OnDelete(DeleteMessage message)
 {
     if (message.Reason != MediaFiles.DeleteMediaFileReason.Upgrade)
     {
         _traktService.RemoveMovieFromCollection(Settings, message.Movie, message.MovieFile);
     }
 }
Esempio n. 2
0
        private Task DeleteFile(FileInfo fileInfo)
        {
            var message = new DeleteMessage(fileInfo.Name);

            _messageCollection.Add(message, _cancellationToken);
            return(Task.FromResult(0));
        }
Esempio n. 3
0
        public ActionResult DeleteMessage(int messageId, int groupId)
        {
            var action = new DeleteMessage(_db, groupId, Requester(), messageId);

            action.Execute();
            return(RedirectToAction("Messages", new { id = groupId }));
        }
        public void Multiple_Local_Services_Should_Be_Available()
        {
            ManualResetEvent _updateEvent = new ManualResetEvent(false);

            LocalBus.Subscribe <UpdateMessage>(msg => _updateEvent.Set());

            ManualResetEvent _deleteEvent = new ManualResetEvent(false);


            LocalBus.Subscribe <DeleteMessage>(
                delegate { _deleteEvent.Set(); });


            DeleteMessage dm = new DeleteMessage();

            LocalBus.Publish(dm);

            UpdateMessage um = new UpdateMessage();

            LocalBus.Publish(um);

            Assert.That(_deleteEvent.WaitOne(TimeSpan.FromSeconds(4), true), Is.True,
                        "Timeout expired waiting for message");

            Assert.That(_updateEvent.WaitOne(TimeSpan.FromSeconds(4), true), Is.True,
                        "Timeout expired waiting for message");
        }
        public void Multiple_messages_should_be_delivered_to_the_appropriate_remote_subscribers()
        {
            ManualResetEvent _updateEvent = new ManualResetEvent(false);

            RemoteBus.Subscribe <UpdateMessage>(
                delegate { _updateEvent.Set(); });

            ManualResetEvent _deleteEvent = new ManualResetEvent(false);

            RemoteBus.Subscribe <DeleteMessage>(
                delegate { _deleteEvent.Set(); });

            DeleteMessage dm = new DeleteMessage();

            LocalBus.Publish(dm);

            UpdateMessage um = new UpdateMessage();

            LocalBus.Publish(um);

            Assert.That(_deleteEvent.WaitOne(TimeSpan.FromSeconds(6), true), Is.True,
                        "Timeout expired waiting for message");

            Assert.That(_updateEvent.WaitOne(TimeSpan.FromSeconds(6), true), Is.True,
                        "Timeout expired waiting for message");
        }
Esempio n. 6
0
 protected void DeleteInstance_Click(object sender, EventArgs e)
 {
     if (ReportViewControl.SelectedRowIndex != -1)
     {
         DeleteMessage.Show();
     }
 }
        public string SubjectDelete([FromUri] string applicationId, [FromUri] string subjectId, [FromUri] string emailAddress)
        {
            try
            {
                GDPRMessage msg = new GDPRMessage();

                DeleteMessage dm = new DeleteMessage();
                dm.ApplicationId        = applicationId;
                dm.ApplicationSubjectId = subjectId;
                dm.Direction            = "in";
                msg = dm;

                GDPRSubject s = new GDPRSubject();
                s.Email     = emailAddress;
                msg.Subject = s;

                MasterGDPRHelper.SendMessage(msg);
            }
            catch
            {
                return("Failure");
            }

            return("Success");
        }
Esempio n. 8
0
        void PropagateRequest(DeleteMessage request)
        {
            var client = new RestClient(request.Cooperator);

            var requestToSend = new RestRequest($"queues/{request.QueueName}/messages/{request.MessageId}", Method.DELETE);

            client.Execute(requestToSend);
        }
Esempio n. 9
0
 void ForceDelete(IDbConnection connection, DeleteMessage request)
 {
     connection.UpdateOnly(new QueueMessage {
         Readed = true
     },
                           message => new { message.Readed },
                           message => message.Id == request.MessageId);
 }
 public Task Run()
 {
     Core.Instance.Log.InfoFormat("Starting DeleteFileProtocol: {0}", _fileEntry);
     return(Task.Factory.StartNew(() =>
     {
         var msg = new DeleteMessage(_fileEntry.GetFileId());
         Core.Instance.MCChannel.Send(msg);
     }));
 }
Esempio n. 11
0
        private void OnIngredientDeleted(DeleteMessage <IngredientWrapper> message)
        {
            var ingredient = IngredientDetailViewModels.SingleOrDefault(i => i.Model.Id == message.Id);

            if (ingredient != null)
            {
                IngredientDetailViewModels.Remove(ingredient);
            }
        }
Esempio n. 12
0
        private void OnRecipeDeleted(DeleteMessage <RecipeWrapper> message)
        {
            var recipe = RecipeDetailViewModels.SingleOrDefault(i => i.Model.Id == message.Id);

            if (recipe != null)
            {
                RecipeDetailViewModels.Remove(recipe);
            }
        }
Esempio n. 13
0
        public void Should_throw_error_when_message_is_not_found()
        {
            var cmd = new DeleteMessage {
                MessageId = 999
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo($"Message with ID {999} was not found"));
        }
Esempio n. 14
0
        public Task <Unit> Handle(DeleteMessage request, CancellationToken cancellationToken)
        {
            if (request is null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            return(DeleteMessageInternalAsync(request.MesssageId, cancellationToken));
        }
 // methods
 private DeleteFlags BuildDeleteFlags(DeleteMessage message)
 {
     var flags = DeleteFlags.None;
     if (!message.IsMulti)
     {
         flags |= DeleteFlags.Single;
     }
     return flags;
 }
Esempio n. 16
0
        // methods
        private DeleteFlags BuildDeleteFlags(DeleteMessage message)
        {
            var flags = DeleteFlags.None;

            if (!message.IsMulti)
            {
                flags |= DeleteFlags.Single;
            }
            return(flags);
        }
Esempio n. 17
0
        public void Should_throw_error_when_message_id_is_invalid(int id)
        {
            new MessageBuilder().With(cr => cr.Id, id)
            .BuildAndSave();
            var cmd = new DeleteMessage {
                MessageId = id
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Message Id must be greater than 0"));
        }
Esempio n. 18
0
        /// <summary>
        /// A client can send this request to delete a message from a DECT phone.
        /// If the message which has to be deleted is still buffered in the OMM, it is removed from the queue, in this case this request has the same semantic as <see cref="CancelMessageAsync"/>.
        /// If the request is accepted by the OMM, it is put into the same queue as a message which had to be sent would have been put.
        /// The response to this request is always sent immediately, but it will take a while until the delete request can be actually forwarded to a DECT phone.
        /// For that reason the progress of deleting a message is reported using Events
        /// </summary>
        /// <param name="id">Message ID.</param>
        /// <param name="sendTime">Original send time of the message to be deleted.</param>
        /// <param name="toAddr">Recipient address of the message to be deleted. Must have the same scheme as the original message (e.g. "tel:" or "ppn:").</param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task DeleteMessageAsync(uint id, uint sendTime, string toAddr, CancellationToken cancellationToken)
        {
            var delete = new DeleteMessage
            {
                Id       = id,
                SendTime = sendTime,
                ToAddr   = toAddr
            };

            return(SendAsync <DeleteMessage, DeleteMessageResp>(delete, cancellationToken));
        }
Esempio n. 19
0
 public async Task <bool> DeleteMessageAsync(DeleteMessage deleteMessage)
 {
     try
     {
         return(await _AWSSQSHelper.DeleteMessageAsync(deleteMessage.ReceiptHandle));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 20
0
        public async Task Execute(IJobExecutionContext context)
        {
            _logger.LogInformation("__________Let's delete_______________");

            var mesage = new DeleteMessage()
            {
                Message = "Let's delete"
            };

            await _publisher.PublishDeleteMessage(mesage);
        }
Esempio n. 21
0
 private void onDeleteStatus(DeleteMessage deleteMessage)
 {
     try {
         using (var context = new TwitterContext()) {
             context.Upsert(new DeleteEvent(deleteMessage.UserId, deleteMessage.Id, deleteMessage.Timestamp.LocalDateTime, null, DeleteEventType.Status));
             context.Upsert(new ActiveTime(deleteMessage.UserId, deleteMessage.Timestamp.LocalDateTime));
             context.SaveChanges();
         }
     } catch (Exception e) {
         Console.Out.WriteLine($"onDeleteStatus : {e.Message}");
     }
 }
Esempio n. 22
0
        /// <summary>
        /// Deletes documents from the collection according to the spec.
        /// </summary>
        /// <remarks>An empty document will match all documents in the collection and effectively truncate it.
        /// </remarks>
        public void Delete(Document selector)
        {
            DeleteMessage dm = new DeleteMessage();

            dm.FullCollectionName = this.FullName;
            dm.Selector           = selector;
            try{
                this.connection.SendMessage(dm);
            }catch (IOException ioe) {
                throw new MongoCommException("Could not delete document, communication failure", this.connection, ioe);
            }
        }
Esempio n. 23
0
    public void displayAttacks()
    {
        if (ScanningKiddie.attackCountered == false && ScanningKiddie.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + ScanningKiddie.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }

        if (PhishingKiddie.attackCountered == false && PhishingKiddie.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + PhishingKiddie.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }

        if (MafiaAPTPCOffices.attackCountered == false && MafiaAPTPCOffices.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + MafiaAPTPCOffices.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }
        if (MafiaAPTServerOffices.attackCountered == false && MafiaAPTServerOffices.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + MafiaAPTServerOffices.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }
        if (MafiaAPTServerPlant.attackCountered == false && MafiaAPTServerPlant.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + MafiaAPTServerPlant.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }
        if (MafiaDisruptionController.attackCountered == false && MafiaDisruptionController.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + MafiaDisruptionController.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }
        if (HackingKiddie.attackCountered == false && HackingKiddie.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + HackingKiddie.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }
        if (DoSKiddie.attackCountered == false && DoSKiddie.attackEffect != "")
        {
            attackDisplayed.text = " WARNING : " + DoSKiddie.attackEffect + "  " + attackDisplayed.text;
            attackDisplayed.gameObject.SetActiveRecursively(true);
            StartCoroutine(DeleteMessage.coroutineD());
        }
    }
Esempio n. 24
0
        void TryDelete(IDbConnection connection, DeleteMessage request)
        {
            var firstMessageInQueue = connection.FirstOrDefault(FirstMessageQuery.make(connection));

            if (firstMessageInQueue == null || firstMessageInQueue.Id != request.MessageId)
            {
                throw new ArgumentException("Provided message was not first in queue");
            }
            firstMessageInQueue.Readed = true;
            connection.Update(firstMessageInQueue);
            Propagators.ScheduleQueueOperation(request.QueueName, () => PropagateRequest(request));
        }
        public void WriteMessage_should_encode_flags_correctly(int flags, bool isMulti)
        {
            var message = new DeleteMessage(__requestId, __collectionNamespace, __query, isMulti);

            using (var stream = new MemoryStream())
            {
                var subject = new DeleteMessageBinaryEncoder(stream, null);
                subject.WriteMessage(message);
                var bytes = stream.ToArray();
                bytes[__flagsOffset].Should().Be((byte)flags);
            }
        }
        // static constructor
        static DeleteMessageJsonEncoderTests()
        {
            __testMessage = new DeleteMessage(__requestId, __collectionNamespace, __query, __isMulti);

            __testMessageJson =
                "{ " +
                "\"opcode\" : \"delete\", " +
                "\"requestId\" : 1, " +
                "\"database\" : \"d\", " +
                "\"collection\" : \"c\", " +
                "\"query\" : { \"x\" : 1 }, " +
                "\"isMulti\" : false" +
                " }";
        }
Esempio n. 27
0
        public void Should_throw_error_when_message_not_owned_by_player_is_not_found()
        {
            new MessageBuilder()
            .With(m => m.Id, 61)
            .With(m => m.Receiver, new PlayerBuilder()
                  .With(p => p.Id, 3).BuildAndSave())
            .BuildAndSave();

            var cmd = new DeleteMessage {
                MessageId = 61, OwnerId = 4
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("Message 61 not owned by player 4"));
        }
Esempio n. 28
0
        public void Should_throw_error_when_owner_not_set()
        {
            new MessageBuilder()
            .With(m => m.Id, 61)
            .With(m => m.Receiver, new PlayerBuilder()
                  .With(p => p.Id, 3).BuildAndSave())
            .BuildAndSave();

            var cmd = new DeleteMessage {
                MessageId = 61
            };

            Assert.That(() => Repository.Execute(cmd),
                        Throws.TypeOf <DomainException>().With.Message.EqualTo("OwnerId is required to delete a message"));
        }
Esempio n. 29
0
        private void OnFilmDeleted(DeleteMessage <FilmWrapper> message)
        {
            var film = FilmDetailViewModels.SingleOrDefault(i => i.Model.Id == message.Id);

            if (film != null)
            {
                FilmDetailViewModels.Remove(film);
                if (FilmDetailViewModels.Any())
                {
                    _mediator.Send(new SelectedMessage <FilmWrapper> {
                        Id = FilmDetailViewModels.Last().Model.Id
                    });
                }
            }
        }
        private static async Task ContactUs(TelegramBotAbstract telegramBotClient, MessageEventArgs e)
        {
            await DeleteMessage.DeleteIfMessageIsNotInPrivate(telegramBotClient, e);

            var lang2 = new Language(new Dictionary <string, string>
            {
                { "it", telegramBotClient.GetContactString() },
                { "en", telegramBotClient.GetContactString() }
            });
            await telegramBotClient.SendTextMessageAsync(e.Message.Chat.Id,
                                                         lang2, e.Message.Chat.Type, e.Message.From.LanguageCode,
                                                         ParseMode.Default,
                                                         new ReplyMarkupObject(ReplyMarkupEnum.REMOVE), e.Message.From.Username
                                                         );
        }
Esempio n. 31
0
        private void OnPersonDeleted(DeleteMessage <PersonWrapper> message)
        {
            var person = PersonDetailViewModels.SingleOrDefault(i => i.Model.Id == message.Id);

            if (person != null)
            {
                PersonDetailViewModels.Remove(person);
                if (PersonDetailViewModels.Any())
                {
                    _mediator.Send(new SelectedMessage <PersonWrapper> {
                        Id = PersonDetailViewModels.Last().Model.Id
                    });
                }
            }
        }
        /// <summary>
        /// Writes the message.
        /// </summary>
        /// <param name="message">The message.</param>
        public void WriteMessage(DeleteMessage message)
        {
            Ensure.IsNotNull(message, nameof(message));

            var messageDocument = new BsonDocument
            {
                { "opcode", "delete" },
                { "requestId", message.RequestId },
                { "database", message.CollectionNamespace.DatabaseNamespace.DatabaseName },
                { "collection", message.CollectionNamespace.CollectionName },
                { "query", message.Query ?? new BsonDocument() },
                { "isMulti", message.IsMulti }
            };

            var jsonWriter = CreateJsonWriter();
            var messageContext = BsonSerializationContext.CreateRoot(jsonWriter);
            BsonDocumentSerializer.Instance.Serialize(messageContext, messageDocument);
        }
        /// <summary>
        /// Writes the message.
        /// </summary>
        /// <param name="message">The message.</param>
        public void WriteMessage(DeleteMessage message)
        {
            Ensure.IsNotNull(message, "message");

            var binaryWriter = CreateBinaryWriter();
            var stream = binaryWriter.BsonStream;
            var startPosition = stream.Position;

            stream.WriteInt32(0); // messageSize
            stream.WriteInt32(message.RequestId);
            stream.WriteInt32(0); // responseTo
            stream.WriteInt32((int)Opcode.Delete);
            stream.WriteInt32(0); // reserved
            stream.WriteCString(message.CollectionNamespace.FullName);
            stream.WriteInt32((int)BuildDeleteFlags(message));
            var context = BsonSerializationContext.CreateRoot(binaryWriter);
            BsonDocumentSerializer.Instance.Serialize(context, message.Query ?? new BsonDocument());
            stream.BackpatchSize(startPosition);
        }
Esempio n. 34
0
 public abstract DeleteMessage OnDeleteDestructive(DeleteMessage mes);
Esempio n. 35
0
 public abstract void OnDelete(DeleteMessage mes);
Esempio n. 36
0
 public override void OnDelete(DeleteMessage mes)
 {
     try
     {
         if (hasid == null)
         {
             hasid = scope.TryGetVariable("OnDelete", out id);
         }
         if (hasid ?? false) id(mes);
     }
     catch (Exception e)
     {
         ins.LogError("プラグイン " + Name + "でエラーが発生しました : " + e.Message);
         ins.SaveLog();
     }
 }
Esempio n. 37
0
 public override DeleteMessage OnDeleteDestructive(DeleteMessage mes)
 {
     try
     {
         if (hasidD == null)
         {
             hasidD = scope.TryGetVariable("OnDeleteDestructive", out idD);
         }
         if (hasidD ?? false)
         {
             return idD(mes);
         }
         else
         {
             return mes;
         }
     }
     catch (Exception e)
     {
         ins.LogError("プラグイン " + Name + "でエラーが発生しました : " + e.Message);
         ins.SaveLog();
         return mes;
     }
 }
Esempio n. 38
0
 public override void OnDelete(DeleteMessage mes)
 {
     try
     {
         var f = lua["OnDelete"] as Action<DeleteMessage>;
         if (f != null) f(mes);
     }
     catch (Exception e)
     {
         ins.LogError("プラグイン " + Name + "でエラーが発生しました : " + e.Message);
         ins.SaveLog();
     }
 }
Esempio n. 39
0
 private void Process(DeleteMessage deleteMessage)
 {
     this._ExchangeDataManager.ProcessDeleteMessage(deleteMessage);
 }
Esempio n. 40
0
 public override DeleteMessage OnDeleteDestructive(DeleteMessage mes)
 {
     try
     {
         var f = lua["OnDeleteDestructive"] as Func<DeleteMessage, DeleteMessage>;
         if (f != null)
         {
             return f(mes);
         }
         else
         {
             return mes;
         }
     }
     catch (Exception e)
     {
         ins.LogError("プラグイン " + Name + "でエラーが発生しました : " + e.Message);
         ins.SaveLog();
         return mes;
     }
 }
        public async void DeleteNote(DeleteMessage message)
        {
            var dialog = new MessageDialog("Do you want to remove this note?");
            dialog.Title = "Confirmation";
            dialog.Commands.Add(new UICommand { Label = "Delete", Id = 0 });
            dialog.Commands.Add(new UICommand { Label = "Cancel", Id = 1 });
            var res = await dialog.ShowAsync();

            if ((int)res.Id == 0)
            {
                await dataService.DeleteNote(message.Content);
                RaisePropertyChanged(nameof(Notes));
            }
        }
        private static Message Convert(string exchangeCode, DeleteCommand deleteCommand)
        {
            List<Transaction> transactionList = new List<Transaction>();
            List<Order> orderList = new List<Order>();
            List<OrderRelation> orderRelationList = new List<OrderRelation>();

            XmlNode transactionNodes = deleteCommand.Content["AffectedOrders"];
            if (transactionNodes != null)
            {
                foreach (XmlNode transactionNode in transactionNodes.ChildNodes)
                {
                    Transaction[] transactions;
                    Order[] orders;
                    OrderRelation[] orderRelations;

                    CommandConvertor.Parse(exchangeCode,transactionNode, out transactions, out orders, out orderRelations);
                    transactionList.AddRange(transactions);
                    orderList.AddRange(orders);
                    orderRelationList.AddRange(orderRelations);
                }
            }

            Guid deletedOrderId = Guid.Empty;
            Guid accountId = Guid.Empty;
            Guid instrumentId = Guid.Empty;
            XmlNode deletedOrderNode = deleteCommand.Content["DeletedOrder"];
            if (deletedOrderNode != null)
            {
                deletedOrderId = new Guid(deletedOrderNode.Attributes["ID"].Value);
                instrumentId = new Guid(deletedOrderNode.Attributes["InstrumentID"].Value);
                accountId = new Guid(deletedOrderNode.Attributes["AccountID"].Value);
            }

            DeleteMessage deleteMessage = new DeleteMessage(exchangeCode,deletedOrderId,instrumentId,
                transactionList.ToArray(), orderList.ToArray(), orderRelationList.ToArray());
            return  deleteMessage;
        }