/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { GetCampaignsResponse response = new GetCampaignsResponse(); var unmarshaller = CampaignsResponseUnmarshaller.Instance; response.CampaignsResponse = unmarshaller.Unmarshall(context); return(response); }
public HttpResponseMessage GetCampaigns(bool IsWorklfowCampaigns) { GetCampaignsRequest request = new GetCampaignsRequest() { AccountId = this.AccountId, IsWorklflowCampaign = IsWorklfowCampaigns }; GetCampaignsResponse response = workflowService.GetAllCampaigns(request); return(Request.CreateResponse(HttpStatusCode.OK, response.Campaigns)); }
public HttpResponseMessage GetAllCampaigns(CampaignNameViewModel campaign) { GetCampaignsRequest request = new GetCampaignsRequest() { AccountId = this.AccountId, IsWorklflowCampaign = campaign.IsWorklfowCampaigns, Query = campaign.Name }; GetCampaignsResponse response = workflowService.GetCampaigns(request); return(Request.CreateResponse(HttpStatusCode.OK, response.Campaigns)); }
public JsonResult GetCampaigns() { int accountID = UserExtensions.ToAccountID(this.Identity); GetCampaignsResponse response = leadScoreService.GetCampaigns(new GetCampaignsRequest() { accountId = accountID }); return(Json(new { success = true, response = response.Campaigns }, JsonRequestBehavior.AllowGet)); }
public GetCampaignsResponse GetCampaigns() { var response = new GetCampaignsResponse(); try { response.Campaigns = _context.Campaign.ToList(); } catch (Exception e) { throw new Exception($"Couldn\'t get campaigns due to: {e.StackTrace} {e.Message}"); } return(response); }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <returns></returns> public async Task <List <CampaignType> > CampaignsAsync(campaignTypeType type = campaignTypeType.Campaign) { try { if (_campaigns == null) { var req = new GetCampaignsReq() { header = Client.RequestHeader }; req.type = type; req.typeSpecified = true; GetCampaignsResponse response = await _client.API.GetCampaignsAsync(req); _campaigns = response.GetCampaignsResp; } if (_campaigns != null && _campaigns.errorCode == (int)errorCode.No_error) { return(_campaigns.campaignTypeItems.ToList <CampaignType>()); } else if (_campaigns != null) { throw new FlexMailException(FlexMail.Resources.Campaign.ResourceManager.GetString("Campaigns_" + _campaigns.errorCode), _campaigns.errorCode); } throw new FlexMailException(FlexMail.Resources.Campaign.ResourceManager.GetString("Campaigns_" + _campaigns.errorCode), _campaigns.errorCode); } catch (Exception ex) { //telemetry.TrackException(ex, new Dictionary<string, string> { { "Flexmail", "Campaign.Campaigns" } }); if (ex is FlexMailException) { throw (ex); } } finally { _campaigns = null; } return(new List <CampaignType>()); }
public void GetCampaigns_ValidCampaigns_Success() { var campaigns = new List <Campaign>(); campaigns.Add(new Campaign() { Id = 1, Name = "Campaign1", AccountID = 1 }); campaigns.Add(new Campaign() { Id = 2, Name = "Campaign2", AccountID = 1 }); mockLeadScoreRuleRepository.Setup(lsr => lsr.GetCampaigns(It.IsAny <int>())).Returns(campaigns); GetCampaignsResponse response = leadScoreRuleService.GetCampaigns(new GetCampaignsRequest() { AccountId = 1 }); mockRepository.VerifyAll(); Assert.AreEqual(campaigns.Count, response.Campaigns.Count()); Assert.AreEqual(null, response.Exception); }