Esempio n. 1
0
        protected virtual T LoadDto(ExecutionEvent executionEvent)
        {
            ICRUDService <T> crudService = (ICRUDService <T>)ServiceActivator.Get(HandlerUtils.DTO_TO_SERVICE[typeof(T)]);

            Connection.GetInstance().StartTransaction();
            T dto = crudService.Read(executionEvent.GetFirstSelectedTreeNavigationItem().Id);

            Connection.GetInstance().EndTransaction();
            return(dto);
        }
        protected override void DoExecute(ExecutionEvent executionEvent)
        {
            try
            {
                ICollection <Guid> idsToRemove     = TreeNavigationItem.CollectIds(executionEvent.GetSelectedTreeNavigationItems());
                string             questionMessage = GetQuestionMessage(idsToRemove.Count, executionEvent.GetFirstSelectedTreeNavigationItem().Name);
                if (MessageBoxResult.No.Equals(MessageDialogUtils.Question(questionMessage, executionEvent.GetFirstSelectedTreeNavigationItem().Name)))
                {
                    return;
                }

                foreach (Guid idToRemove in idsToRemove)
                {
                    Delete(executionEvent, idToRemove);
                    OnSuccessful(executionEvent, idToRemove);
                }
            }
            catch (ValidationException ex)
            {
                WindowsManager.GetInstance().ShowDialog <MessageWindow>(new MessageWindowModelView(ex.GetValidationResult()));
            }
        }
Esempio n. 3
0
 protected override void OnSuccessful(ExecutionEvent executionEvent, Guid affectedObjectId)
 {
     Log.Info(string.Format("Entity '{0}' was craeted", affectedObjectId));
     Publisher.GetInstance().Publish(PublishEvent.CreateCreationEvent(affectedObjectId, executionEvent.GetFirstSelectedTreeNavigationItem().Id));
 }