Пример #1
0
        public override void CleanBeforeSave()
        {
            base.CleanBeforeSave();

            if ((SelectedReportingStates == null || !SelectedReportingStates.Any()) && StateContext.Any())
            {
                if (SelectedReportingStates == null)
                {
                    SelectedReportingStates = new List <string>();
                }


                StateContext.ForEach(s =>
                {
                    if (SelectedReportingStates.All(rs => !rs.EqualsIgnoreCase(s)))
                    {
                        SelectedReportingStates.Add(s);
                    }
                });
            }

            // Handle Reports null values to force index reordering
            //CleanUpCollectionItems();

            // ****** Status processing for website ******

            // Check status is greater than CompletedDependencyCheck return.
            if ((int?)CurrentStatus >= (int?)WebsiteState.CompletedDependencyCheck)
            {
                return;
            }

            if ((Reports != null && Reports.Any()) && (Measures != null && Measures.Any()) && Datasets.Any())
            {
                CurrentStatus = WebsiteState.Initialized;
            }

            // Check status should be set to HasReports.
            if (CurrentStatus == WebsiteState.HasReports || (Reports != null && Reports.Any()))
            {
                CurrentStatus = WebsiteState.HasReports;
                return;
            }

            // Check status should be set to HasMeasures.
            if (CurrentStatus == WebsiteState.HasMeasures || (Measures != null && Measures.Any()))
            {
                CurrentStatus = WebsiteState.HasMeasures;
                return;
            }

            // Check status should be set to HasDatasources.
            if (CurrentStatus == WebsiteState.HasDatasources || !Datasets.Any())
            {
                return;
            }
            CurrentStatus = WebsiteState.HasDatasources;
        }