示例#1
0
        public static int Register(List <Models.WidgetManifest> manifests)
        {
            var count = 0;

            foreach (var manifest in manifests)
            {
                if (!Portal.Exists(manifest))
                {
                    Logging.Logger.InfoFormat("Registering manifest: {0}", manifest.FullName);
                    Portal.Save(manifest, Account.AuditId);
                    count++;
                }
                else
                {
                    //todo: REALLY need to reconsider how to structure this logic...
                    var m = Portal.GetWidgetManifest(manifest.FullName);
                    manifest.Id = m.Id;
                    if (manifest.ToJson() != m.ToJson())
                    {
                        Logging.Logger.InfoFormat("Registering manifest: {0}", manifest.FullName);
                        Portal.Save(manifest, Account.AuditId);
                        count++;
                    }
                }
            }
            //Repository.Current.SaveChanges();
            return(count);
        }
示例#2
0
        public static int Register(Models.Portal portal)
        {
            var count = 0;

            if (!Portal.Exists(portal))
            {
                Logging.Logger.InfoFormat("Registering portal: {0}", portal.Name);
                Portal.Save(portal, Account.AuditId);
                count++;
            }
            return(count);
        }
示例#3
0
        public static int Register(List <Models.LayoutTemplate> templates)
        {
            var count = 0;

            foreach (var template in templates)
            {
                template.PortalId = string.IsNullOrEmpty(template.PortalId) ? Services.Portal.CurrentPortalId : template.PortalId;
                if (!Portal.Exists(template))
                {
                    Logging.Logger.InfoFormat("Registering layout template: {0}", template.LayoutName);
                    Portal.Save(template, Account.AuditId);
                    count++;
                }
            }
            return(count);
        }