Class CampaignController
The Campaign Controller is a controller that allows data to be retrieved and updated within the Ayuda Platform.
Namespace: Ayuda.BMS.Splash.Areas.Pi.Controllers
Remarks
This web service can be accessed using an address similar to the following: https://[AYUDA DEPLOYMENT URL]/Juice/Pi/Campaign
Methods
AddDesign(CampaignDesignModel)
Associates a design with a campaign.
Declaration
public JsonResult AddDesign(CampaignDesignModel model)
Parameters
Type | Name | Description |
---|---|---|
CampaignDesignModel | model | The model containing the information of the association. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded string containing the ID of the association. |
AutomaticallyExpireCampaigns(Guid[])
Expires campaigns that have reached a certain age, depending on their current status.
note
If no sales contract status is configured to expire, this method will fail.
Declaration
public JsonResult AutomaticallyExpireCampaigns(Guid[] campaignIds = null)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | campaignIds | The IDs of the campaigns to verify for expiry. If this parameter is omitted, all campaigns are checked. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded array with the IDs of all expired campaigns. If no campaigns are expired, the array will be empty. |
ChangeDigitalOverbookingStatus(Guid, Boolean)
Changes the overbooking status of the campaign to enable or disable overbooking of digital faces.
Declaration
public JsonResult ChangeDigitalOverbookingStatus(Guid campaignID, bool overbookingStatus)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | campaignID | |
System.Boolean | overbookingStatus |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult |
|
Create(CampaignModel)
Creates a new campaign using the specified parameters.
Declaration
public JsonResult Create(CampaignModel model)
Parameters
Type | Name | Description |
---|---|---|
CampaignModel | model | Model of the campaign to be created. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | The ID associated with the new campaign and the Sales Contract ID of the campaign if successfully created. |
Delete(Guid)
Declaration
public JsonResult Delete(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult |
FindByName(String)
Find Campaigns by Name.
Declaration
public JsonResult FindByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Campaign |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A list of matching Campaigns. |
FindBySalesContractNumber(String)
Finds Campaigns by SalesContractNumber.
Declaration
public JsonResult FindBySalesContractNumber(string scn)
Parameters
Type | Name | Description |
---|---|---|
System.String | scn | SalesContractNumber of the Campaign |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A list of matching Campaigns. |
Get(Guid)
Gets all properties of a given campaign.
Declaration
public JsonResult Get(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | ID of the campaign. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | Model of the campaign corresponding to the Campaign ID. |
GetByName(String)
Gets the Campaign by Name. (Obsolete: replaced by FindByName) If multiple campaigns have the same name, only the first one is returned (based on ID).
Declaration
[Obsolete]
public JsonResult GetByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Campaign |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | The Campaign if found. |
GetBySalesContractNumber(String)
Gets the Campaign by SalesContractNumber. (Obsolete: replaced by FindBySalesContractNumber) If multiple campaigns match, only the first one is returned (based on ID).
Declaration
[Obsolete]
public JsonResult GetBySalesContractNumber(string scn)
Parameters
Type | Name | Description |
---|---|---|
System.String | scn | SalesContractNumber of the Campaign |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | The Campaign if found. |
GetCampaignIdsWithBookingsWithinDateRange(DateTime, DateTime)
Return campaign ids for campaigns that have bookings within specified date range.
Declaration
public JsonResult GetCampaignIdsWithBookingsWithinDateRange(DateTime startDate, DateTime endDate)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | startDate | Start of date range. |
System.DateTime | endDate | End of date range. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded array of Guids. |
GetDesign(Guid)
Gets all properties of a campaign/design association.
Declaration
public JsonResult GetDesign(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | ID of the campaign/design association. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded instance of the |
GetExpiredCampaigns(Guid[])
Gets the IDs of expired campaigns.
note
If no sales contract status is configured to expire, this method will fail.
Declaration
public JsonResult GetExpiredCampaigns(Guid[] campaignIds = null)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | campaignIds | The IDs of the campaigns to verify for expiry. If this parameter is omitted, all campaigns are checked. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded array with the IDs of all expired campaigns. If no campaigns are expired, the array will be empty. |
GetMany(Guid[])
Return information about the specified campaigns.
Declaration
public JsonResult GetMany(Guid[] ids)
Parameters
Type | Name | Description |
---|---|---|
System.Guid[] | ids | The IDs of the campaigns. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded array if instances of the |
GetOverbookedFaces(Guid)
Returns the list of overbooked faceIds in a Campaign
Declaration
public ActionResult GetOverbookedFaces(Guid campaignID)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | campaignID | ID of the campaign whose faces have to be checked for overbooking |
Returns
Type | Description |
---|---|
System.Web.Mvc.ActionResult | A Json encoded array of |
InjectServices(ISalesContractService, ICampaignService)
Declaration
public void InjectServices(ISalesContractService salesContractService, ICampaignService campaignService)
Parameters
Type | Name | Description |
---|---|---|
ISalesContractService | salesContractService | |
ICampaignService | campaignService |
ListSegments(Guid)
Lists all segments associated with the campaign.
Declaration
public JsonResult ListSegments(Guid campaignID)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | campaignID | ID of the campaign to list all segments for. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | Models of all segments belonging to the campaign. |
RemoveDesign(Guid)
Removes the association between a campaign and a design.
Declaration
public JsonResult RemoveDesign(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id | The ID of the campaign/design association. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded boolean. true if the removal succeeded, else false. |
Search(String, Int32)
Searches all campaigns.
Declaration
public JsonResult Search(string term, int limit = 25)
Parameters
Type | Name | Description |
---|---|---|
System.String | term | Term to search. |
System.Int32 | limit |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | Models of all the results that match the search term. |
Update(Nullable<Guid>, Nullable<Guid>, String, String, Nullable<Guid>, Nullable<Guid>, Nullable<Guid>, Nullable<Guid>, String, String, Nullable<DateTime>, Nullable<DateTime>, Nullable<Guid>, Nullable<Guid>, Nullable<Guid>, Nullable<Int32>, Nullable<Boolean>, Nullable<Boolean>, Nullable<DateTime>, String, Nullable<Guid>, Nullable<Guid>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Boolean>)
Updates the campaign with the specified parameters.
Declaration
public JsonResult Update(Guid? id, Guid? campaignId, string name, string description, Guid? companyID, Guid? advertiserID, Guid? agencyID, Guid? specialistAgencyID, string salesContractNumber, string referenceNumber, DateTime? startDate, DateTime? endDate, Guid? salesContractStatusTypeID, Guid? salesContractTypeID, Guid? salesContractContentTypeID, int? holdDurationInDays, bool? isNetAmount, bool? productionCostIncluded, DateTime? signedOnDate, string notes, Guid? accountExecutiveID, Guid? backOfficeOwnerID, bool? forceUnlinkBundlesOnAdvertiserChange, bool? forceUnlinkDesignsOnAdvertiserChange, bool? forceDeleteInvoicesOnAdvertiserChange, bool? forceRemoveOtherCostsOnDivisionChange, bool? forceRemoveDiscountsOnDivisionChange, bool? forceClearInvoiceScheduleOnDivisionChange, bool? forceAll)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Guid> | id | ID of the campaign to be updated. |
System.Nullable<System.Guid> | campaignId | |
System.String | name | Name of the campaign to be updated. |
System.String | description | |
System.Nullable<System.Guid> | companyID | |
System.Nullable<System.Guid> | advertiserID | ID of the Advertiser associated with the campaign to be updated. |
System.Nullable<System.Guid> | agencyID | ID of the Agent associated with the campaign to be updated. |
System.Nullable<System.Guid> | specialistAgencyID | ID of the Specialist Agent associated with the campaign to be updated. |
System.String | salesContractNumber | |
System.String | referenceNumber | |
System.Nullable<System.DateTime> | startDate | Start Date of the campaign to be updated. |
System.Nullable<System.DateTime> | endDate | End Date of the campaign to be updated. |
System.Nullable<System.Guid> | salesContractStatusTypeID | |
System.Nullable<System.Guid> | salesContractTypeID | |
System.Nullable<System.Guid> | salesContractContentTypeID | |
System.Nullable<System.Int32> | holdDurationInDays | |
System.Nullable<System.Boolean> | isNetAmount | |
System.Nullable<System.Boolean> | productionCostIncluded | |
System.Nullable<System.DateTime> | signedOnDate | |
System.String | notes | |
System.Nullable<System.Guid> | accountExecutiveID | ID of the Account Executive associated with the campaign to be updated. |
System.Nullable<System.Guid> | backOfficeOwnerID | ID of the Back Office Owner associated with the campaign to be updated. |
System.Nullable<System.Boolean> | forceUnlinkBundlesOnAdvertiserChange | Indicates if the bundles are automatically unlinked if the advertiser changes (true for yes). This parameter is optional. If not specified or set to false, the method may purposefully fail to prevent illegal changes to the data. |
System.Nullable<System.Boolean> | forceUnlinkDesignsOnAdvertiserChange | Indicates if the designs are automatically unlinked if the advertiser changes (true for yes). This parameter is optional. If not specified or set to false, the method may purposefully fail to prevent illegal changes to the data. |
System.Nullable<System.Boolean> | forceDeleteInvoicesOnAdvertiserChange | Indicates if invoices are automatically deleted if the advertiser changes (true for yes). This parameter is optional. If not specified or set to false, the method may purposefully fail to prevent illegal changes to the data. |
System.Nullable<System.Boolean> | forceRemoveOtherCostsOnDivisionChange | Indicates if other costs are automatically removed if the division changes (true for yes). This parameter is optional. If not specified or set to false, the method may purposefully fail to prevent illegal changes to the data. |
System.Nullable<System.Boolean> | forceRemoveDiscountsOnDivisionChange | Indicates if discounts are automatically removed if the advertiser changes (true for yes). This parameter is optional. If not specified or set to false, the method may purposefully fail to prevent illegal changes to the data. |
System.Nullable<System.Boolean> | forceClearInvoiceScheduleOnDivisionChange | Indicates if the invoice schedule is cleared automatically if the advertiser changes (true for yes). This parameter is optional. If not specified or set to false, the method may purposefully fail to prevent illegal changes to the data. |
System.Nullable<System.Boolean> | forceAll | Forces the same answer to all "force" parameters that are not explicitly given a value. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult |
|
UpdateDesign(Nullable<Guid>, Nullable<Guid>, Nullable<Guid>, String, Nullable<Int32>, Nullable<Guid>, Nullable<Boolean>)
Updates the information for a campaign/design association.
Only the ID of the design and the fields to be updated need to be specified.
It is also possible to send a whole instance of the
Declaration
public JsonResult UpdateDesign(Guid? id, Guid? salesContractDesignID, Guid? designID, string name, int? expectedQuantity, Guid? faceSizeID, bool? isCustomerSupplied)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Guid> | id | The id of the sales contract design to update. |
System.Nullable<System.Guid> | salesContractDesignID | The id of the sales contract design to update. Can be used as an alternate to the |
System.Nullable<System.Guid> | designID | The ID of the design . |
System.String | name | The new name of the sales contract design. |
System.Nullable<System.Int32> | expectedQuantity | The new value for the expected quantity. |
System.Nullable<System.Guid> | faceSizeID | The new face size. |
System.Nullable<System.Boolean> | isCustomerSupplied | The new value for the "IsIsCustomerSupplied" field. |
Returns
Type | Description |
---|---|
System.Web.Mvc.JsonResult | A Json encoded boolean. true if the update succeeded, else false. |