protected async Task <FilterGroup> GetTags(IJsonStorage <Tag> tagDb, int belongsToId, string tagGroupName = "Tags")
        {
            var tags = new FilterGroup
            {
                Name      = tagGroupName,
                BelongsTo = belongsToId,
                IsCustome = true,
                Type      = FilterDisplayTypes.Tag
            };

            bool any = false;

            foreach (var tag in await tagDb.Get(Tag.PartitionKey))
            {
                any = true;

                var fi = new FilterItem(tag.Name, tag.Key, FilterType.Bool, tagGroupName);
                fi.DisplayName  = "Tag: " + tag.Name;
                fi.FilterString = GetListFilterString("tags", tag.Key);

                tags.Items.Add(fi);
            }

            if (!any)
            {
                return(null);
            }

            foreach (var item in tags.Items)
            {
                _flatReferenceDic.Add(item.UniqueValue, item);
            }

            return(tags);
        }
Esempio n. 2
0
 public TriggerAllSurveillanceItems(IJsonStorage <TModel> backupDb, IAzureSearch <TModel> index, ITableStorageDb <SurveilledItem> suvItemDb, IEnumerable <ISurveillanceAction> allRegisteredSurvAction, IQueue queueToPutSingleSurveillances)
 {
     _backupDb  = backupDb;
     _index     = index;
     _suvItemDb = suvItemDb;
     _allRegisteredSurvAction       = allRegisteredSurvAction;
     _queueToPutSingleSurveillances = queueToPutSingleSurveillances;
 }
Esempio n. 3
0
        public GitUserVerification(IJsonStorage storage, GitHubClient github)
        {
            _storage      = storage;
            _verification = _storage.Get <GitVerification>("verification.json");
            _github       = github;

            if (!(_verification is null))
            {
                return;
            }

            _verification = new GitVerification
            {
                VerifiedUsers       = new Dictionary <ulong, string>(),
                VerificationStrings = new Dictionary <string, string>()
            };

            _storage.Store(_verification, "verification.json", Formatting.Indented);
        }
Esempio n. 4
0
        public IStorage GetDatabase(Models.Auction auction)
        {
            switch (auction.Type)
            {
            case TypeAuction.Json:
                if (_jsonstorage.FilePath != auction.Location)
                {
                    _jsonstorage = _jsonstorage.FabricStorage();
                    _jsonstorage.SetPathToFile(auction.Location);
                }

                _storage = (IStorage)_jsonstorage;
                break;

            case TypeAuction.Sql:
                var filePath = Path.Combine(auction.Location, string.Format("{0}.{1}", auction.Name, "mdf"));
                _storage = _sqlstorage.SetConnectionString(filePath);
                break;
            }

            return(_storage);
        }
Esempio n. 5
0
 public GrunndataBusinessFilter(IJsonStorage <Tag> tagDb)
 {
     _tagDb = tagDb;
 }
Esempio n. 6
0
 public JsonLanguage(IJsonStorage jsonStorage)
 {
     this.jsonStorage = jsonStorage;
     RestorePools();
 }
        public static async Task <bool> Complete(string registerName, Stopwatch stopwatch, int numberOfUploads, IJsonStorage <BuildIndexComplete> db, string environment)
        {
            var entity = new BuildIndexComplete
            {
                Register         = registerName,
                ElapsedMinutes   = stopwatch.Elapsed.TotalMinutes,
                NumberOfEntities = numberOfUploads,
                Salt             = Guid.NewGuid().ToString(),
                When             = DateTime.UtcNow,
                Environment      = environment
            };

            await db.Post(entity);

            return(true);
        }
 public static async Task <IEnumerable <LatestSurveillanceResult> > GetLatestSurveillanceResult(Team team, IJsonStorage <LatestSurveillanceResult> db)
 {
     return(await db.Get(GetPartitionKey(team)));
 }
 public static async Task <LatestSurveillanceResult> GetLatestSurveillanceResult(string actionKey, string actionInstanceIdentifier, Team team, IJsonStorage <LatestSurveillanceResult> db)
 {
     return(await db.Get(GetPartitionKey(team), GetRowKey(actionKey, actionInstanceIdentifier), false));
 }
Esempio n. 10
0
 protected SurveillanceController(IDependencyInjector di, IAzureSearch <TPersonIndexEntity> personIndex, IJsonStorage <BuildIndexComplete> buildIndexStorage) : base(di)
 {
     _personIndex       = personIndex;
     _buildIndexStorage = buildIndexStorage;
 }
 public FilterController(IDependencyInjector di) : base(di)
 {
     _personFilterManager   = di.GetInstance <IPersonFilterManager>();
     _businessFilterManager = di.GetInstance <IBusinessFilterManager>();
     _queryDb = di.GetInstance <IJsonStorage <SearchQuery> >();
 }
Esempio n. 12
0
        private static async Task <Surveillance> GetSurveillance(Hit hit, ISurveillanceAction isurveillance, Team teamForLoggedInUser, ITableStorageDb <SurveilledItem> surveiItemDb, IJsonStorage <LatestSurveillanceResult> surveilResultDb)
        {
            var s = new Surveillance
            {
                ActionFriendlyName = isurveillance.GetFriendlyName(),
                ActionKey          = isurveillance.GetKey(),
                UrlToToggle        = GetRoute(hit.CommonIdentifier, isurveillance.GetKey(), hit.GetActionInstanceIdentifier(), hit.RegisterEnvironmentInt)
            };

            s.TeamsThatSurveillThisInstance = (await SurveilledItem.GetAllForActionIdentifier(isurveillance.GetKey(), hit.GetActionInstanceIdentifier(), surveiItemDb)).ToList();

            if (s.TeamsThatSurveillThisInstance.Any(team => team.TeamProjectInt == teamForLoggedInUser.Id))
            {
                s.OriginalContentAsJson             = s.TeamsThatSurveillThisInstance.First(team => team.TeamProjectInt == teamForLoggedInUser.Id).ContentAsJson;
                s.LatestSurveillanceResultForMyTeam = await LatestSurveillanceResult.GetLatestSurveillanceResult(s.ActionKey, hit.GetActionInstanceIdentifier(), teamForLoggedInUser, surveilResultDb);

                s.IsChecked = true;
            }
            else
            {
                s.IsChecked = false;
            }

            return(s);
        }
Esempio n. 13
0
        public static async Task <IEnumerable <Surveillance> > GetPossibleSurveillances(Team teamForLoggedInUser, Hit hit, IDependencyInjector di, IJsonStorage <LatestSurveillanceResult> surveilResultDb)
        {
            var surveilDb = di.GetInstance <ITableStorageDb <SurveilledItem> >();

            var result = new List <Surveillance>();
            var surveillanceActions = di.GetAllInstancesOf <ISurveillanceAction>();

            foreach (var isurveillance in surveillanceActions.Where(s => s.ApplicableForHit(hit)))
            {
                var s = await GetSurveillance(hit, isurveillance, teamForLoggedInUser, surveilDb, surveilResultDb);

                result.Add(s);
            }

            return(result);
        }
Esempio n. 14
0
 public DatabaseConfig(IJsonStorage json, ISqlStorage sql)
 {
     _jsonstorage = json;
     _sqlstorage  = sql;
 }
Esempio n. 15
0
 public TestStepResultBlobStore(IJsonStorage <TestStepResultBlob> testStepResultBlobstore)
 {
     _testStepResultStore = testStepResultBlobstore;
 }
 public GrunndataPersonFilter(IJsonStorage <Tag> tagDb)
 {
     _tagDb = tagDb;
 }