public void Init()
	    {
	        const string appName = "RemoteServiceTest";

	        var remote = new RemoteRepository
	        {
	            DiscoveryUri = new Uri("http://10.0.2.2:9000/"),
	            LocalCache = new SqliteObjectCache {ApplicationName = appName},
	            ClientId = Environment.GetEnvironmentVariable("SentinelClientId"),
	            UserAccount = new UserAccount
	            {
	                Username = Environment.GetEnvironmentVariable("SentinelUsername"),
	                Password = Environment.GetEnvironmentVariable("SentinelPassword"),
	            }
	        };

	        var local = new LocalRepository
	        {
	            ApplicationName = appName
	        };

	        Service = new StorageService
	        {
				LocalRepository = local,
	            RemoteRepository = remote
	        };

            Service.Delete<Company>().Wait();
            Service.Delete<Vat>().Wait();
        }
        /// <summary>
        /// Uploads a local file to Google Cloud storage, overwriting any existing object and clobber existing metadata
        /// values.
        /// </summary>
        protected Object UploadGcsObject(
            StorageService service, string bucket, string objectName,
            Stream contentStream, string contentType,
            PredefinedAclEnum? predefinedAcl, Dictionary<string, string> metadata)
        {
            // Work around an API wart. It is possible to specify content type via the API and also by
            // metadata.
            if (metadata != null && metadata.ContainsKey("Content-Type"))
            {
                metadata["Content-Type"] = contentType;
            }

            Object newGcsObject = new Object
            {
                Bucket = bucket,
                Name = objectName,
                ContentType = contentType,
                Metadata = metadata
            };

            ObjectsResource.InsertMediaUpload insertReq = service.Objects.Insert(
                newGcsObject, bucket, contentStream, contentType);
            insertReq.PredefinedAcl = predefinedAcl;
            insertReq.Projection = ProjectionEnum.Full;

            var finalProgress = insertReq.Upload();
            if (finalProgress.Exception != null)
            {
                throw finalProgress.Exception;
            }

            return insertReq.ResponseBody;
        }
        public static List<string> CreateLogs(CloudBlobContainer container, StorageService service, int count, DateTime start, string granularity)
        {
            string name;
            List<string> blobs = new List<string>();

            for (int i = 0; i < count; i++)
            {
                CloudBlockBlob blockBlob;

                switch (granularity)
                {
                    case "hour":
                        name = string.Concat(service.ToString().ToLowerInvariant(), "/", start.AddHours(i).ToString("yyyy/MM/dd/HH", CultureInfo.InvariantCulture), "00/000001.log"); 
                        break;

                    case "day":
                        name = string.Concat(service.ToString().ToLowerInvariant(), "/", start.AddDays(i).ToString("yyyy/MM/dd/HH", CultureInfo.InvariantCulture), "00/000001.log"); 
                        break;

                    case "month":
                        name = string.Concat(service.ToString().ToLowerInvariant(), "/", start.AddMonths(i).ToString("yyyy/MM/dd/HH", CultureInfo.InvariantCulture), "00/000001.log"); 
                        break;

                    default:
                        throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "CreateLogs granularity of '{0}' is invalid.", granularity));
                }

                blockBlob = container.GetBlockBlobReference(name);
                blockBlob.PutBlockList(new string[] { });
                blobs.Add(name);
            }

            return blobs;
        }
        public override void Load()
        {
            Bind<IApplicationService>().ToConstant(_applicationService = Kernel.Get<ApplicationService>());
            Bind<IStorageService>().ToConstant(_storageService = Kernel.Get<StorageService>());
            Bind<ISettingsService>().ToConstant(_settingsService = Kernel.Get<SettingsService>());
            Bind<ISiteService>().ToConstant(_siteService = Kernel.Get<SiteService>());

            Bind<CuoUri>().ToSelf();
            Bind<ShellForm>().ToSelf().InSingletonScope();
            Bind<ShellController>().ToSelf().InSingletonScope();

            _shellForm = Kernel.Get<ShellForm>();
            _shellController = Kernel.Get<ShellController>();

            Bind<IShell>().ToConstant(_shellForm);
            Bind<IShellController>().ToConstant(_shellController);

            Bind<PatcherForm>().ToSelf();
            Bind<SplashScreen>().ToSelf();
            Bind<AboutControl>().ToSelf();
            Bind<SettingsControl>().ToSelf();
            Bind<NavigationControl>().ToSelf();
            Bind<EditLocalServerControl>().ToSelf();
            Bind<LocalServerListControl>().ToSelf();
            Bind<PublicServerListControl>().ToSelf();
            Bind<FavoritesServerListControl>().ToSelf();
        }
        public async Task<Dictionary<DateTime, Workout>> GetPreviousWorkouts()
        {
            var storage = new StorageService();
            var dict = await storage.RetrieveObjectAsync<Dictionary<DateTime, Workout>>("workouts");

            return dict;

        }
 // [END build_service]
 // [START list_storage_bucket_contents]
 /// <summary>
 /// List the contents of a Cloud Storage bucket.
 /// </summary>
 /// <param name="bucket">the name of the Cloud Storage bucket.</param>
 ///<returns>a list of the contents of the specified bucket.</returns>
 public Objects ListBucketContents(
     StorageService storage, string bucket)
 {
     var request = new
         Google.Apis.Storage.v1.ObjectsResource.ListRequest(storage,
         bucket);
     var requestResult = request.Execute();
     return requestResult;
 }
 private async Task<StorageService> CreateServiceAsync()
 {
     GoogleCredential credential = await GoogleCredential.GetApplicationDefaultAsync();
     var serviceInitializer = new BaseClientService.Initializer()
     {
         ApplicationName = "Storage Sample",
         HttpClientInitializer = credential
     };
     service = new StorageService(serviceInitializer);
     return service;
 }
        /// <summary>
        /// Patch the GCS object with new metadata.
        /// </summary>
        protected Object UpdateObjectMetadata(
            StorageService service, Object storageObject, Dictionary<string, string> metadata)
        {
            storageObject.Metadata = metadata;

            ObjectsResource.PatchRequest patchReq = service.Objects.Patch(storageObject, storageObject.Bucket,
                storageObject.Name);
            patchReq.Projection = ObjectsResource.PatchRequest.ProjectionEnum.Full;

            return patchReq.Execute();
        }
        public async Task FinishWorkout()
        {
            var storage = new StorageService();
            var dict = await storage.RetrieveObjectAsync<Dictionary<DateTime, string>>("workouts");

            if (dict == null)
                dict = new Dictionary<DateTime, string>() { { DateTime.Today, _workout.Type } };
            else
                dict.Add(DateTime.Today, _workout.Type);

            await storage.PersistObjectAsync("workouts", dict);
        }
Beispiel #10
0
        public async Task DownloadOrReadImage()
        {
            //arrange
            var ss = new StorageService();
            var service = new HttpService();

            //act
            var imageBytes = await ss.GetAssetFileAsync("Assets/Tests/" + TestFile);
            var imageResponse = await service.DownloadAsync(new Uri("http://www.spiegel.de/images/image-1028227-hppano-lqbn.jpg"));
            var imageBytes2 = await imageResponse.GetResponseAsByteArrayAsync();

            //assert
            //expected
            Assert.IsTrue(imageBytes2.Length == imageBytes.Length);
        }
 /// <summary>
 /// Returns whether or not a storage object with the given name exists in the provided
 /// bucket. Will return false if the object exists but is not visible to the current
 /// user.
 /// </summary>
 protected bool TestObjectExists(StorageService service, string bucket, string objectName)
 {
     try
     {
         ObjectsResource.GetRequest getReq = service.Objects.Get(bucket, objectName);
         getReq.Execute();
         return true;
     }
     catch (GoogleApiException ex) when (ex.HttpStatusCode == HttpStatusCode.NotFound)
     {
         // Just swallow it. Ideally we wouldn't need to use an exception for
         // control flow, but alas the API doesn't seem to have a test method.
     }
     return false;
 }
 public ServicesPage()
 {
     App42API.Initialize(Constants.apiKey,Constants.secretKey );
     App42Log.SetDebug(true);
     InitializeComponent();
     userService = App42API.BuildUserService();
     storageService = App42API.BuildStorageService();
     gameService = App42API.BuildGameService();
     scoreBoardService = App42API.BuildScoreBoardService();
     uploadService = App42API.BuildUploadService();
     photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
     photoChooserTask2 = new PhotoChooserTask();
     photoChooserTask2.Completed += new EventHandler<PhotoResult>(photoChooserTask2_Completed);
 }
 public App42StorageService()
 {
     storageService = App42API.BuildStorageService();
     
     if (Constant.sessionId != null && Constant.sessionId != "")
     {
         storageService.SetSessionId(Constant.sessionId);
     }
     if (Constant.adminKey != null && Constant.adminKey != "")
     {
         storageService.SetAdminKey(Constant.adminKey);
     }
     this.InitializeComponent();
     this.navigationHelper = new NavigationHelper(this);
     this.navigationHelper.LoadState += navigationHelper_LoadState;
 }
        public void EnqueuedContentIsEqualToPeekedContent()
        {
            // Setup
            var storage = new StorageService();
            storage.Init("unittest" + Guid.NewGuid().ToString());
            Transmission transmissionToEnqueue = CreateTransmission(new TraceTelemetry("mock_item"));

            // Act
            storage.EnqueueAsync(transmissionToEnqueue).ConfigureAwait(false).GetAwaiter().GetResult();
            StorageTransmission peekedTransmission = storage.Peek();

            // Asserts
            string enqueuedContent = Encoding.UTF8.GetString(transmissionToEnqueue.Content, 0, transmissionToEnqueue.Content.Length);
            string peekedContent = Encoding.UTF8.GetString(peekedTransmission.Content, 0, peekedTransmission.Content.Length);
            Assert.AreEqual(peekedContent, enqueuedContent);
        }
        public void PeekedItemIsNOnlyotReturnedOnce()
        {
            // Setup - create a storage with one item
            var storage = new StorageService();
            storage.Init("unittest" + Guid.NewGuid().ToString());

            Transmission transmissionToEnqueue = CreateTransmissionAndEnqueueIt(storage);

            // Act
            StorageTransmission firstPeekedTransmission = storage.Peek();
            StorageTransmission secondPeekedTransmission = storage.Peek();

            // Asserts            
            Assert.IsNotNull(firstPeekedTransmission);
            Assert.IsNull(secondPeekedTransmission);
        }
Beispiel #16
0
 public static void DeleteMessage(String messageID, App42ApiResultCallback requestCallback)
 {
     try
     {
         App42ApiCallback _sCallback = new App42ApiCallback(requestCallback);
         if (mStorageService == null)
         {
             mStorageService = GlobalContext.SERVICE_API.BuildStorageService();
         }
         mStorageService.DeleteDocumentById(GlobalContext.databaseName, GlobalContext.collectionName, messageID, _sCallback);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
        static InfoService()
        {
            SearchChannel = new SearchChannel();
            SearchChannel.CleanupKey += SearchChannelCleanupKey;
            ChannelEndPoint = new StorageService<string>();
            SearchChannelEndPointA = new AutoCleaningStorageService<string> { Lifetime =  20};
            SearchChannelEndPointB = new AutoCleaningStorageService<string> { Lifetime = 20 };

            //SearchChannelEndPoint = new StorageService<string>();

            ChannelCid = new StorageService<UInt32>();
            IOID = new AutoCleaningStorageService<UInt32> { Lifetime = 10};
            IOID.CleanupKey += IoidCleanupKey;
            ChannelSubscription = new StorageService<UInt32>();
            EchoSent = new AutoCleaningStorageService<IPEndPoint>();
            SubscribedChannel = new StorageService<string>();
        }
        public void XmlParsedAndSaved()
        {
            var repository = new Mock<ISaveGraphRepository>();
            var service = new StorageService(repository.Object);

            var node1 = new {Id = 123, Label = "qweqwe"};
            var node2 = new {Id = 456, Label = "asdasd"};

            var root = new XElement("nodes",
                new XElement("node", new XElement("id", node1.Id), new XElement("label", node1.Label)),
                new XElement("node", new XElement("id", node2.Id), new XElement("label", node2.Label))
            );

            service.SaveGraph(root);

            repository.Verify(x => x.Save(It.IsAny<NodeEntity>()), Times.Exactly(2), "Nodes should get saved to the database");
            repository.Verify(x => x.Save(It.Is<NodeEntity>(xx => xx.Id == node1.Id && xx.Label == node1.Label)), Times.Once, "Nodes should get saved to the database");
            repository.Verify(x => x.Save(It.Is<NodeEntity>(xx => xx.Id == node2.Id && xx.Label == node2.Label)), Times.Once, "Nodes should get saved to the database");
        }
        public StorageFixture()
        {
            Config = new ConfigurationBuilder()
                .SetBasePath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", ".."))
                .AddEnvironmentVariables()
                .AddUserSecrets()
                .Build();

            var credential =
                new ServiceAccountCredential(new ServiceAccountCredential.Initializer(Config["GoogleEmail"])
                {
                    Scopes = new[] {StorageService.Scope.DevstorageFullControl}
                }.FromCertificate(new X509Certificate2(Convert.FromBase64String(Config["GoogleP12PrivateKey"]), "notasecret", X509KeyStorageFlags.Exportable)));

            _client = new StorageService(new BaseClientService.Initializer
            {
                HttpClientInitializer = credential
            });
        }
        public void UploadQuiz(QuizDocument doc, bool useAsync = false)
        {
            var credential = GetCredentials();
            StorageService service = new StorageService(
                new BaseClientService.Initializer()
                {
                    HttpClientInitializer = credential,
                    ApplicationName = "Quiz Plus Uploader",
                });

            foreach(var slide in doc.Slides)
            {
                var fileobj = new GSD.Object() { Name = slide.CanonicalName };
                var uploadStream = new FileStream(slide.ImagePath, FileMode.Open, FileAccess.Read);
                var uploadRequest = service.Objects.Insert(
                    fileobj,
                    BUCKET_NAME,
                    uploadStream,
                    "image/jpeg");

                if (useAsync)
                {
                    var task = uploadRequest.UploadAsync();
                    task.ContinueWith(t =>
                    {
                        // Remeber to clean the stream.
                        Logger.Log("Uploaded image " + slide.ImagePath);
                        uploadStream.Dispose();
                    });
                }
                else
                {
                    uploadRequest.Upload();
                    Logger.Log("Uploaded image " + slide.ImagePath);
                    uploadStream.Dispose();
                }
            }
        }
Beispiel #21
0
        public async Task ReadAndConvertImage()
        {
            //arrange
            var ss = new StorageService();
            var imageBytes = await ss.GetAssetFileAsync("Assets/Tests/" + TestFile);
            var stream = new MemoryStream(imageBytes);

            var ps = new PlatformCodeService();

            //act
            //do not resize
            var bytesOrigin = await ps.ResizeImageAsync(stream, 10000, 10000);
            //resize
            var byteSmall = await ps.ResizeImageAsync(stream, 200, 200);

            //assert
            Assert.IsTrue(stream.Length == bytesOrigin.Length);

            //expected
            //Assert.IsTrue(image.Length > byteSmall.Length); //--FAILS--
            //real
            Assert.IsNull(byteSmall); //because of the exception occured in FlushAsync
        }
        public void DeletedItemIsNotReturnedInCallsToPeek()
        {
            // Setup - create a storage with one item
            var storage = new StorageService();
            storage.Init("unittest" + Guid.NewGuid().ToString());
            Transmission transmissionToEnqueue = CreateTransmissionAndEnqueueIt(storage);

            // Act
            StorageTransmission firstPeekedTransmission;

            // if item is not disposed,peek will not return it (regardless of the call to delete). 
            // So for this test to actually test something, using 'using' is required.  
            using (firstPeekedTransmission = storage.Peek())
            {
                storage.Delete(firstPeekedTransmission);
            }

            StorageTransmission secondPeekedTransmission = storage.Peek();

            // Asserts            
            Assert.IsNotNull(firstPeekedTransmission);
            Assert.IsNull(secondPeekedTransmission);
        }
        public TestController()
        {
            Log.Instance = new TestLogger();

            // Create root services first.
            var systemInformationService = new SystemInformationService();
            var apiService = new ApiService();
            ApiService = new ApiService();
            BackupService = new BackupService();
            StorageService = new StorageService();
            TimerService = new TestTimerService();
            DaylightService = new TestDaylightService();
            DateTimeService = new TestDateTimeService();

            SettingsService = new SettingsService(BackupService, StorageService);
            ResourceService = new ResourceService(BackupService, StorageService, SettingsService);
            SchedulerService = new SchedulerService(TimerService, DateTimeService);
            NotificationService = new NotificationService(DateTimeService, ApiService, SchedulerService, SettingsService, StorageService, ResourceService);
            SystemEventsService = new SystemEventsService(this, NotificationService, ResourceService);
            AutomationService = new AutomationService(SystemEventsService, systemInformationService, apiService);
            ComponentService = new ComponentService(SystemEventsService, systemInformationService, apiService, SettingsService);
            AreaService = new AreaService(ComponentService, AutomationService, SystemEventsService, systemInformationService, apiService, SettingsService);
        }
 /// <summary>
 /// Creates a <see cref="TableQuery"/> object for querying a minute metrics log table.
 /// </summary>
 /// <param name="service">A <see cref="StorageService"/> enumeration value.</param>
 /// <param name="location">A <see cref="StorageLocation"/> enumeration value.</param>
 /// <returns>A <see cref="TableQuery"/> object.</returns>
 public TableQuery<MetricsEntity> CreateMinuteMetricsQuery(StorageService service, StorageLocation location)
 {
     CloudTable minuteMetricsTable = this.GetMinuteMetricsTable(service, location);
     return minuteMetricsTable.CreateQuery<MetricsEntity>();
 }
Beispiel #25
0
 public void DiscardChanges(TEntity entity)
 {
     StorageService.DiscardChanges(entity);
 }
Beispiel #26
0
 public PackageManagerService(StorageService storageService, ILogger <PackageManagerService> logger)
 {
     _storageService = storageService ?? throw new ArgumentNullException(nameof(storageService));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Beispiel #27
0
 public void AddStorageArea(DocumentStorageArea StorageArea)
 {
     StorageService.AddStorageArea(StorageArea);
 }
Beispiel #28
0
 public void UpdateStorageArea(DocumentStorageArea StorageArea)
 {
     StorageService.UpdateStorageArea(StorageArea);
 }
Beispiel #29
0
 public BindingList <DocumentStorage> GetAllStoragesWithServer()
 {
     return(StorageService.GetStoragesWithServer());
 }
Beispiel #30
0
 public DocumentStorageArea GetStorageArea(Guid IdStorageArea)
 {
     return(StorageService.GetStorageArea(IdStorageArea));
 }
Beispiel #31
0
 public BindingList <DocumentStorageArea> GetStorageAreasFromStorageArchive(Guid IdStorage, Guid IdArchive)
 {
     return(StorageService.GetStorageAreasFromStorageArchive(IdStorage, IdArchive));
 }
Beispiel #32
0
 public BindingList <DocumentStorageArea> GetStorageAreas(Guid IdStorage)
 {
     return(StorageService.GetAllStorageAreaFromStorage(IdStorage));
 }
Beispiel #33
0
 public DocumentStorage GetStorageWithServer(Guid IdStorage)
 {
     return(StorageService.GetStorageWithServer(IdStorage));
 }
Beispiel #34
0
 public DocumentStorage GetStorage(Guid IdStorage)
 {
     return(StorageService.GetStorage(IdStorage));
 }
Beispiel #35
0
 public BindingList <DocumentStorage> GetStoragesFromArchive(Guid IdArchive)
 {
     return(StorageService.GetStorageFromArchive(new DocumentArchive(IdArchive)));
 }
 /// <summary>
 /// Gets the hourly metrics table for the specified storage service.
 /// </summary>
 /// <param name="service">A <see cref="StorageService"/> enumeration value.</param>
 /// <returns>A <see cref="CloudTable"/> object.</returns>
 public CloudTable GetHourMetricsTable(StorageService service)
 {
     return this.GetHourMetricsTable(service, StorageLocation.Primary);
 }
 /// <summary>
 /// Initializes the bucket model.
 /// </summary>
 /// <param name="bucket">The name of the bucket this models.</param>
 /// <param name="service">The storage service used to maintain the model.</param>
 public BucketModel(string bucket, StorageService service)
 {
     _bucket = bucket;
     _service = service;
     PopulateModel();
 }
Beispiel #38
0
 public void UpdateStorageAreaRule(DocumentStorageAreaRule StorageAreaRule)
 {
     StorageService.UpdateStorageAreaRule(StorageAreaRule);
 }
Beispiel #39
0
 /// <summary>
 /// Sets the <see cref="IStorageDeviceManagerFactory"/> to be used by the <see cref="FileSystemServer"/>.
 /// Calling this method more than once will do nothing.
 /// </summary>
 /// <param name="storage">The Storage instance to use.</param>
 /// <param name="factory">The <see cref="IStorageDeviceManagerFactory"/> to be used by this Storage instance.</param>
 public static void InitializeStorageDeviceManagerFactory(this StorageService storage,
                                                          IStorageDeviceManagerFactory factory)
 {
     storage.GetStorageDeviceManagerFactory(factory);
 }
Beispiel #40
0
 public BindingList <DocumentStorageAreaRule> GetStorageAreaRuleFromStorageArea(Guid IdStorageArea)
 {
     return(StorageService.GetStorageAreaRulesFromStorageArea(IdStorageArea));
 }
Beispiel #41
0
 public SignInModel(StorageService storage, EncryptionService encryption, CookieService cookie)
 {
     storageService    = storage;
     encryptionService = encryption;
     cookieService     = cookie;
 }
Beispiel #42
0
 public BindingList <DocumentStorage> GetStoragesNotRelatedToArchive(Guid IdArchive)
 {
     return(StorageService.GetStoragesNotRelatedToArchive(new DocumentArchive(IdArchive)));
 }
Beispiel #43
0
 public NotesController(StorageService storageService)
 {
     _storageService = storageService ?? throw new ArgumentNullException(nameof(storageService));
 }
Beispiel #44
0
 public void AddStorageAreaRule(DocumentStorageAreaRule StorageAreaRule)
 {
     StorageService.AddStorageAreaRule(StorageAreaRule);
 }
 public StorageController(StorageService storageService)
 {
     _storageService = storageService;
 }
Beispiel #46
0
 public BindingList <DocumentStorageType> GetStoragesType()
 {
     return(StorageService.GetStoragesType());
 }
Beispiel #47
0
 public void EnableDisableStorageToArchive(Guid IdStorage, Guid IdArchive, bool Enable)
 {
     StorageService.EnableDisableStorageToArchive(IdStorage, IdArchive, Enable);
 }
Beispiel #48
0
        private static void InitializeValidStorageServiceData()
        {
            StorageService myStore = new StorageService();
            myStore.ServiceName = "mystore";
            myStore.StorageServiceKeys = new StorageServiceKeys();
            myStore.StorageServiceKeys.Primary = "=132321982cddsdsa";
            myStore.StorageServiceKeys.Secondary = "=w8uidjew4378891289";
            myStore.StorageServiceProperties = new StorageServiceProperties();
            myStore.StorageServiceProperties.Location = "North Central US";
            myStore.StorageServiceProperties.Status = "Created";
            ValidStorageService.Add(myStore);

            StorageService testStore = new StorageService();
            testStore.ServiceName = "teststore";
            testStore.StorageServiceKeys = new StorageServiceKeys();
            testStore.StorageServiceKeys.Primary = "=/se23ew2343221";
            testStore.StorageServiceKeys.Secondary = "==0--3210-//121313233290sd";
            testStore.StorageServiceProperties = new StorageServiceProperties();
            testStore.StorageServiceProperties.Location = "East Asia";
            testStore.StorageServiceProperties.Status = "Creating";
            ValidStorageService.Add(testStore);

            StorageService MyCompanyStore = new StorageService();
            MyCompanyStore.ServiceName = "mycompanystore";
            MyCompanyStore.StorageServiceKeys = new StorageServiceKeys();
            MyCompanyStore.StorageServiceKeys.Primary = "121/21dssdsds=";
            MyCompanyStore.StorageServiceKeys.Secondary = "023432dfelfema1=";
            MyCompanyStore.StorageServiceProperties = new StorageServiceProperties();
            MyCompanyStore.StorageServiceProperties.Location = "North Europe";
            MyCompanyStore.StorageServiceProperties.Status = "Suspending";
            ValidStorageService.Add(MyCompanyStore);
        }
Beispiel #49
0
 public void AddStorageToArchive(Guid IdStorage, Guid IdArchive, bool Enable)
 {
     StorageService.AddStorageToArchive(IdStorage, IdArchive, Enable);
 }
Beispiel #50
0
 public BindingList <DocumentRuleOperator> GetRuleOperators()
 {
     return(StorageService.GetRuleOperators());
 }
 /// <summary>
 /// Gets a <see cref="CloudBlobDirectory"/> object containing the logs for the specified storage service.
 /// </summary>
 /// <param name="service">A <see cref="StorageService"/> enumeration value.</param>
 /// <returns>A <see cref="CloudBlobDirectory"/> object.</returns>
 public CloudBlobDirectory GetLogDirectory(StorageService service)
 {
     return this.blobClient.GetContainerReference(this.LogContainer).GetDirectoryReference(service.ToString().ToLowerInvariant());
 }
Beispiel #52
0
 /// <summary>
 /// Create a Question Controller object.
 /// </summary>
 /// <param name="storageService">Storage service object for accessing Room info</param>
 public LeaveController(StorageService storageService)
 {
     this.storageService = storageService;
 }
        /// <summary>
        /// Gets the hourly metrics table for the specified storage service.
        /// </summary>
        /// <param name="service">A <see cref="StorageService"/> enumeration value.</param>
        /// <param name="location">A <see cref="StorageLocation"/> enumeration value.</param>
        /// <returns>A <see cref="CloudTable"/> object.</returns>
        public CloudTable GetHourMetricsTable(StorageService service, StorageLocation location)
        {
            switch (service)
            {
                case StorageService.Blob:
                    if (location == StorageLocation.Primary)
                    {
                        return this.tableClient.GetTableReference(Constants.AnalyticsConstants.MetricsHourPrimaryTransactionsBlob);
                    }
                    else
                    {
                        return this.tableClient.GetTableReference(Constants.AnalyticsConstants.MetricsHourSecondaryTransactionsBlob);
                    }

                case StorageService.Queue:
                    if (location == StorageLocation.Primary)
                    {
                        return this.tableClient.GetTableReference(Constants.AnalyticsConstants.MetricsHourPrimaryTransactionsQueue);
                    }
                    else
                    {
                        return this.tableClient.GetTableReference(Constants.AnalyticsConstants.MetricsHourSecondaryTransactionsQueue);
                    }

                case StorageService.Table:
                    if (location == StorageLocation.Primary)
                    {
                        return this.tableClient.GetTableReference(Constants.AnalyticsConstants.MetricsHourPrimaryTransactionsTable);
                    }
                    else
                    {
                        return this.tableClient.GetTableReference(Constants.AnalyticsConstants.MetricsHourSecondaryTransactionsTable);
                    }

                default:
                    throw new ArgumentException(SR.InvalidStorageService);
            }
        }
Beispiel #54
0
 public static IStorageDeviceManagerFactory GetStorageDeviceManagerFactory(this StorageService storage,
                                                                           IStorageDeviceManagerFactory factory)
 {
     ref StorageDeviceManagerFactoryGlobals g = ref storage.Globals.StorageDeviceManagerFactory;
Beispiel #55
0
 public BindingList <DocumentStorageRule> GetStorageRulesFromStorage(Guid IdStorage)
 {
     return(StorageService.GetStorageRulesFromStorage(IdStorage));
 }
Beispiel #56
0
 public void UpdateStorage(DocumentStorage storage)
 {
     StorageService.UpdateStorage(storage);
 }
Beispiel #57
0
 public BindingList <Status> GetAllStorageAreaStatus()
 {
     return(StorageService.GetAllStorageAreaStatus());
 }
Beispiel #58
0
 public DocumentStorageAreaRule GetStorageAreaRule(Guid IdStorageArea, Guid IdAttribute)
 {
     return(StorageService.GetStorageAreaRule(IdStorageArea, IdAttribute));
 }
Beispiel #59
0
 public static void GetMessages(App42ApiResultCallback requestCallback)
 {
     try
     {
         App42ApiCallback _sCallback = new App42ApiCallback(requestCallback);
         if (mStorageService == null)
         {
             mStorageService = GlobalContext.SERVICE_API.BuildStorageService();
         }
         mStorageService.FindDocumentByKeyValue(GlobalContext.databaseName, GlobalContext.collectionName, "RecepientID", GlobalContext.g_UserProfile.UserID, _sCallback);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Beispiel #60
0
 public BindingList <DocumentStorageRule> GetStorageRulesFromStorageAreaArchive(Guid IdStorageArea, Guid IdArchive)
 {
     return(new BindingList <DocumentStorageRule>(StorageService.GetStorageRulesFromStorageAreaArchive(IdStorageArea, IdArchive).Select(x => new DocumentStorageRule {
         Attribute = x.Attribute, RuleFilter = x.RuleFilter, RuleFormat = x.RuleFormat, RuleOperator = x.RuleOperator, RuleOrder = x.RuleOrder
     }).ToList()));
 }