Ejemplo n.º 1
0
 private void OnDeleting(Object dataObject)
 {
     if (Deleting != null)
     {
         Deleting.Invoke(dataObject, EventArgs.Empty);
     }
 }
Ejemplo n.º 2
0
        public virtual void DeleteValues(IDictionary parentValues)
        {
            var items = GetDataForDelete();

            if (items == null || items.Count == 0)
            {
                return;
            }

            var args = new CancelEventArgs();

            Deleting?.Invoke(items, args);
            if (args.Cancel)
            {
                return;
            }

            var dataSourceView = GetDataSourceView();
            var keys           = new Dictionary <string, object>();

            // todo: подумать что если прийдет id который пользователю не доступен
            foreach (var item in items)
            {
                if (item.ContainsKey(DataValueField))
                {
                    parentValues[DataValueField] = item[DataValueField].ToString();
                }
                keys[DataSelectedKeyField] = item[DataSelectedKeyField].ToString();
                dataSourceView.Delete(keys, parentValues, OnDeleted);
            }
        }
 private void OnBindBaseNoteExecute(SimpleNote simpleNote)
 {
     if (!isBindedBaseNote)
     {
         simpleNote.DataContext.Note        = Context;
         simpleNote.DataContext.Deleting   += () => { Deleting?.Invoke(); };
         simpleNote.DataContext.SelectDate += (n) => { SelectDate?.Invoke(Context); };
         isBindedBaseNote = true;
     }
 }
Ejemplo n.º 4
0
        public async Task <ICommandResult <TEntity> > DeleteAsync(TEntity model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var result = new CommandResult <TEntity>();

            var entity = await _entityStore.GetByIdAsync(model.Id);

            if (entity == null)
            {
                return(result.Failed(new CommandError($"An entity with the id {model.Id} could not be found")));
            }

            // Raise Deleting event
            Deleting?.Invoke(this, new EntityEventArgs <TEntity>(entity));

            // Invoke EntityDeleting subscriptions
            foreach (var handler in _broker.Pub <TEntity>(this, new MessageOptions()
            {
                Key = "EntityDeleting"
            }, entity))
            {
                entity = await handler.Invoke(new Message <TEntity>(entity, this));
            }

            var success = await _entityStore.DeleteAsync(entity);

            if (success)
            {
                // Raise Deleted event
                Deleted?.Invoke(this, new EntityEventArgs <TEntity>(entity, true));

                // Invoke EntityDeleted subscriptions
                foreach (var handler in _broker.Pub <TEntity>(this, new MessageOptions()
                {
                    Key = "EntityDeleted"
                }, entity))
                {
                    entity = await handler.Invoke(new Message <TEntity>(entity, this));
                }

                return(result.Success(entity));
            }

            return(result.Failed(new CommandError("An unknown error occurred whilst attempting to create an eneity.")));
        }
Ejemplo n.º 5
0
        public void Delete(IValueSet valueSet)
        {
            if (valueSet.IsCustom && this.isCustomValue.Get(valueSet) && !valueSet.IsNew())
            {
                Deleting?.Invoke(this, valueSet);

                this.repository.Delete(valueSet);

                Deleted?.Invoke(this, valueSet);

                return;
            }

            throw new InvalidOperationException("ValueSet was not a custom value set and cannot be deleted.");
        }
Ejemplo n.º 6
0
        //private void OnEditSLStandardDescription(SLStandardDescription sLStandardDescription)
        //{
        //    sLStandardDescription.SLId = SLId;
        //    EditSLStandardDescriptionRequested(sLStandardDescription);
        //}

        private async void OnDeleteSLStandardDescription(SLStandardDescription sLStandardDescription)
        {
            if (Deleting?.Invoke() == true)
            {
                try
                {
                    await _sLStandardDescriptionsService.DeleteSLStandardDescriptionAsync(sLStandardDescription.SLStandardDescriptionId);

                    SLStandardDescriptions.Remove(sLStandardDescription);
                    Deleted();
                }
                catch (Exception ex)
                {
                    Failed(ex);
                }
            }
        }
        //private void OnEditRelatedPerson(RelatedPerson relatedPerson)
        //{
        //    relatedPerson.RelatedPersonId = RelatedId;
        //    EditRelatedPersonRequested(relatedPerson);
        //}

        private async void OnDeleteRelatedPerson(RelatedPerson relatedPerson)
        {
            if (Deleting?.Invoke() == true)
            {
                try
                {
                    await _relatedPeopleService.DeleteRelatedPersonAsync(relatedPerson.RelatedPersonId);

                    RelatedPeople.Remove(relatedPerson);
                    Deleted();
                }
                catch (Exception ex)
                {
                    Failed(ex);
                }
            }
        }
        //private void OnEditAccDocumentItem(AccDocumentItem accDocumentItem)
        //{
        //    accDocumentItem.SLId = SLId;
        //    EditAccDocumentItemRequested(accDocumentItem);
        //}

        private async void OnDeleteAccDocumentItem(EditableAccDocumentItem accDocumentItem)
        {
            if (Deleting?.Invoke() == true)
            {
                try
                {
                    await _accDocumentItemsService.DeleteAccDocumentItemAsync(accDocumentItem.AccDocumentItemId);

                    AccDocumentItems.Remove(accDocumentItem);
                    Deleted();
                }
                catch (Exception ex)
                {
                    Failed(ex);
                }
            }
        }
Ejemplo n.º 9
0
        public async Task <int> DeleteAsync(Type type, Expression predicate)
        {
            if (_deleteAsync == null)
            {
                throw new NotImplementedException("Delete not implemented");
            }

            if (_deleting != null)
            {
                await _deleting.Invoke(type, predicate);
            }
            var deleteCount = await _deleteAsync(type, predicate);

            if (_deleted != null)
            {
                await _deleted(type, deleteCount);
            }
            return(deleteCount);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Déclenche l'événement <see cref="Deleting"/>
        /// </summary>
        protected virtual bool OnDeleting(OperationCancelEventArgs args)
        {
            if (args == null)
            {
                return(true);
            }

            // Si ça n'a pas été annulé
            if (args.Cancel == false)
            {
                //TODO: Confirm message
                // Demande de confirmation
                //if (!args.CancelDefaultMessage)
                //    args.Cancel = !ShellServices.MessageService.ShowYesNo(string.Format(CultureInfo.InvariantCulture, Resources.Message_DeleteConfirm, ViewTitle));

                Deleting?.Invoke(this, args);
            }

            return(args.Cancel);
        }
Ejemplo n.º 11
0
        public async Task <ICommandResult <TReply> > DeleteAsync(TReply reply)
        {
            // Validate
            if (reply == null)
            {
                throw new ArgumentNullException(nameof(reply));
            }

            var result = new CommandResult <TReply>();

            // Raise Deleting event
            Deleting?.Invoke(this, new EntityReplyEventArgs <TReply>(null, reply));

            // Invoke EntityReplyDeleting subscriptions
            foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyDeleting"))
            {
                reply = await handler.Invoke(new Message <TReply>(reply, this));
            }

            var success = await _entityReplyStore.DeleteAsync(reply);

            if (success)
            {
                // Raise Deleted event
                Deleted?.Invoke(this, new EntityReplyEventArgs <TReply>(null, reply));

                // Invoke EntityReplyDeleted subscriptions
                foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyDeleted"))
                {
                    reply = await handler.Invoke(new Message <TReply>(reply, this));
                }

                return(result.Success(reply));
            }

            return(result.Failed(new CommandError("An unknown error occurred whilst attempting to delete the reply.")));
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Gets called before the model element gets deleted
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnDeleting(UriChangedEventArgs e)
 {
     Deleting?.Invoke(this, e);
 }
Ejemplo n.º 13
0
 internal void OnDeleting(FileWatcher sender, EventArgs e)
 {
     Deleting?.Invoke(sender, e);
     WatchList.Remove(sender);
 }
 internal void OnDeleting()
 {
     Log.Informational($"Server {this.ID:00} Deleting.");
     Deleting.Invoke(this, null);
 }
 protected void OnDeleting(DeletingEventArgs <T> args)
 {
     Deleting?.Invoke(this, args);
 }
Ejemplo n.º 16
0
 private void DeleteFailingTestEntry_Execute() => Deleting?.Invoke(this, null);
Ejemplo n.º 17
0
 protected internal virtual void OnDeleting(CancelEventArgs e) => Deleting?.Invoke(this, e);
Ejemplo n.º 18
0
 private void OnDeleteButtonClicked()
 {
     Deleting?.Invoke(this);
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Gets called before the model element gets deleted
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnDeleting(EventArgs e, Uri originalAbsoluteUri)
 {
     Deleting?.Invoke(this, e);
     OnBubbledChange(BubbledChangeEventArgs.ElementDeleting(this, originalAbsoluteUri));
 }
Ejemplo n.º 20
0
 internal void OnDeleting(EntityRecord record)
 {
     Deleting?.Invoke(record, EventArgs.Empty);
 }
Ejemplo n.º 21
0
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     Deleting?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 22
0
 protected virtual void OnDeleting(EntityEventArgs <TModel> e)
 {
     Deleting?.Invoke(this, e);
 }
Ejemplo n.º 23
0
 private void OnDeleteExecute()
 {
     Deleting?.Invoke();
 }
Ejemplo n.º 24
0
 public virtual void OnDeleting(EntityReplyEventArgs <TModel> e)
 {
     Deleting?.Invoke(this, e);
 }
Ejemplo n.º 25
0
 private void DeleteTag(object sender, EventArgs e)
 {
     Deleting?.Invoke(this, e);
 }