Exemplo n.º 1
0
        public IActionResult EditRibbonButton(Guid id)
        {
            EditRibbonButtonModel model = new EditRibbonButtonModel();

            if (!id.Equals(Guid.Empty))
            {
                var entity = _ribbonButtonFinder.FindById(id);
                if (entity != null)
                {
                    entity.CopyTo(model);
                    model.WebResourceName = entity.JsLibrary;
                    if (entity.JsLibrary.IsNotEmpty() && entity.JsLibrary.StartsWith("$webresource:"))
                    {
                        var wr = _webResourceFinder.FindById(Guid.Parse(entity.JsLibrary.Replace("$webresource:", "")));
                        if (wr != null)
                        {
                            model.WebResourceName = wr.Name;
                        }
                        else
                        {
                            model.JsLibrary = string.Empty;
                            model.JsAction  = string.Empty;
                        }
                    }
                    return(View(model));
                }
            }
            return(NotFound());
        }
Exemplo n.º 2
0
 public bool Import(Guid solutionId, List <RibbonButtonXmlInfo> ribbonButtons)
 {
     if (ribbonButtons.NotEmpty())
     {
         foreach (var item in ribbonButtons)
         {
             var entity = _ribbonButtonFinder.FindById(item.RibbonButtonId);
             if (entity != null)
             {
                 entity.CssClass     = item.CssClass;
                 entity.DisplayOrder = item.DisplayOrder;
                 entity.Icon         = item.Icon;
                 entity.JsAction     = item.JsAction;
                 entity.JsLibrary    = item.JsLibrary;
                 entity.Label        = item.Label;
                 entity.ShowArea     = item.ShowArea;
                 entity.StateCode    = item.StateCode;
                 _ribbonButtonUpdater.Update(entity);
             }
             else
             {
                 item.SolutionId     = solutionId;
                 item.ComponentState = 0;
                 item.CreatedBy      = _appContext.GetFeature <ICurrentUser>().SystemUserId;
                 item.CreatedOn      = DateTime.Now;
                 _ribbonButtonCreater.Create(item);
             }
         }
     }
     return(true);
 }
Exemplo n.º 3
0
        public IActionResult Post(EditRibbonButtonModel model)
        {
            if (ModelState.IsValid)
            {
                var entity = _ribbonButtonFinder.FindById(model.RibbonButtonId.Value);
                model.CopyTo(entity);

                _ribbonButtonUpdater.Update(entity);

                return(UpdateSuccess(new { id = entity.RibbonButtonId }));
            }
            return(UpdateFailure(GetModelErrors()));
        }