private void CommitToCurrentWebsite() { // Copy each Contents to Active...Model ZoneContents.ForEach(cc => { cc.Zone.Contents = cc.Contents; }); // Mark Model as modified. ActiveWebsitePageModel.IsModified = true; // ActiveWebsitePageModel (or it's WebsitePage, or it's Zones) may not be a part of the // CurrentWebsite object; it could be a 'local' member of the DataGrid list of the ListView screen. // In such a case, it is required that the ActiveWebsitePageModel.*WebsitePage.*Zones be copied // to the CurrentWebsite->WebsitePages list. // 1) (if dbWS==null) Reuse the exact object in the ListView Screen. (It is already created, and unattached/non-conflicted // to anything DB related) // 2) (else if) Not same object. Some how we have different objects, just reassign the data. [Probably should never happen] // 3) (else) ActiveWebsitePageModel is the exact object in CurrentWebsite.WebsitePages.... So // we have already assigned everything we need to. ActiveWebsitePageModel.WebsitePages.ForEach(awp => { var cwp = CurrentWebsite.WebsitePages.FirstOrDefault(wp => wp.Name == awp.Name && wp.Audience == awp.Audience); if (cwp == null) { CurrentWebsite.WebsitePages.Add(awp); } else if (cwp != awp) { cwp.DeepAssignmentFrom(awp); } }); }
public void OnViewUnloaded() { // Reset the Screen View; Navigate to WebsitePagesListView.xaml. ParentModel.WebsitePageState = WebsitePageStateEnum.List; ManageViewModel.WebsiteManageViewActionsVisibility = System.Windows.Visibility.Visible; // Clear local stuff. ActiveWebsitePageModel = null; ZoneContents.Clear(); }
public void OnViewLoaded() { if (ActiveWebsitePageModel == null) { return; } ManageViewModel.WebsiteManageViewActionsVisibility = System.Windows.Visibility.Collapsed; InitializeControls(); // Copy contents of Zones to temp/local list. ZoneContents.Clear(); ActiveWebsitePageModel.WebsitePages.ForEach(wp => { wp.Zones.ForEach(c => { ZoneContents.Add(new WebsitePageZoneContent() { Zone = c, Contents = c.Contents }); }); }); RaisePropertyChanged(() => HeaderZone); RaisePropertyChanged(() => FooterZone); // Load Measures associated with current 'ActiveWebsitePageModel'. MeasureColumns.Clear(); if (ActiveWebsitePageModel.PageType == Infrastructure.Entities.Domain.BaseData.WebsitePageTypeEnum.Report && !ActiveWebsitePageModel.ReportName.IsNullOrEmpty()) { var websiteReport = CurrentWebsite.Reports.FirstOrDefault(r => r.Report.Name == ActiveWebsitePageModel.ReportName); if (websiteReport != null) { var allReportColumns = websiteReport.Report.Columns; //.Where(c => c.IsMeasure); var currentReportMeasures = allReportColumns.LeftJoin( CurrentWebsite.Measures.Where(wm => wm.IsSelected), rc => rc.MeasureCode, wm => wm.OriginalMeasure.Name, (rc, wm) => new MeasureColumn() { WebsiteMeasure = wm, ReportColumn = rc }); currentReportMeasures = currentReportMeasures.Where(crm => !crm.ReportColumn.IsMeasure || crm.WebsiteMeasure != null); currentReportMeasures.ForEach(crm => MeasureColumns.Add(crm)); RaisePropertyChanged(() => MeasureColumns); RaisePropertyChanged(() => EditedMeasureColumnsCount); } } }
public void OnViewLoaded() { ManageViewModel.WebsiteManageViewActionsVisibility = System.Windows.Visibility.Collapsed; InitializeControls(); // Copy contents of Zones to temp/local list. //ActiveWebsitePageModel = ReferenceWebsitePageModel.DeepClone(); ZoneContents.Clear(); ActiveWebsitePageModel.WebsitePages.ForEach(wp => { wp.Zones.ForEach(z => { ZoneContents.Add(new WebsitePageZoneContent { Zone = z, Contents = z.Contents }); }); }); RaisePropertyChanged(() => ZoneContents); RaisePropertyChanged(() => CurrentZoneContent); }