Ejemplo n.º 1
0
        public async void Delete()
        {
            await _dialogManager.ShowMessageAsync(
                string.Format("Are you sure you want to delete {0}?", ActiveStaffingResource.FullName),
                DialogResult.Yes, DialogResult.No, DialogButtons.YesNo);

            try
            {
                using (ActiveDetail.Busy.GetTicket())
                {
                    ActiveUnitOfWork.StaffingResources.Delete(ActiveStaffingResource);
                    await ActiveUnitOfWork.CommitAsync();
                }

                ActiveItem.TryClose();
            }
            catch (TaskCanceledException)
            {
                ActiveUnitOfWork.Rollback();
            }
            catch (Exception)
            {
                ActiveUnitOfWork.Rollback();
                throw;
            }
        }
Ejemplo n.º 2
0
        public void Cancel()
        {
            var shouldClose = ActiveStaffingResource.EntityFacts.EntityState.IsAdded();

            ActiveUnitOfWork.Rollback();

            if (shouldClose)
            {
                ActiveDetail.TryClose();
            }
            else
            {
                ActiveDetail.Start(ActiveStaffingResource.Id, EditMode.View);
            }
        }