示例#1
0
        public static string Import(Models.SearchProvider provider, string userId = null)
        {
            userId = string.IsNullOrEmpty(userId) ? Account.AuditId : userId;
            var existing = GetSearchProvider(provider.Name);

            provider.Id = existing != null ? existing.Id : null;
            return(Save(provider, userId));
        }
示例#2
0
        public static bool IsDuplicate(Models.SearchProvider provider)
        {
            var m = GetSearchProviderById(provider.Name);

            if (m != null)
            {
                return(m.Id != provider.Id);
            }
            return(false);
        }
示例#3
0
        public static int Register(Models.SearchProvider provider)
        {
            var count = 0;

            if (!Search.Exists(provider))
            {
                Logging.Logger.InfoFormat("Registering search provider: {0}", provider.Name);
                Search.Save(provider, Account.AuditId);
                count++;
            }
            return(count);
        }
示例#4
0
 public static string Save(Models.SearchProvider provider, string userId = null)
 {
     userId = string.IsNullOrEmpty(userId) ? Account.AuditId : userId;
     if (!IsDuplicate(provider))
     {
         var res = Repository.Current.StoreResource("SearchProvider", null, provider, userId);
         return(res.Id);
     }
     else
     {
         throw new Exception(string.Format(Localization.GetLocalization(LocalizationType.Exception, "DuplicateResource.Error", "{0} already exists.   Duplicates Not Allowed.", "Core"), "Widget Manifest"));
     }
 }
示例#5
0
        public static bool Exists(Models.SearchProvider provider)
        {
            var m = GetSearchProvider(provider.Name);

            return(m != null);
        }