protected virtual void OnAfterSaveClick(EntitySaveWebEventArgs e) { if (AfterSaveClick != null) { AfterSaveClick(e); } }
protected virtual void OnBeforeSaveClick(EntitySaveWebEventArgs e) { if (BeforeSaveClick != null) { BeforeSaveClick(e); } }
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; } }
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); }