Esempio n. 1
0
        public void DownloadZipCodes()
        {
            var ds = new Traffk.Bal.Data.Rdb.TraffkGlobal.DataSource
            {
                TenantId           = 3,
                DataSourceSettings = new Traffk.Bal.Settings.DataSourceSettings
                {
                    Web = new Traffk.Bal.Settings.DataSourceSettings.WebSettings
                    {
                        CredentialsKeyUri = Traffk.Bal.Services.Vault.CommonSecretUris.ZipCodesComCredentialsUri,
                        LoginPageConfig   = new Traffk.Bal.Settings.DataSourceSettings.WebSettings.WebLoginPageConfig
                        {
                            LoginPage         = new Uri("https://www.zip-codes.com/account_login.asp"),
                            UsernameFieldName = "loginUsername",
                            PasswordFieldName = "loginPassword"
                        },
                        DownloadUrls = new[]
                        {
                            new Uri("https://www.zip-codes.com/account_database.asp?type=csv&product=25"), //CSV Delux DB
                            new Uri("https://www.zip-codes.com/account_database.asp?type=csv&product=38"), //CSV Delux DB with Business
                            new Uri("https://www.zip-codes.com/account_database.asp?type=cs&product=89"),  //CSV Zip9
                        }
                    }
                }
            };

            GDB.DataSources.Add(ds);
            GDB.SaveChanges();
            Backgrounder.Enqueue <IDataSourceSyncJobs>(z => z.DataSourceFetchAsync(ds.DataSourceId));
            //            RJM.Add(Hangfire.Common.Job.FromExpression<IDataSourceSyncJobs>(z => z.DataSourceFetchAsync(ds.DataSourceId)), Cron.Daily());
        }
Esempio n. 2
0
        public void CreateTenant(string tenantName)
        {
            if (tenantName == null)
            {
                return(BadRequest());
            }
            var d = new TenantCreationDetails
            {
                AdminPassword = "******",
                AdminUsername = "******",
                TenantName    = tenantName
            };

            Backgrounder.Enqueue <ITenantManagementJobs>(z => z.CreateTenant(d));
        }
Esempio n. 3
0
        public static IEnumerable <int> GetDistinctBackgrounderIdsForWorker(IMongoCollection <BsonDocument> collection, string workerId)
        {
            ISet <int> distinctBackgrounderIdsForWorker = new HashSet <int>();

            IEnumerable <string> distinctFileNames = collection.Distinct <string>("file", FilterByWorkerId(workerId)).ToEnumerable();

            foreach (string distinctFileName in distinctFileNames)
            {
                int?backgrounderId = Backgrounder.GetBackgrounderIdFromFilename(distinctFileName);
                if (backgrounderId.HasValue)
                {
                    distinctBackgrounderIdsForWorker.Add(backgrounderId.Value);
                }
            }

            return(distinctBackgrounderIdsForWorker);
        }
Esempio n. 4
0
 public void EtlZip()
 {
     Backgrounder.Enqueue <IEtlJobs>(z => z.ExecuteAsync(EtlPackages.ZipCodes, 256));
 }