Interface IBLOBAgent
Interface for the BLOB Agent Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("BLOB Agent", "Interface for the BLOB Agent. Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.")]
public interface IBLOBAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (BLOBAgent agent = new BLOBAgent())
{
// call methods on agent here...
}
}
Methods
ChangeContactImageAsync(int, int, CancellationToken)
Changes the contact image link. If the Binary object id is 0, any image link is removed from the contact.
Declaration
Task ChangeContactImageAsync(int contactId, int blobId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | contactId | The Contact the image is linked to |
int | blobId | The Binary object id. If the Binary object id is 0, any image link is removed from the Contact. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
ChangePersonImageAsync(int, int, CancellationToken)
Interface for the BLOB Agent Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
Declaration
Task ChangePersonImageAsync(int personId, int blobId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | personId | The person the image is linked to |
int | blobId | The Binary object id. If the Binary object id is 0, any image link is removed from the person. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
ChangeProductImageAsync(int, int, CancellationToken)
Interface for the BLOB Agent Collection of all services that works with binary objects (BLOBS), e.g. Images and documents.
Declaration
Task ChangeProductImageAsync(int productId, int blobId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | productId | The product the image is linked to |
int | blobId | The Binary object id. If the Binary object id is 0, any image link is removed from the product. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
ChangeProjectImageAsync(int, int, CancellationToken)
Changes the project image link. If the Binary object id is 0, any image link is removed from the project.
Declaration
Task ChangeProjectImageAsync(int projectId, int blobId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | projectId | The project the image is linked to |
int | blobId | The Binary object id. If the Binary object id is 0, any image link is removed from the project. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
CleanupBatchTaskAsync(int, CancellationToken)
Removes the binary objects linked to the batch task, the links themselves and the batch task.
Declaration
Task CleanupBatchTaskAsync(int batchTaskId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | batchTaskId | The ID of the batchtask that created the output data |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
CreateDefaultBlobEntityAsync(CancellationToken)
Loading default values into a new BlobEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
Task<BlobEntity> CreateDefaultBlobEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | New BlobEntity with default values |
DeleteBlobEntityAsync(int, CancellationToken)
Deletes the BlobEntity
Declaration
Task DeleteBlobEntityAsync(int blobEntityId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | blobEntityId | The identity of the BlobEntity |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
GetBlobEntityAsync(int, CancellationToken)
Gets a BlobEntity object.
Declaration
Task<BlobEntity> GetBlobEntityAsync(int blobEntityId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | blobEntityId | The identifier of the BlobEntity object |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | BlobEntity |
GetBlobEntityOnContactAsync(int, CancellationToken)
Gets the blob entity that represents the contact image binary object.
Declaration
Task<BlobEntity> GetBlobEntityOnContactAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | contactId | The Contact id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | BlobEntity object |
GetBlobEntityOnCountryAsync(int, CancellationToken)
Gets the blob entity that represents the country flag binary object.
Declaration
Task<BlobEntity> GetBlobEntityOnCountryAsync(int countryId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | countryId | The country id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | BlobEntity object |
GetBlobEntityOnPersonAsync(int, CancellationToken)
Gets the blob entity that represents the person image binary object.
Declaration
Task<BlobEntity> GetBlobEntityOnPersonAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | personId | The person id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | BlobEntity object |
GetBlobEntityOnProductAsync(int, CancellationToken)
Gets the blob entity that represents the product image binary object.
Declaration
Task<BlobEntity> GetBlobEntityOnProductAsync(int productId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | productId | The product id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | BlobEntity object |
GetBlobEntityOnProjectAsync(int, CancellationToken)
Gets the blob entity that represents the project image binary object.
Declaration
Task<BlobEntity> GetBlobEntityOnProjectAsync(int projectId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | projectId | The project id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | BlobEntity object |
GetBlobStreamAsync(int, CancellationToken)
Get the binary object as a stream
Declaration
Task<Stream> GetBlobStreamAsync(int blobEntityId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | blobEntityId | The ID of the BLOB entity object that refers to the binary data |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Stream> | The binary object as a Stream |
GetChatImageWithSizeAsync(int, int, int, CancellationToken)
Returns the chat image that is displayed in chat with a specified maximum size.
Declaration
Task<Image> GetChatImageWithSizeAsync(int chatTopicId, int width, int height, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | chatTopicId | The project id of the project the image belongs to. |
int | width | The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
int | height | The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a jpeg/base64 encoded string.) |
GetContactImageAsync(int, CancellationToken)
Returns the contact image that is displayed in the CRM application.
Declaration
Task<Image> GetContactImageAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | contactId | The contact id of the contact the image belongs to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.) |
GetContactImageWithSizeAsync(int, int, int, CancellationToken)
Returns the contact image that is displayed in the CRM application with a specified maximum size.
Declaration
Task<Image> GetContactImageWithSizeAsync(int contactId, int width, int height, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | contactId | The contact id of the Contact the image belongs to. |
int | width | The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
int | height | The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a jpeg/base64 encoded string.) |
GetOutputFromBatchAsync(int, CancellationToken)
Get the output of a batchtask as a stream
Declaration
Task<Stream> GetOutputFromBatchAsync(int batchTaskId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | batchTaskId | The ID of the batchtask that created the output data |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Stream> | The binary object as a Stream |
GetPersonImageAsync(int, CancellationToken)
Returns the person image that is displayed in the CRM application.
Declaration
Task<Image> GetPersonImageAsync(int personId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | personId | The person id of the person the image belongs to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.) |
GetPersonImageWithSizeAsync(int, int, int, CancellationToken)
Returns the person image that is displayed in the CRM application with a specified maximum size.
Declaration
Task<Image> GetPersonImageWithSizeAsync(int personId, int width, int height, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | personId | The person id of the person the image belongs to. |
int | width | The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
int | height | The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a jpeg/base64 encoded string.) |
GetProductImageAsync(int, CancellationToken)
Returns the product image (rank=1) that is displayed in the CRM application.
Declaration
Task<Image> GetProductImageAsync(int productId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | productId | The product id of the product the image belongs to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.) |
GetProductThumbnailAsync(int, CancellationToken)
Returns the product thumbnail that is displayed in the CRM application.
Declaration
Task<Image> GetProductThumbnailAsync(int productId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | productId | The product id of the product the thumbnail belongs to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The thumbnail as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.) |
GetProjectImageAsync(int, CancellationToken)
Returns the project image that is displayed in the CRM application.
Declaration
Task<Image> GetProjectImageAsync(int projectId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | projectId | The project id of the project the image belongs to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.) |
GetProjectImageWithSizeAsync(int, int, int, CancellationToken)
Returns the project image that is displayed in the CRM application with a specified maximum size.
Declaration
Task<Image> GetProjectImageWithSizeAsync(int projectId, int width, int height, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | projectId | The project id of the project the image belongs to. |
int | width | The maximum with of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
int | height | The maximum height of the returned image. Specify <= 0 to preserve aspect ratio of existing image |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a jpeg/base64 encoded string.) |
GetQuoteLineImageAsync(int, CancellationToken)
Returns the quoteline image (rank=1) that is displayed in the CRM application.
Declaration
Task<Image> GetQuoteLineImageAsync(int quoteLineId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | quoteLineId | The product id of the quoteline the image belongs to. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Image> | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.) |
SaveBlobEntityAsync(BlobEntity, CancellationToken)
Updates the existing BlobEntity or creates a new BlobEntity if the id parameter is empty
Declaration
Task<BlobEntity> SaveBlobEntityAsync(BlobEntity blobEntity, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
BlobEntity | blobEntity | The BlobEntity that is saved. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<BlobEntity> | New or updated BlobEntity |
SaveImageStreamAsync(BlobLinkType, Image, string, CancellationToken)
Stores an image in the database without linking it to a project or a person. It is possible to ChangePersonImage or ChangeProjectImage to attach image later.
Declaration
Task<int> SaveImageStreamAsync(BlobLinkType type, Image image, string description, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
BlobLinkType | type | The type of the image. |
Image | image | Image to store |
string | description | Image description |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<int> | The blob id |
SaveProjectImageAsync(string, Image, CancellationToken)
Saves a project image that is displayed in the CRM application's project image selection dialog to the database.
Declaration
Task SaveProjectImageAsync(string description, Image image, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | description | Image description. Should be image name (e.g. winter.jpg) for project images |
Image | image | The project image (System.Drawing.Image) |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetBlobStreamAsync(int, Stream, CancellationToken)
Store a binary object from it's stream
Declaration
Task SetBlobStreamAsync(int blobEntityId, Stream stream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | blobEntityId | Id of the BLOB entity object that the binary data should be stored to. |
Stream | stream | The binary object as a Stream |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetContactImageAsync(int, Image, CancellationToken)
Stores the contact image that is displayed in the CRM application.
Declaration
Task SetContactImageAsync(int contactId, Image image, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | contactId | The contact id of the contact the image belongs to. |
Image | image | The image that is stored on the contact (System.Drawing.Image) |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetPersonImageAsync(int, Image, CancellationToken)
Stores the person image that is displayed in the CRM application.
Declaration
Task SetPersonImageAsync(int personId, Image image, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | personId | The person id of the person the image belongs to. |
Image | image | The image that is stored on the person (System.Drawing.Image) |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetProductImageAsync(int, Image, CancellationToken)
Stores the product image that is displayed in the CRM application. The image is scaled down to max 1000x1000. This method operates only the main (rank=1) image; future extensions may support multiple images. A thumbnail of size 75x75 is also automatically set.
Declaration
Task SetProductImageAsync(int productId, Image image, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | productId | The product id of the product the image belongs to. |
Image | image | The image that is stored on the product (System.Drawing.Image), scaled down to no more than 1000x1000 |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetProductThumbnailAsync(int, Image, CancellationToken)
Stores the product thumbnail that is displayed in the CRM application. The image is scaled down to max 200x200 pixels.
Declaration
Task SetProductThumbnailAsync(int productId, Image image, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | productId | The product id of the product the image belongs to. |
Image | image | The image that is stored on the product (System.Drawing.Image); scaled down to no more than 200x200 |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
SetProjectImageAsync(int, Image, CancellationToken)
Stores the project image that is displayed in the CRM application.
Declaration
Task SetProjectImageAsync(int projectId, Image image, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | projectId | The project id of the project the image belongs to. |
Image | image | The image that is stored on the project (System.Drawing.Image) |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |