Пример #1
0
        public RestitutionValueModeViewModel(RestitutionValueMode mode)
        {
            this.Value = mode;

            string key;

            switch (mode)
            {
            case RestitutionValueMode.Absolute:
                key = "View_Restitution_AbsoluteValues";
                break;

            case RestitutionValueMode.Relative:
                key = "View_Restitution_RelativeValues";
                break;

            case RestitutionValueMode.Occurences:
                key = "View_Restitution_OccurenceValues";
                break;

            default:
                throw new ArgumentOutOfRangeException("mode");
            }

            this.Label = LocalizationManagerExt.GetSafeDesignerString(key);
        }
Пример #2
0
        /// <summary>
        /// Sauvegarde les changements dans la base de données.
        /// </summary>
        public override async Task <int> SaveChangesAsync()
        {
            int ret = 0;

            try
            {
                ret = await base.SaveChangesAsync();
            }
            catch (OptimisticConcurrencyException ex)
            {
                Console.WriteLine("Db Concurrency occured");
                // On affiche un message d'erreur indiquant l'exception et on recharge les valeurs des entités qui ont été modifiées
                var dialogResult = IoC.Resolve <IDialogFactory>().GetDialogView <IMessageDialog>().Show(LocalizationManagerExt.GetSafeDesignerString("Common_Context_DbConcurrency_Message"), LocalizationManagerExt.GetSafeDesignerString("Common_Context_DbConcurrency_Title"));
                await RefreshAsync(RefreshMode.StoreWins, ex.StateEntries.Select(_ => _.Entity));

                //await RefreshAsync(RefreshMode.StoreWins, allchangedEntities.Select(_ => _.Value));

                ret = -666;
            }
            catch (Exception ex)
            {
                Console.WriteLine(DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss]"));
                Console.WriteLine($"Exception non gérée : {ex.Message}");

                while (ex.InnerException != null)
                {
                    Console.WriteLine(ex.InnerException.Message);
                    ex = ex.InnerException;
                }

                throw;
            }
            return(ret);
        }
Пример #3
0
        /// <summary>
        /// Initialise la classe <see cref="KGanttChartDataGrid"/>.
        /// </summary>
        static KGanttChartDataGrid()
        {
            DataGridWidthProperty.OverrideMetadata(typeof(KGanttChartDataGrid),
                                                   new PropertyMetadata(new GridLength(0.3, GridUnitType.Star)));
            ChartWidthProperty.OverrideMetadata(typeof(KGanttChartDataGrid),
                                                new PropertyMetadata(new GridLength(0.7, GridUnitType.Star)));

            TimelinePageStartProperty.OverrideMetadata(typeof(KGanttChartDataGrid), new PropertyMetadata(GanttDates.StartDate, OnTimelinePageStartChanged));
            TimelinePageFinishProperty.OverrideMetadata(typeof(KGanttChartDataGrid), new PropertyMetadata(GanttDates.StartDate, OnTimelinePageFinishChanged));

            DisplayedTimeProperty.OverrideMetadata(typeof(KGanttChartDataGrid), new PropertyMetadata(GanttDates.StartDate, OnDisplayedTimeChanged));

            IsAsyncPresentationEnabledProperty.OverrideMetadata(typeof(KGanttChartDataGrid), new PropertyMetadata(true, OnIsAsyncPresentationEnabledChanged));

            DependencyDeletionContextMenuItemHeaderProperty.OverrideMetadata(typeof(KGanttChartDataGrid), new PropertyMetadata(LocalizationManagerExt.GetSafeDesignerString("Core_Gantt_DeleteLink")));
        }
Пример #4
0
        /// <summary>
        /// Sauvegarde les changements dans la base de données.
        /// </summary>
        public override async Task <int> SaveChangesAsync()
        {
            int ret = 0;

            try
            {
                ret = await base.SaveChangesAsync();
            }
            catch (OptimisticConcurrencyException ex)
            {
                Console.WriteLine("Db Concurrency occured");
                // On affiche un message d'erreur indiquant l'exception et on recharge les valeurs des entités qui ont été modifiées
                var dialogResult = IoC.Resolve <IDialogFactory>().GetDialogView <IMessageDialog>().Show(LocalizationManagerExt.GetSafeDesignerString("Common_Context_DbConcurrency_Message"), LocalizationManagerExt.GetSafeDesignerString("Common_Context_DbConcurrency_Title"));
                foreach (var objectStateEntry in ex.StateEntries)
                {
                    await Entry(objectStateEntry.Entity).ReloadAsync();
                }

                ret = -666;
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception non gérée : {ex.Message}");
                throw ex;
            }
            return(ret);
        }
Пример #5
0
        static KGanttChartView()
        {
            TimelinePageStartProperty.OverrideMetadata(typeof(KGanttChartView), new PropertyMetadata(GanttDates.StartDate, OnTimelinePageStartChanged));
            TimelinePageFinishProperty.OverrideMetadata(typeof(KGanttChartView), new PropertyMetadata(GanttDates.StartDate, OnTimelinePageFinishChanged));

            DisplayedTimeProperty.OverrideMetadata(typeof(KGanttChartView), new PropertyMetadata(GanttDates.StartDate, OnDisplayedTimeChanged));

            IsAsyncPresentationEnabledProperty.OverrideMetadata(typeof(KGanttChartView), new PropertyMetadata(true, OnIsAsyncPresentationEnabledChanged));

            BarHeightProperty.OverrideMetadata(typeof(KGanttChartView), new PropertyMetadata(double.NaN, OnBarHeightChanged));

            DependencyDeletionContextMenuItemHeaderProperty.OverrideMetadata(typeof(KGanttChartView), new PropertyMetadata(LocalizationManagerExt.GetSafeDesignerString("Core_Gantt_DeleteLink")));
        }
Пример #6
0
        /// <summary>
        /// Crée les instances de <see cref="GanttGridViewContainer"/> et initialise les collections de référentiels.
        /// </summary>
        /// <returns>Les conteneurs créés.</returns>
        protected virtual IList <GanttGridViewContainer> CreateViewContainersAndInitializeReferentialCollections()
        {
            if (DesignMode.IsInDesignMode)
            {
                return new List <GanttGridViewContainer> {
                           new GanttGridViewContainer((int)GanttGridView.WBS, "WBS")
                }
            }
            ;

            var referentialsUseService = IoC.Resolve <IReferentialsUseService>();

            var views = new List <GanttGridViewContainer>()
            {
                new GanttGridViewContainer((int)GanttGridView.WBS, LocalizationManagerExt.GetSafeDesignerString("View_AnalyzeGridCommon_ViewByWBS")),
            };

            // Toujours actif
            views.Add(new GanttGridViewContainer((int)GanttGridView.Resource, LocalizationManagerExt.GetSafeDesignerString("View_AnalyzeGridCommon_ViewByResource")));

            // Toujours actif
            this.Categories = new BulkObservableCollection <ActionCategory>(true);
            views.Add(new GanttGridViewContainer((int)GanttGridView.Category, ReferentialsUse.Category));
            this.Skills = new BulkObservableCollection <Skill>(true);
            views.Add(new GanttGridViewContainer((int)GanttGridView.Skill, ReferentialsUse.Skill));

            if (referentialsUseService.IsReferentialEnabled(ProcessReferentialIdentifier.Ref1))
            {
                this.Ref1s = new BulkObservableCollection <Ref1>(true);

                views.Add(new GanttGridViewContainer((int)GanttGridView.Ref1, ReferentialsUse.Ref1));
                AddReferentialSortDescription(this.Ref1s);
            }

            if (referentialsUseService.IsReferentialEnabled(ProcessReferentialIdentifier.Ref2))
            {
                this.Ref2s = new BulkObservableCollection <Ref2>(true);
                views.Add(new GanttGridViewContainer((int)GanttGridView.Ref2, ReferentialsUse.Ref2));
                AddReferentialSortDescription(this.Ref2s);
            }

            if (referentialsUseService.IsReferentialEnabled(ProcessReferentialIdentifier.Ref3))
            {
                this.Ref3s = new BulkObservableCollection <Ref3>(true);
                views.Add(new GanttGridViewContainer((int)GanttGridView.Ref3, ReferentialsUse.Ref3));
                AddReferentialSortDescription(this.Ref3s);
            }

            if (referentialsUseService.IsReferentialEnabled(ProcessReferentialIdentifier.Ref4))
            {
                this.Ref4s = new BulkObservableCollection <Ref4>(true);
                views.Add(new GanttGridViewContainer((int)GanttGridView.Ref4, ReferentialsUse.Ref4));
                AddReferentialSortDescription(this.Ref4s);
            }

            if (referentialsUseService.IsReferentialEnabled(ProcessReferentialIdentifier.Ref5))
            {
                this.Ref5s = new BulkObservableCollection <Ref5>(true);
                views.Add(new GanttGridViewContainer((int)GanttGridView.Ref5, ReferentialsUse.Ref5));
                AddReferentialSortDescription(this.Ref5s);
            }

            if (referentialsUseService.IsReferentialEnabled(ProcessReferentialIdentifier.Ref6))
            {
                this.Ref6s = new BulkObservableCollection <Ref6>(true);
                views.Add(new GanttGridViewContainer((int)GanttGridView.Ref6, ReferentialsUse.Ref6));
                AddReferentialSortDescription(this.Ref6s);
            }

            if (referentialsUseService.IsReferentialEnabled(ProcessReferentialIdentifier.Ref7))
            {
                this.Ref7s = new BulkObservableCollection <Ref7>(true);
                views.Add(new GanttGridViewContainer((int)GanttGridView.Ref7, ReferentialsUse.Ref7));
                AddReferentialSortDescription(this.Ref7s);
            }

            return(views);
        }