Exemplo n.º 1
0
 public bool Import(Guid solutionId, IList <EntityPlugin> entityPlugins)
 {
     if (entityPlugins.NotEmpty())
     {
         foreach (var item in entityPlugins)
         {
             var entity = _entityPluginFinder.FindById(item.EntityPluginId);
             if (entity != null)
             {
                 entity.AssemblyName = item.AssemblyName;
                 entity.ClassName    = item.ClassName;
                 entity.EventName    = item.EventName;
                 entity.ProcessOrder = item.ProcessOrder;
                 entity.TypeCode     = item.TypeCode;
                 _entityPluginUpdater.Update(entity);
             }
             else
             {
                 item.SolutionId     = solutionId;
                 item.ComponentState = 0;
                 item.CreatedBy      = _appContext.GetFeature <ICurrentUser>().SystemUserId;
                 item.CreatedOn      = DateTime.Now;
                 _entityPluginCreater.Create(item);
             }
         }
     }
     return(true);
 }
Exemplo n.º 2
0
        public IActionResult EditEntityPlugin(Guid id)
        {
            var entity = _entityPluginFinder.FindById(id);
            FilterContainer <EntityPlugin> filter = FilterContainerBuilder.Build <EntityPlugin>();

            filter.And(n => n.IsVisibled == true);
            filter.And(n => n.AssemblyName == entity.AssemblyName);
            EditPluginListModel model = new EditPluginListModel();
            var entityPlugins         = _entityPluginFinder.Query(x => x.Where(filter));
            Dictionary <Guid, List <QueryView.Domain.QueryView> > queryViews  = new Dictionary <Guid, List <QueryView.Domain.QueryView> >();
            Dictionary <Guid, List <Form.Domain.SystemForm> >     systemForms = new Dictionary <Guid, List <Form.Domain.SystemForm> >();

            if (entityPlugins.NotEmpty())
            {
                entityPlugins.Where(x => x.TypeCode != (int)PlugInType.Entity && x.TypeCode != (int)PlugInType.WorkFlow).ToList().ForEach(x =>
                {
                    if (x.TypeCode == (int)PlugInType.List)
                    {
                        var queryView = _queryViewFinder.FindById(x.EntityId);
                        if (queryView != null && !queryViews.Keys.Contains(queryView.EntityId))
                        {
                            queryViews.Add(queryView.EntityId, _queryViewFinder.FindByEntityId(queryView.EntityId));
                        }
                    }
                    else if (x.TypeCode == (int)PlugInType.Form)
                    {
                        var systemForm = _systemFormFinder.FindById(x.EntityId);
                        if (systemForm != null && !systemForms.Keys.Contains(systemForm.EntityId))
                        {
                            systemForms.Add(systemForm.EntityId, _systemFormFinder.FindByEntityId(systemForm.EntityId));
                        }
                    }
                });
            }
            model.EntityPlugins  = _entityPluginFinder.Query(x => x.Where(filter));
            model.PluginAnalysis = _entityPluginCreater.BeforehandLoad(entity.AssemblyName);
            model.QueryViews     = queryViews;
            model.SystemForms    = systemForms;
            model.SolutionId     = SolutionId.Value;
            return(View(model));
        }