コード例 #1
0
 protected virtual void OnAfterSaveClick(EntitySaveWebEventArgs e)
 {
     if (AfterSaveClick != null)
     {
         AfterSaveClick(e);
     }
 }
コード例 #2
0
 protected virtual void OnBeforeSaveClick(EntitySaveWebEventArgs e)
 {
     if (BeforeSaveClick != null)
     {
         BeforeSaveClick(e);
     }
 }
コード例 #3
0
        private void setEntityFromControl(EntitySaveWebEventArgs e)
        {
            try
            {
                SetEntityFromControl.Instance.Execute(e.Entity, Page);
            }
            catch (PropertyListException E)
            {
                if (ShowMessageExceptions)
                {
                    WebInformationDialog.Show(Page, E.Message);
                }
                else
                {
                    throw new PropertyListException(E.PropertyExceptions);
                }

                e.CancelAction = true;
            }
        }
コード例 #4
0
        protected override void OnClick(EventArgs e)
        {
            EntitySaveWebEventArgs entitySaveEventArgs = new EntitySaveWebEventArgs();

            OnBeforeSaveClick(entitySaveEventArgs);

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

            entitySaveEventArgs.Entity = getEntityFromGridViewEntity();

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

            setEntityFromControl(entitySaveEventArgs);

            //Testa pela segunda vez para assegurar que não houve problemas nos sets para as propriedades.
            if (entitySaveEventArgs.CancelAction)
            {
                return;
            }

            entitySaveEventArgs.EntityManager = entityManagerSourceInstance as IPostRegister;

            entitySaveEventArgs.EntityManager.Entity = entitySaveEventArgs.Entity;
            entitySaveEventArgs.EntityManager.Post();

            refreshButtonNewEntity();

            refreshGridViewEntity();

            OnAfterSaveClick(entitySaveEventArgs);
        }