public override int Delete(Data.DataFilter filter) { var deletes = this.Get(filter).ToList(m => m.ID); if (deletes.Any()) { var layoutHtmlService = new LayoutHtmlService(); layoutHtmlService.Delete(new Data.DataFilter().Where <LayoutHtml>(m => m.LayoutId, OperatorType.In, deletes)); var zoneService = new ZoneService(); zoneService.Delete(new Data.DataFilter().Where <ZoneEntity>(m => m.LayoutId, OperatorType.In, deletes)); var pageService = new Page.PageService(); pageService.Delete(new Data.DataFilter().Where("LayoutId", OperatorType.In, deletes)); var widgetService = new Widget.WidgetService(); var widgets = widgetService.Get(new Data.DataFilter().Where("LayoutId", OperatorType.In, deletes)); widgets.Each(m => { m.CreateServiceInstance().DeleteWidget(m.ID); }); } Signal.Trigger(LayoutChanged); return(base.Delete(filter)); }
public override int Delete(params object[] primaryKeys) { PageEntity page = Get(primaryKeys); this.Delete(new DataFilter().Where("ParentId", OperatorType.Equal, page.ID)); var widgetService = new Widget.WidgetService(); var widgets = widgetService.Get(new DataFilter().Where("PageID", OperatorType.Equal, page.ID)); widgets.Each(m => m.CreateServiceInstance().DeleteWidget(m.ID)); return(base.Delete(primaryKeys)); }
public override int Delete(DataFilter filter) { var deletes = this.Get(filter).ToList(m => m.ID); if (deletes.Any() && this.Get(new DataFilter().Where("ParentId", OperatorType.In, deletes)).Any()) { this.Delete(new DataFilter().Where("ParentId", OperatorType.In, deletes)); } if (deletes.Any()) { var widgetService = new Widget.WidgetService(); var widgets = widgetService.Get(new DataFilter().Where("PageID", OperatorType.In, deletes)); widgets.Each(m => m.CreateServiceInstance().DeleteWidget(m.ID)); } return(base.Delete(filter)); }