Exemplo n.º 1
0
        protected override void OnClick(EventArgs e)
        {
            EntityDeleteEventArgs EntityDeleteEventArgs = new EntityDeleteEventArgs();

            OnBeforeDeleteClick(EntityDeleteEventArgs);

            // Testa se o cliente não cancelou o OnClick explicitamente.
            if (EntityDeleteEventArgs.CancelAction)
            {
                return;
            }

            EntityDeleteEventArgs.Entity = getEntityFromGridViewEntity();

            if (EntityDeleteEventArgs.Entity == null)
            {
                throw new EntityParentException("A propriedade EntityCurrent do DataGridViewEntity está nula ! ");
            }

            EntityDeleteEventArgs.EntityManager = entityManagerSourceInstance as IDeleteRegister;

            EntityDeleteEventArgs.EntityManager.Delete(EntityDeleteEventArgs.Entity.Id);

            refreshGridViewEntity();

            refreshButtonNewEntity();

            OnAfterDeleteClick(EntityDeleteEventArgs);
        }
Exemplo n.º 2
0
 protected virtual void OnAfterDeleteClick(EntityDeleteEventArgs e)
 {
     if (AfterDeleteClick != null)
     {
         AfterDeleteClick(e);
     }
     if (!e.CancelAction && showMessageSucess && !string.IsNullOrEmpty(messageSucess))
     {
         MessageBoxInformation.Show(Parent, messageSucess);
     }
 }
Exemplo n.º 3
0
        protected virtual void OnBeforeDeleteClick(EntityDeleteEventArgs e)
        {
            if (showMessageConfirmation && !string.IsNullOrEmpty(messageConfirmation))
            {
                if (!MessageBoxConfirmation.Show(Parent, messageConfirmation))
                {
                    e.CancelAction = true;

                    return;
                }
            }

            if (BeforeDeleteClick != null)
            {
                BeforeDeleteClick(e);
            }
        }
Exemplo n.º 4
0
 public static void EntityDeleteField(EntityDeleteEventArgs e) => SystemEvents.InvokeEvent(null, OnEntityDeleteField, e, nameof(OnEntityDeleteField));