Beispiel #1
0
        void SelectReportGroupViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "SelectedReportGroup":
                if (selectedReportGroup != null)
                {
                    if (selectedReportGroup.AccessLevel >= ReportGroupAccessLevelType.ReadOnly)
                    {
                        if (!selectedReportGroup.IsJustAdded)
                        {
                            IsSubmittingContext = true;
                            IsRetreivingReports = true;
                            myContext.Load <Report>(myContext.GetAllReportsForReportGroupQuery(selectedReportGroup.Code), GetReportsForReportGroupCallback, null);
                        }

                        else
                        {
                            selectedReportGroup.IsJustAdded = false;
                            selectedReportGroup.IsRenaming  = true;
                        }
                    }
                }
                ViewReportCommand.UpdateCanExecuteCommand();
                EditReportCommand.UpdateCanExecuteCommand();
                break;

            case "SelectedReport":
                ViewReportCommand.UpdateCanExecuteCommand();
                EditReportCommand.UpdateCanExecuteCommand();
                DeleteReportCommand.UpdateCanExecuteCommand();
                PublishReportCommand.UpdateCanExecuteCommand();
                break;
            }
        }
        public async Task <IHttpActionResult> DeleteReport(int organizationId, int reportId)
        {
            try
            {
                if (!_userContext.CurrentUserIsSystemUser())
                {
                    return(Unauthorized());
                }

                if (!_userContext.CurrentUserIsSystemAdmin())
                {
                    return(Unauthorized());
                }

                if (!_userContext.CurrentUserCanAccess(organizationId))
                {
                    return(Unauthorized());
                }

                var cmd = new DeleteReportCommand(reportId);
                await _endpointInstance().SendWithSignalRMetaData(cmd, Request);

                return(this.Accepted());
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(InternalServerError());
            }
        }
        public void CanBeSerialized()
        {
            //Arrange
            var sut = new DeleteReportCommand(Guid.NewGuid());

            //Act
            var json = JsonSerializer.Serialize(sut);

            //Assert
            Assert.False(string.IsNullOrEmpty(json));
        }
        public void CanBeConstructed()
        {
            //Arrange
            var id  = Guid.NewGuid();
            var sut = new DeleteReportCommand(id);

            //Act
            var hashCode = sut.GetHashCode();

            //Assert
            Assert.NotNull(sut);
            Assert.Equal(hashCode, sut.GetHashCode());
            Assert.Equal(id, sut.ReportId);
        }
        public void Delete(long reportId)
        {
            var command = new DeleteReportCommand(reportId);

            _commandDispatcher.Handle(command);
        }
 public async Task <bool> Delete(DeleteReportCommand command)
 {
     return(await _applicationFacade.Execute(command));
 }
 public void EstablishContext()
 {
     fileSystem          = MockRepository.GenerateStub <IFileSystem>();
     deleteReportCommand = new DeleteReportCommand(fileSystem);
 }
Beispiel #8
0
 public async Task <ActionResult> Delete(
     [FromRoute] DeleteReportCommand command)
 => await this.Send(command);