private void TriggerChange(WidgetBase widget)
 {
     if (IsNeedNotifyChange)
     {
         if (widget != null && widget.PageID.IsNotNullAndWhiteSpace())
         {
             using (var pageService = _serviceProvider.GetService <IPageService>())
             {
                 pageService.MarkChanged(widget.PageID);
             }
         }
         else if (widget != null && widget.LayoutID.IsNotNullAndWhiteSpace())
         {
             using (var layoutService = _serviceProvider.GetService <ILayoutService>())
             {
                 layoutService.MarkChanged(widget.LayoutID);
                 ClearCache();
             }
         }
     }
 }
Exemple #2
0
 private void TriggerChange(WidgetBase widget)
 {
     if (IsNeedNotifyChange)
     {
         if (widget != null && widget.PageID.IsNotNullAndWhiteSpace())
         {
             using (var pageService = _serviceProvider.GetService <IPageService>())
             {
                 pageService.MarkChanged(widget.PageID);
             }
         }
         else if (widget != null && widget.LayoutID.IsNotNullAndWhiteSpace())
         {
             using (var layoutService = _serviceProvider.GetService <ILayoutService>())
             {
                 layoutService.MarkChanged(widget.LayoutID);
             }
             _pageWidgetCacheManage.ClearRegion(_httpContextAccessor.HttpContext.Request.Host.Value);
         }
     }
 }
Exemple #3
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            ViewResult result = filterContext.Result as ViewResult;

            if (result != null)
            {
                if (result.Model is WidgetBase)
                {
                    WidgetBase widget      = result.Model as WidgetBase;
                    var        zoneService = filterContext.HttpContext.RequestServices.GetService <IZoneService>();
                    if (!widget.PageID.IsNullOrEmpty())
                    {
                        (filterContext.Controller as Controller).ViewData[ViewDataKeys.Zones] = new SelectList(zoneService.GetZonesByPageId(widget.PageID), "ID", "ZoneName");
                    }
                    else if (!widget.LayoutID.IsNullOrEmpty())
                    {
                        (filterContext.Controller as Controller).ViewData[ViewDataKeys.Zones] = new SelectList(zoneService.GetZonesByLayoutId(widget.LayoutID), "ID", "ZoneName");
                    }
                }
            }
        }
Exemple #4
0
 public virtual void Publish(WidgetBase widget)
 {
     widget.IsTemplate = false;
     widget.IsSystem   = false;
     Add((T)widget);
 }
Exemple #5
0
 public virtual void UpdateWidget(WidgetBase widget)
 {
     Update((T)widget);
 }
Exemple #6
0
 public virtual void AddWidget(WidgetBase widget)
 {
     Add((T)widget);
 }
Exemple #7
0
 public virtual WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext)
 {
     return(widget.ToWidgetViewModelPart());
 }
Exemple #8
0
 public override WidgetBase GetWidget(WidgetBase widget)
 {
     return(widget.CopyTo(JsonConvert.DeserializeObject <T>(widget.ExtendData ?? "{}")) as T);
 }
Exemple #9
0
 public virtual void Publish(WidgetBase widget)
 {
     AddWidget(widget);
 }