Exemple #1
0
        public void RemoveUserDefinedWidget(IUserDefinedWidget widgetToRemove)
        {
            var fixedProjectWidget = widgetToRemove as FixedBudgetMonitorWidget;

            if (fixedProjectWidget != null)
            {
                // Reassign transactions to Surplus
                var projectBucket =
                    this.bucketRepository.GetByCode(fixedProjectWidget.BucketCode) as FixedBudgetProjectBucket;
                if (projectBucket == null)
                {
                    throw new InvalidOperationException(
                              "The fixed project bucket provided doesn't actually appear to be a Fixed Budget Project Bucket");
                }

                projectBucket.Active          = false;
                fixedProjectWidget.Visibility = false;
                // Not sure I really want to do this. It will mean this data is gone forever.
                // fixedProjectWidget.Statement.ReassignFixedProjectTransactions(projectBucket, this.bucketRepository.SurplusBucket);

                // No need to remove it from the Budget, the Budget is actually not aware of these fixed project buckets in any way.
                // this.bucketRepository.RemoveFixedBudgetProject(projectBucket);
                this.budgetRepository.SaveAsync(); // Bucket Repo data is stored in the budget repo however.
                return;
            }

            this.widgetService.Remove(widgetToRemove);

            var baseWidget  = (Widget)widgetToRemove;
            var widgetGroup = WidgetGroups.FirstOrDefault(group => group.Heading == baseWidget.Category);

            widgetGroup?.Widgets.Remove(baseWidget);
        }
        /// <summary>
        ///     Removes the specified widget.
        /// </summary>
        public void Remove(IUserDefinedWidget widget)
        {
            if (widget == null)
            {
                return;
            }

            this.cachedWidgets.Remove(BuildMultiUseWidgetKey(widget));
        }
        /// <summary>
        ///     Removes the specified widget.
        /// </summary>
        public void Remove(IUserDefinedWidget widget)
        {
            if (widget == null)
            {
                return;
            }

            this.cachedWidgets.Remove(BuildMultiUseWidgetKey(widget));
        }
 private static string BuildMultiUseWidgetKey(IUserDefinedWidget widget)
 {
     var baseWidget = (Widget) widget;
     return baseWidget.Category + baseWidget.Name + widget.Id;
 }
        public void RemoveUserDefinedWidget(IUserDefinedWidget widgetToRemove)
        {
            var fixedProjectWidget = widgetToRemove as FixedBudgetMonitorWidget;
            if (fixedProjectWidget != null)
            {
                // Reassign transactions to Surplus
                var projectBucket =
                    this.bucketRepository.GetByCode(fixedProjectWidget.BucketCode) as FixedBudgetProjectBucket;
                if (projectBucket == null)
                {
                    throw new InvalidOperationException(
                        "The fixed project bucket provided doesn't actually appear to be a Fixed Budget Project Bucket");
                }

                projectBucket.Active = false;
                fixedProjectWidget.Visibility = false;
                // Not sure I really want to do this. It will mean this data is gone forever.
                // fixedProjectWidget.Statement.ReassignFixedProjectTransactions(projectBucket, this.bucketRepository.SurplusBucket);

                // No need to remove it from the Budget, the Budget is actually not aware of these fixed project buckets in any way.
                // this.bucketRepository.RemoveFixedBudgetProject(projectBucket);
                this.budgetRepository.SaveAsync(); // Bucket Repo data is stored in the budget repo however.
                return;
            }

            this.widgetService.Remove(widgetToRemove);

            var baseWidget = (Widget) widgetToRemove;
            var widgetGroup = WidgetGroups.FirstOrDefault(group => group.Heading == baseWidget.Category);

            widgetGroup?.Widgets.Remove(baseWidget);
        }
 /// <summary>
 ///     Removes the specified widget.
 /// </summary>
 public void Remove(IUserDefinedWidget widget)
 {
     this.widgetRepo.Remove(widget);
 }
        private static string BuildMultiUseWidgetKey(IUserDefinedWidget widget)
        {
            var baseWidget = (Widget)widget;

            return(baseWidget.Category + baseWidget.Name + widget.Id);
        }
 /// <summary>
 ///     Removes the specified widget.
 /// </summary>
 public void Remove(IUserDefinedWidget widget)
 {
     this.widgetRepo.Remove(widget);
 }