本文整理汇总了C#中Campaign类的典型用法代码示例。如果您正苦于以下问题:C# Campaign类的具体用法?C# Campaign怎么用?C# Campaign使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Campaign类属于命名空间,在下文中一共展示了Campaign类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowCampaignTable
/// <summary>
/// select the table to show from the db and build the table in the page
/// </summary>
protected void ShowCampaignTable()
{
Campaign cam = new Campaign();
List<Campaign> campaigns = cam.GetCampaignList(email);
foreach (Campaign c in campaigns)
{
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell tc = new HtmlTableCell();
HtmlTableCell tc1 = new HtmlTableCell();
HtmlTableCell tc2 = new HtmlTableCell();
HtmlTableCell tc3 = new HtmlTableCell();
HtmlTableCell tc4 = new HtmlTableCell();
HtmlTableCell tc5 = new HtmlTableCell();
tc.InnerHtml = c.Name;
tc1.InnerHtml = c.DateCreated.ToString();
tc2.InnerHtml = c.Id.ToString();
tc3.InnerHtml = c.Voucher;
tc4.InnerHtml = c.ShareCount.ToString();
if (c.IsActive == true)
tc5.InnerHtml = "פעיל";
else
tc5.InnerHtml = "לא פעיל";
tr.Cells.Add(tc);
tr.Cells.Add(tc1);
tr.Cells.Add(tc2);
tr.Cells.Add(tc3);
tr.Cells.Add(tc4);
tr.Cells.Add(tc5);
campaignsData.Controls.Add(tr);
}
}
示例2: SpriteSheet
/// <summary>
/// Initializes a new instance of the <see cref="SpriteSheet"/> class.
/// </summary>
/// <param name="campaign">The campaign this sprite sheet belongs to.</param>
/// <param name="sheetID">The ID of the sprite sheet.</param>
/// <param name="rows">The amount of rows in the sprite sheet.</param>
/// <param name="columns">The amount of columns in the sprite sheet.</param>
public SpriteSheet(Campaign campaign, string sheetID, int rows, int columns)
{
this.campaign = campaign;
this.SheetID = sheetID;
this.Rows = rows;
this.Columns = columns;
}
示例3: createCampaignBlock
public static void createCampaignBlock(Campaign campaign, int i, Transform parentTransform, Transform Block, SubRingDiskController subRingDiskCtrl)
{
Vector3 setRotation = parentTransform.rotation.eulerAngles;
setRotation.x = -90.0f;
float posX = (i < 1) ? 1.29f : 1.29f + (i * (1.29f * 0.14f));
float posY = 0f;
Transform currentBlock = (Transform)Instantiate(Block, new Vector3(0, 0, 0), Quaternion.identity);
currentBlock.SetParent(parentTransform);
currentBlock.localScale = new Vector3(0.5f, 0.5f, 0.5f);
currentBlock.rotation = Quaternion.Euler(setRotation);
currentBlock.localPosition = new Vector3(posX, posY, 0f);
//get an instance of the component.
Transform blockInstance = currentBlock.GetComponent<Transform>();
BlockController blockController = blockInstance.GetComponent<BlockController>();
blockController.speed = campaign.Priority;
blockController.order = i;
blockController.objectId = campaign.Id;
blockController.objectName = campaign.Name;
blockController.objectType = "Campaign";
blockController.labels = new string[]{"Type", "Status", "Start Date", "End Date", "Total Leads"};
blockController.fields = new string[]{campaign.Type, campaign.Status, campaign.StartDate, campaign.EndDate, "" + campaign.NumberOfLeads + ""};
blockController.description = campaign.Description;
blockController.parentSubRingDiskController = subRingDiskCtrl;
blockController.setText ("Campaign");
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
loggedInAdmin = Helpers.GetLoggedInAdmin();
currentCompany = Helpers.GetCurrentCompany();
currentCampaign = Helpers.GetCurrentCampaign();
if (!Helpers.IsAuthorizedAdmin(loggedInAdmin, currentCompany))
{
Response.Redirect("/status.aspx?error=notadmin");
}
PopuplateBreadcrumbs();
CancelHyperLink.NavigateUrl = "/manage/Campaigns/ManageCampaign.aspx?campaign_id=" + currentCampaign.campaign_id;
if (!IsPostBack)
{
TitleTextBox.Text = currentCampaign.title;
NotesTextBox.Text = currentCampaign.notes;
StartDateTextBox.Text = currentCampaign.start_datetime.ToShortDateString();
EndDateTextBox.Text = currentCampaign.end_datetime.ToShortDateString();
}
}
示例5: DeleteCampaign
/// <summary>
/// Deleted a queued email
/// </summary>
/// <param name="campaign">Campaign</param>
public virtual void DeleteCampaign(Campaign campaign)
{
if (campaign == null)
throw new ArgumentNullException("campaign");
_campaignRepository.Delete(campaign);
}
示例6: Create
public ActionResult Create([DataSourceRequest] DataSourceRequest request,CampaignVM viewModel)
{
try
{
if (viewModel != null && ModelState.IsValid)
{
Campaign newviewModel = new Campaign();
newviewModel.EndDate = viewModel.EndDate;
newviewModel.Name = viewModel.Name;
newviewModel.StartDate = viewModel.StartDate;
newviewModel.SystemRuleSystemRuleId = viewModel.SystemId;
newviewModel.UserUserId = viewModel.GameMasterId;
newviewModel.Description = viewModel.Description;
db.Campaigns.Add(newviewModel);
db.SaveChanges();
viewModel.CampaignId = newviewModel.CampaignId;
viewModel.System = db.SystemRules.Find(viewModel.SystemId).SystemName;
viewModel.GameMaster = db.Users.Find(viewModel.GameMasterId).Name;
}
}
catch (DataException dataEx)
{
ModelState.AddModelError(string.Empty, "Data error");
Elmah.ErrorSignal.FromCurrentContext().Raise(dataEx);
}
return Json(new[] { viewModel }.ToDataSourceResult(request, ModelState));
}
示例7: Run
/// <summary>
/// Runs the code example.
/// </summary>
/// <param name="user">The AdWords user.</param>
/// <param name="campaignId">Id of the campaign to be updated.</param>
public void Run(AdWordsUser user, long campaignId)
{
// Get the CampaignService.
CampaignService campaignService =
(CampaignService)user.GetService(AdWordsService.v201601.CampaignService);
// Create the campaign.
Campaign campaign = new Campaign();
campaign.id = campaignId;
campaign.status = CampaignStatus.PAUSED;
// Create the operation.
CampaignOperation operation = new CampaignOperation();
[email protected] = Operator.SET;
operation.operand = campaign;
try {
// Update the campaign.
CampaignReturnValue retVal = campaignService.mutate((new CampaignOperation[] {operation}));
// Display the results.
if (retVal != null && retVal.value != null && retVal.value.Length > 0) {
Campaign updatedCampaign = retVal.value[0];
Console.WriteLine("Campaign with name = '{0}' and id = '{1}' was updated.",
updatedCampaign.name, updatedCampaign.id);
} else {
Console.WriteLine("No campaigns were updated.");
}
} catch (Exception e) {
throw new System.ApplicationException("Failed to update campaign.", e);
}
}
示例8: add
public HttpResponseMessage add(Campaign post)
{
// Check for errors
if (post == null)
{
return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null");
}
else if (Language.MasterPostExists(post.language_id) == false)
{
return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The language does not exist");
}
// Make sure that the data is valid
post.name = AnnytabDataValidation.TruncateString(post.name, 50);
post.category_name = AnnytabDataValidation.TruncateString(post.category_name, 50);
post.image_name = AnnytabDataValidation.TruncateString(post.image_name, 100);
post.link_url = AnnytabDataValidation.TruncateString(post.link_url, 200);
// Add the post
Campaign.Add(post);
// Return the success response
return Request.CreateResponse<string>(HttpStatusCode.OK, "The post has been added");
} // End of the add method
示例9: update
public HttpResponseMessage update(Campaign post)
{
// Check for errors
if (post == null)
{
return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null");
}
else if (Language.MasterPostExists(post.language_id) == false)
{
return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The language does not exist");
}
// Make sure that the data is valid
post.name = AnnytabDataValidation.TruncateString(post.name, 50);
post.category_name = AnnytabDataValidation.TruncateString(post.category_name, 50);
post.image_name = AnnytabDataValidation.TruncateString(post.image_name, 100);
post.link_url = AnnytabDataValidation.TruncateString(post.link_url, 200);
// Get the saved post
Campaign savedPost = Campaign.GetOneById(post.id);
// Check if the post exists
if (savedPost == null)
{
return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The record does not exist");
}
// Update the post
Campaign.Update(post);
// Return the success response
return Request.CreateResponse<string>(HttpStatusCode.OK, "The update was successful");
} // End of the update method
示例10: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="service">An initialized Dfa Reporting service object
/// </param>
public override void Run(DfareportingService service)
{
long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));
String campaignName = _T("INSERT_CAMPAIGN_NAME_HERE");
String landingPageName = _T("INSERT_LANDING_PAGE_NAME_HERE");
String url = _T("INSERT_LANDING_PAGE_URL_HERE");
// Create the campaign structure.
Campaign campaign = new Campaign();
campaign.Name = campaignName;
campaign.AdvertiserId = advertiserId;
campaign.Archived = false;
// Set the campaign start date. This example uses today's date.
campaign.StartDate =
DfaReportingDateConverterUtil.convertToDateString(DateTime.Now);
// Set the campaign end date. This example uses one month from today's date.
campaign.EndDate =
DfaReportingDateConverterUtil.convertToDateString(DateTime.Now.AddMonths(1));
// Insert the campaign.
Campaign result =
service.Campaigns.Insert(campaign, profileId, landingPageName, url).Execute();
// Display the new campaign ID.
Console.WriteLine("Campaign with ID {0} was created.", result.Id);
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
loggedInAdmin = Helpers.GetLoggedInAdmin();
currentCompany = Helpers.GetCurrentCompany();
currentAdGroup = Helpers.GetCurrentAdGroup();
currentCampaign = currentAdGroup.campaign_;
if (!Helpers.IsAuthorizedAdmin(loggedInAdmin, currentAdGroup.campaign_.company_))
{
Response.Redirect("/status.aspx?error=notadmin");
}
PopuplateBreadcrumbs();
if (!IsPostBack)
{
UpdateAdGroupHyperLink.NavigateUrl = "/manage/AdGroups/UpdateAdGroupDetails.aspx?adgroup_id=" + currentAdGroup.adgroup_id;
CreateAdMatchesHyperLink.NavigateUrl = "/manage/AdMatches/CreateAdMatches.aspx?adgroup_id=" + currentAdGroup.adgroup_id;
}
PopulateDetails();
ShowAdMatches(currentAdGroup);
}
示例12: Run
/// <summary>
/// Runs the code example.
/// </summary>
/// <param name="user">The AdWords user.</param>
/// <param name="campaignId">Id of the campaign to be removed.</param>
public void Run(AdWordsUser user, long campaignId) {
// Get the CampaignService.
CampaignService campaignService = (CampaignService) user.GetService(
AdWordsService.v201509.CampaignService);
// Create campaign with REMOVED status.
Campaign campaign = new Campaign();
campaign.id = campaignId;
campaign.status = CampaignStatus.REMOVED;
// Create the operation.
CampaignOperation operation = new CampaignOperation();
operation.operand = campaign;
[email protected] = Operator.SET;
try {
// Remove the campaign.
CampaignReturnValue retVal = campaignService.mutate(new CampaignOperation[] {operation});
// Display the results.
if (retVal != null && retVal.value != null && retVal.value.Length > 0) {
Campaign removedCampaign = retVal.value[0];
Console.WriteLine("Campaign with id = \"{0}\" was renamed to \"{1}\" and removed.",
removedCampaign.id, removedCampaign.name);
} else {
Console.WriteLine("No campaigns were removed.");
}
} catch (Exception e) {
throw new System.ApplicationException("Failed to remove campaign.", e);
}
}
示例13: BtnCreate_Click
protected void BtnCreate_Click( object sender, EventArgs e )
{
if ( Page.IsValid ) {
Campaign campaign = new Campaign( StoreId, TxtName.Text );
campaign.Save();
Redirect( WebUtils.GetPageUrl( Constants.Pages.EditCampaign ) + "?id=" + campaign.Id + "&storeId=" + campaign.StoreId );
}
}
示例14: SetUp
public void SetUp()
{
repository = new FakeCampaignRepository();
//((FakeCampaignRepository)repository).SetUpRepository();
campaign = EntityHelpers.GetValidCampaign();
causeTemplate = EntityHelpers.GetValidCauseTemplate();
campaign.CauseTemplate = causeTemplate;
}
示例15: getCampaignById
public Campaign getCampaignById(int id) {
Campaign campaign = new Campaign();
HttpResponseMessage httpResponseMessage = this.httpGet($"{this.getAPIUri()}/campaign/{id}");
if (httpResponseMessage.IsSuccessStatusCode) {
campaign = JsonConvert.DeserializeObject<Campaign>(httpResponseMessage.Content.ReadAsStringAsync().Result);
}
return campaign;
}