private void btn_DeleteProject_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(
                string.Format("{0}{1}", ResourceStringManager.GetResourceByKey("ConfirmDeleteMessageBoxMessage"), this.SelectedProject.Name),
                ResourceStringManager.GetResourceByKey("ConfirmDeleteMessageBoxTitle"),
                System.Windows.MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                var projectLogic = new ProjectLogic();
                try
                {
                    projectLogic.DeleteProject(this.SelectedProject.Id);
                }
                catch (Exception ex)
                {
                    Logger.LogException(ex);
                    MessageBox.Show(ResourceStringManager.GetResourceByKey("DeleteProjectFailedTitle"),
                                    ResourceStringManager.GetResourceByKey("DeleteProjectFailedMessage"), MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
                projectLogic.Dispose();
                this.lv_Projects.SelectedItem = null;
                this.Load();
                this.RefreshBindings(this.PagingManager.CurrentPage);
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            if (!_projectLogic.ProjectExists(id))
            {
                return(HttpNotFound("Project does not exist"));
            }

            _projectLogic.DeleteProject(id);
            return(RedirectToAction("Index"));
        }
예제 #3
0
 public bool DeleteProject(long id)
 {
     try
     {
         return(_projectLogic.DeleteProject(id));
     }
     catch (Exception e)
     {
         throw new FaultException("sikertelen törlés");
     }
 }
        public void DeleteProject_TestFail()
        {
            // ARRANGE
            CreateProject();
            var toBeDeleted  = this.uow.Projects.GetAll().First();
            var projectLogic = new ProjectLogic();

            // ACT
            projectLogic.DeleteProject(toBeDeleted.Id);
            projectLogic.Dispose();
            this.uow.Dispose();
            this.uow = new UnitOfWork();

            // ASSERT
            var deleted = this.uow.Projects.Get(toBeDeleted.Id);

            Assert.IsNull(deleted);
        }
        public void DeleteProject_TestSuccess()
        {
            // ARRANGE
            CreateProject();
            var toBeDeleted  = this.uow.Projects.GetAll().First();
            var projectLogic = new ProjectLogic();

            // ACT
            projectLogic.SetStatus(toBeDeleted.Id, EnumDefinition.ProjectStatus.Archived);
            projectLogic.DeleteProject(toBeDeleted.Id);
            projectLogic.Dispose();
            this.uow.Dispose();
            this.uow = new UnitOfWork();

            // ASSERT
            var deleted = this.uow.Projects.Get(toBeDeleted.Id);

            Assert.IsNull(deleted);
        }
예제 #6
0
 public void DeleteProject(int id)
 {
     _projectLogic.DeleteProject(id);
 }