示例#1
0
        public void UpdateDesign(LayoutEntity item)
        {
            this.Update(item, new Data.DataFilter(new List <string> {
                "ContainerClass"
            }).Where("ID", OperatorType.Equal, item.ID));
            if (item.Zones != null)
            {
                var zones = ZoneService.Get(m => m.LayoutId == item.ID);

                item.Zones.Where(m => zones.All(n => n.ID != m.ID)).Each(m =>
                {
                    m.LayoutId = item.ID;
                    ZoneService.Add(m);
                });
                item.Zones.Where(m => zones.Any(n => n.ID == m.ID)).Each(m =>
                {
                    m.LayoutId = item.ID;
                    ZoneService.Update(m);
                });
                zones.Where(m => item.Zones.All(n => n.ID != m.ID)).Each(m => ZoneService.Delete(m.ID));
            }
            if (item.Html != null)
            {
                var layoutHtmlService = new LayoutHtmlService();
                layoutHtmlService.Delete(m => m.LayoutId == item.ID);
                item.Html.Each(m =>
                {
                    m.LayoutId = item.ID;
                    layoutHtmlService.Add(m);
                });
            }
        }
示例#2
0
        public override int Delete(params object[] primaryKeys)
        {
            LayoutEntity layout            = Get(primaryKeys);
            var          layoutHtmlService = new LayoutHtmlService();

            layoutHtmlService.Delete(new Data.DataFilter().Where <LayoutHtml>(m => m.LayoutId, OperatorType.Equal, layout.ID));

            var zoneService = new ZoneService();

            zoneService.Delete(new Data.DataFilter().Where <ZoneEntity>(m => m.LayoutId, OperatorType.Equal, layout.ID));


            var pageService = new Page.PageService();

            pageService.Delete(new DataFilter().Where("LayoutId", OperatorType.Equal, layout.ID));

            var widgetService = new WidgetService();
            var widgets       = widgetService.Get(new DataFilter().Where("LayoutId", OperatorType.Equal, layout.ID));

            widgets.Each(m =>
            {
                m.CreateServiceInstance().DeleteWidget(m.ID);
            });
            Signal.Trigger(LayoutChanged);
            return(base.Delete(primaryKeys));
        }
示例#3
0
        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));
        }
示例#4
0
        public override int Delete(params object[] primaryKeys)
        {
            LayoutEntity layout = Get(primaryKeys);

            if (layout != null)
            {
                var layoutHtmlService = new LayoutHtmlService();
                layoutHtmlService.Delete(m => m.LayoutId == layout.ID);

                ZoneService.Delete(new DataFilter().Where("LayoutId", OperatorType.Equal, layout.ID));


                PageService.Delete(new DataFilter().Where("LayoutId", OperatorType.Equal, layout.ID));

                var widgets = WidgetService.Get(new DataFilter().Where("LayoutId", OperatorType.Equal, layout.ID));
                widgets.Each(m =>
                {
                    m.CreateServiceInstance().DeleteWidget(m.ID);
                });
                MarkChanged(layout.ID);
            }
            return(base.Delete(primaryKeys));
        }
示例#5
0
        public override int Delete(DataFilter filter)
        {
            var deletes = Get(filter).ToList(m => m.ID);

            if (deletes.Any())
            {
                var layoutHtmlService = new LayoutHtmlService();
                layoutHtmlService.Delete(new DataFilter().Where("LayoutId", OperatorType.In, deletes));

                ZoneService.Delete(new DataFilter().Where("LayoutId", OperatorType.In, deletes));


                PageService.Delete(new DataFilter().Where("LayoutId", OperatorType.In, deletes));

                var widgets = WidgetService.Get(new DataFilter().Where("LayoutId", OperatorType.In, deletes));
                widgets.Each(m =>
                {
                    m.CreateServiceInstance().DeleteWidget(m.ID);
                });
                deletes.Each(MarkChanged);
            }

            return(base.Delete(filter));
        }