public static string ToPriceLabel(this CampaignType type) { //if (type == CampaignType.ShareContent || type == CampaignType.ShareContentWithCaption || type == CampaignType.ReviewProduct || type == CampaignType.ShareStreamUrl) //{ // return "/người/lần"; //} if (type == CampaignType.ShareContentWithCaption || type == CampaignType.ReviewProduct || type == CampaignType.ShareStreamUrl) { return("/người/lần"); } if (type == CampaignType.ChangeAvatar) { return("/người/tuần"); } //if (type == CampaignType.ShareContent || type == CampaignType.ShareContentWithCaption) //{ // return "/người/lần"; //} if (type == CampaignType.ShareContentWithCaption) { return("/người/lần"); } if (type == CampaignType.CustomService || type == CampaignType.JoinEvent) { return(""); } return(type.ToString()); }
/// <summary> /// Create a new campaign /// <param name="campaignType">Possible Value : regular, plaintext, absplit, rss, variate </param> /// <param name="CampaignRecipient"></param> /// <param name="campaignTracking"></param> /// <param name="campaignTracking"></param> /// </summary> public async Task <dynamic> CreateCampaignAsync(CampaignType campaignType, Recipients CampaignRecipient, Settings campaignSettings, Tracking campaignTracking) { return(await overview.CreateCampaignAsync(campaignType, CampaignRecipient, campaignSettings, campaignTracking)); }
public bool Validate(string fieldValue, CampaignType type, int rowNumber) { if (String.IsNullOrEmpty(fieldValue)) { AddError(new CampaignValidationMessage("-", CampaignError.ReceipientEmpty, rowNumber)); return false; } else { if (type == CampaignType.Email) { if (Regex.IsMatch(fieldValue, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$")) return true; else AddError(new CampaignValidationMessage(fieldValue, CampaignError.EmailFieldError, rowNumber)); return false; } else { fieldValue = fieldValue.Replace("+", "").Replace("-", "").Replace(" ", ""); //if (Regex.IsMatch(fieldValue, @"^(\+97[\s]{0,1}[\-]{0,1}[\s]{0,1}1|0)5[\s]{0,1}[\-]{0,1}[\s]{0,1}[0-9]{1}[0-9]{7}$")) if (Regex.IsMatch(fieldValue, @"(9715)([0-9]{8})|(05)([0-9]{8})|(5)([0-9]{8})")) return true; else AddError(new CampaignValidationMessage(fieldValue, CampaignError.MobileFieldError, rowNumber)); return false; } } }
public async Task <bool> UpdateIgnoreCampaignTypes(int accountid, CampaignType type, bool removed, string username) { var account = await _accountRepository.GetByIdAsync(accountid); if (account != null) { var currentIgnore = account.IgnoreCampaignTypesObj; if (removed) { currentIgnore.Remove(type); } else { currentIgnore.Add(type); } var ignoreCampaignTypeStr = currentIgnore.Select(m => (int)m).ToList().ToListInt(); account.IgnoreCampaignTypes = ignoreCampaignTypeStr; account.DateModified = DateTime.Now; account.UserModified = username; await _accountRepository.UpdateAsync(account); return(true); } return(false); }
/// <summary> /// Create a new campaign /// <param name="campaignType">Possible Value : regular, plaintext, absplit, rss, variate </param> /// <param name="CampaignRecipient"></param> /// <param name="campaignTracking"></param> /// <param name="campaignTracking"></param> /// </summary> public async Task<dynamic> CreateCampaignAsync(CampaignType campaignType, Recipients CampaignRecipient, Settings campaignSettings, Tracking campaignTracking) { return await overview.CreateCampaignAsync(campaignType, CampaignRecipient, campaignSettings, campaignTracking); }
public Stream Create(CampaignType type, string subject, string from, string fromName, string language, IEnumerable <int> groups, object abSettings) { if (type == CampaignType.regular) { if (subject.IsNullOrEmpty()) { throw new MailerLiteException("If the campaign type is regular the subject is required."); } } if (type == CampaignType.ab) { if (abSettings.IsNull()) { throw new MailerLiteException("If the campaign type is ab the ab_settings object is required."); } } if (groups.Count() == 0) { throw new MailerLiteException("Groups ids are required"); } return(this.Http.Post(Url, new { subject = subject, from = from, fromName = fromName, language = language, groups = groups, abSettings = abSettings }, HttpContentTypes.ApplicationJson).ResponseStream); }
/// <summary> /// Create a new campaign /// <param name="type">Possible Value : regular, plaintext, absplit, rss, variate </param> /// <param name="recipients">List settings for the campaign.</param> /// <param name="settings">The settings for your campaign, including subject, from name, reply-to address, and more.</param> /// <param name="tracking">The tracking options for a campaign.</param> /// </summary> public async Task <dynamic> CreateCampaignAsync(CampaignType type, Recipients recipients, Settings settings, Tracking tracking) { return(await overview.CreateCampaignAsync(type, recipients, settings, tracking)); }
public Campaign CreateCampaign(string code, string name, MailFrequency frequency, Newsletter fixedNewsletter, string dynamicCode, DateTime?startDate, DateTime?endDate, CampaignStatus status, CampaignType type) { CampaignDao cd = new CampaignDao(sessionFactoryConfigPath); if (cd.GetByCode(applicationName, code) != null) { throw new ApplicationException( string.Format("There is already a campaign with the code {{{0}}} on the application {{{1}}}", code, applicationName)); } Campaign c = new Campaign(); c.ApplicationName = applicationName; c.Code = code; c.Name = name; c.StartDate = startDate; c.EndDate = endDate; c.DynamicCode = dynamicCode; c.Frequency = frequency; c.FixedNewsletter = fixedNewsletter; c.Status = status; c.Type = type; cd.Save(c); return(c); }
public async Task <IActionResult> Edit(short id, [Bind("Id,CampaignType1")] CampaignType campaignType) { if (id != campaignType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(campaignType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CampaignTypeExists(campaignType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(campaignType)); }
public async Task <IActionResult> UpdateCampaignAccountRef(int campaignid, CampaignType campaignType) { if (campaignType == CampaignType.ChangeAvatar) { return(RedirectToAction("SubmmitCampaignAccountChangeAvatar", new { campaignid })); } var campaignAccount = await _campaignService.GetCampaignAccountByAccount(CurrentUser.Id, campaignid); if (campaignAccount == null) { return(PartialView()); } if ((campaignAccount.Status == CampaignAccountStatus.Confirmed || campaignAccount.Status == CampaignAccountStatus.DeclinedContent) && campaignType == CampaignType.ShareContentWithCaption) { return(RedirectToAction("SubmitCampaignAccountRefContent", new { campaignid })); } return(PartialView(new UpdateCampaignAccountRefViewModel() { CampaignId = campaignid, CampaignType = campaignType })); }
/// <summary> /// Retrieves all the campaigns that exist within a specified account. /// https://msdn.microsoft.com/en-US/library/bing-ads-campaign-management-getcampaignsbyaccountid.aspx /// </summary> /// <param name="auth">Do not use ApiAuthentication directly. Use PasswordAuthentication or OAuthAuthentication derives from it instead.</param> /// <param name="accountId">The identifier of the account that contains the campaigns to get.</param> /// <param name="campaignType">The type of campaign to get. You can specify one or more types. /// https://msdn.microsoft.com/en-US/library/bing-ads-campaign-management-campaigntype.aspx /// </param> /// <param name="customerId">The identifier of the customer that owns the account. /// Note: Required for service operations related to targeting and editorial. As a best practice you should always specify this element.</param> /// <returns></returns> public GetCampaignsByAccountIdResponse GetCampaignsByAccountId( ApiAuthentication auth, long accountId, CampaignType campaignType, long?customerId = null) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType, CustomerAccountId = string.Format("{0}", accountId), CustomerId = string.Format("{0}", customerId), }; try { SetAuthHelper.SetAuth(auth, request); return(Check().GetCampaignsByAccountId(request)); } catch (Exception ex) { Log(new LogEventArgs(ServiceType.CampaignManagement, "GetCampaignsByAccountId", ex.Message, new { Request = request }, ex)); } return(null); }
/// <summary> /// Get the current campaignType of a campaignType. The cache is not bypassed by default. /// </summary> /// <param name="campaignTypeId">The campaignType identifier</param> /// <param name="noCache">Bypass the cache</param> /// <param name="refreshCache">Force refresh the cache</param> /// <returns>A campaignType</returns> public CampaignType GetCampaignType(int campaignTypeId, bool noCache, bool refreshCache) { // If no cache the load and return a entity from the database if (noCache && !refreshCache) { return(LoadCampaignType(campaignTypeId)); } CampaignType campaignType; string cacheKey = CampaignType.GetCacheKeyById(campaignTypeId); if (!CacheManagerProvider.GetCacheManagerInstance().Contains <CampaignType>(cacheKey) || refreshCache) { // Load the entity from the database campaignType = LoadCampaignType(campaignTypeId); if (campaignType != null) { // Add the entity to the cache by reading caching parameters from the configuration CacheManagerProvider.GetCacheManagerInstance().Insert(cacheKey, campaignType, ConfigurationManager.GetCacheExpirationByType( campaignType.GetType())); } } else { campaignType = CacheManagerProvider.GetCacheManagerInstance().Get <CampaignType>(cacheKey); } return(campaignType); }
public GetCampaignsByAccountIdResponse TryGetCampaignsByAccountId( ApiAuthentication auth, long accountId, CampaignType campaignType, long?customerId = null) { return(MethodHelper.TryGet(GetCampaignsByAccountId, this, auth, accountId, campaignType, customerId)); }
public Language(LanguageType type, LanguageType script, CampaignType campaign, string displayName, bool isExotic) { this.Type = type; this.Script = script; this.Campaign = campaign; this.DisplayName = displayName; this.IsExotic = isExotic; }
public ActionResult DeleteConfirmed(int id) { CampaignType campaignType = db.CampaignTypes.Find(id); db.CampaignTypes.Remove(campaignType); db.SaveChanges(); return(RedirectToAction("Index")); }
public void setup(CampaignType value, HomeScreenController controller) { this.homeScreenController = controller; this.value = value; Text myText = this.transform.GetChild(0).GetComponent <Text>(); myText.text = this.value.ToString(); }
public void updateCampaignType(CampaignTypeButton campaignButton) { this.campaignType = campaignButton.value; foreach (CampaignTypeButton b in this.campaignTypeButtons) { b.forceTurnOn(); } campaignButton.forceTurnOff(); }
public ActionResult Edit([Bind(Include = "ID,Type")] CampaignType campaignType) { if (ModelState.IsValid) { db.Entry(campaignType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(campaignType)); }
public async Task <IActionResult> Create([Bind("Id,CampaignType1")] CampaignType campaignType) { if (ModelState.IsValid) { _context.Add(campaignType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(campaignType)); }
public ActionResult Create([Bind(Include = "ID,Type")] CampaignType campaignType) { if (ModelState.IsValid) { db.CampaignTypes.Add(campaignType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(campaignType)); }
/// <summary> /// Gets campaigns of the specified type for the account. /// </summary> /// <param name="accountId"></param> /// <param name="campaignType"></param> /// <returns></returns> private async Task <IList <Campaign> > GetCampaignsByAccountIdAsync( long accountId, CampaignType campaignType) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType }; return((await CampaignService.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)).Campaigns); }
public static ICampaign GetCampaign(CampaignType type) { switch (type) { case CampaignType.Marx: return(new CampaignType1()); case CampaignType.Arendt: return(new CampaignType2()); default: throw new NotSupportedException(); } }
public async Task <IActionResult> RenewAccount(IEnumerable <AccountType> accountTypes, IEnumerable <int> categoryid, Gender?gender, IEnumerable <int> cityid, int?agestart, int?ageend, IEnumerable <int> ignoreIds, CampaignType campaignType, int min = 0, int max = 0) { ViewBag.CampaignType = campaignType; ViewBag.AccountTypes = accountTypes; ViewBag.Min = min; ViewBag.Max = max; var model = await _accountService.GetListAccount(accountTypes, categoryid, gender, cityid, agestart, ageend, string.Empty, 1, 1, ignoreIds, min, max); return(PartialView(model)); }
// GET: CampaignTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CampaignType campaignType = db.CampaignTypes.Find(id); if (campaignType == null) { return(HttpNotFound()); } return(View(campaignType)); }
// Retrieves all the requested campaign types in the account. private async Task <GetCampaignsByAccountIdResponse> GetCampaignsByAccountIdAsync( long accountId, CampaignType campaignType, CampaignAdditionalField returnAdditionalFields) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType, ReturnAdditionalFields = returnAdditionalFields }; return(await CampaignService.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)); }
public CampaignTypeTests() { var schema = SchemaBuilder.New() .AddAuthorizeDirectiveType() .AddType <CampaignType>() .ModifyOptions(o => o.StrictValidation = false) .Create(); _campaignType = schema.GetType <CampaignType>("Campaign"); _expectedFields = new List <string>() { "campaignId", "name", "userId", "description" }; }
// Gets one or more campaigns for the specified campaign identifiers. private async Task <IList <Campaign> > GetCampaignsByIdsAsync( long accountId, IList <long> campaignIds, CampaignType campaignType, CampaignAdditionalField returnAdditionalFields) { var request = new GetCampaignsByIdsRequest { AccountId = accountId, CampaignIds = campaignIds, CampaignType = campaignType, ReturnAdditionalFields = returnAdditionalFields }; return((await Service.CallAsync((s, r) => s.GetCampaignsByIdsAsync(r), request)).Campaigns); }
public async Task <int> GetAcountChargeAmount(int accountid, CampaignType campaignType) { var filter = new AccountCampaignChargeByAccountSpecification(accountid, campaignType); var accountCharge = await _accountCampaignChargeRepository.GetSingleBySpecAsync(filter); if (accountCharge != null) { var settings = await _settingRepository.GetSetting(); //return settings.GetAccountChagreAmount(accountCharge.AccountChargeAmount); return(settings.GetAccountChagreAmount(20000)); } return(0); }
/// <summary> /// http://apidocs.mailchimp.com/api/2.0/campaigns/create.php /// </summary> /// <returns></returns> public Task<MailChimpServiceResponse> CreateAsync(CampaignType type, ContentOption contentOption) { var url = Urls.Campaign + "create.json"; var request = new { type = type, // options = option, content = contentOption, // segment_opts = segmentOptions, // type_opts = typeOptions, // auto = autoReponders }; return Execute(url, request); }
/// <summary> /// /// </summary> /// <param name="campaignType"></param> /// <returns></returns> public int Create(CampaignType campaignType = null) { CreateCampaignResp _create = null; try { if (_create == null) { var req = new CreateCampaignReq() { header = Client.RequestHeader }; if (campaignType != null) { req.campaignType = campaignType; } _create = _client.API.CreateCampaign(req); } if (_create != null && _create.errorCode == (int)errorCode.No_error) { return(_create.campaignId); } else if (_create != null) { throw new FlexMailException(FlexMail.Resources.Campaign.ResourceManager.GetString("Update_" + _create.errorCode), _create.errorCode); } throw new FlexMailException(FlexMail.Resources.Blacklist.ResourceManager.GetString("Update_" + _create.errorCode), _create.errorCode); } catch (Exception ex) { //telemetry.TrackException(ex, new Dictionary<string, string> { { "Flexmail", "Campaign.Create" } }); if (ex is FlexMailException) { throw (ex); } } finally { _create = null; } return(-1); }
/// <summary> /// Create a new campaign /// <param name="campaignType">Possible Value : regular, plaintext, absplit, rss, variate </param> /// <param name="CampaignRecipient"></param> /// <param name="campaignTracking"></param> /// <param name="campaignTracking"></param> /// </summary> internal async Task <dynamic> CreateCampaignAsync(CampaignType campaignType, Recipients CampaignRecipient, Settings campaignSettings, Tracking campaignTracking) { string endpoint = Authenticate.EndPoint(TargetTypes.campaigns, SubTargetType.not_applicable, SubTargetType.not_applicable); Campaign campaignObject = new Campaign() { type = campaignType.ToString(), recipients = CampaignRecipient, settings = campaignSettings, tracking = campaignTracking }; return(await BaseOperation.PostAsync <Campaign>(endpoint, campaignObject)); }
/// <summary> /// Create a new campaign /// <param name="campaignType">Possible Value : regular, plaintext, absplit, rss, variate </param> /// <param name="CampaignRecipient"></param> /// <param name="campaignTracking"></param> /// <param name="campaignTracking"></param> /// </summary> internal async Task<dynamic> CreateCampaignAsync(CampaignType campaignType, Recipients CampaignRecipient, Settings campaignSettings, Tracking campaignTracking ) { string endpoint = Authenticate.EndPoint(TargetTypes.campaigns, SubTargetType.not_applicable, SubTargetType.not_applicable); Campaign campaignObject = new Campaign() { type = campaignType.ToString(), recipients = CampaignRecipient, settings= campaignSettings, tracking= campaignTracking }; return await BaseOperation.PostAsync<Campaign>(endpoint, campaignObject); }
public Campaign GetDefault(int accountId, CampaignType type) { var filter = string.Format("$filter=(IsDefault eq true) and (CampaignTypeId eq {0})", (int)type); var request = TDClient.BuildRequest(Method.GET, LIST, new { accountId, onlyMine = true }, filter: filter); var response = TDClient.InnerExecute(request); var rval = TDClient.ProcessListResponse <Campaign>(request, response, false); if (rval == null) { return(null); } else { return(rval.FirstOrDefault()); } }
public static int GetInteractiveMin(this CampaignType type) { //if (type == CampaignType.ShareContent) //{ // return 0; //} if (type == CampaignType.ShareContentWithCaption) { return(100); } if (type == CampaignType.ReviewProduct) { return(200); } return(0); }
public MailChimpServiceResponse Create(CampaignType type, ContentOption contentOption) { return WaitForServiceResponse(CreateAsync(type, contentOption)); }
public void Clear() { EditedCampaignId = Guid.Empty; EditedCampaignType = CampaignType.Undefined; ConcreteCampaign = null; }
public ITrackLogic GetTrackLogicByType(CampaignType campaignType) { return _trackLogic.FirstOrDefault(x => x.CampaignType == campaignType.ToString()); }
public CampaignVM(CampaignType campaignType) { TypeId = (int)campaignType; }
public ICampaignLogic GetCampaignLogicByType(CampaignType type) { return _campaignLogic.FirstOrDefault(x => x.CampaignType == type.ToString()); }
public ActionResult LoadCampaignForUpdate(CampaignType campaignType) { switch (campaignType) { case CampaignType.PriceByProductCampaign: { return PartialView("CampaignPartial/PriceByProductCampaign"); } case CampaignType.PercentByProductSetCampaign: { return PartialView("CampaignPartial/PercentByProductSetCampaign"); } case CampaignType.PersonalCampaign: { return PartialView("CampaignPartial/PersonalCampaign"); } } return PartialView("CampaignPartial/PriceByProductCampaign"); }
// Gets campaigns of the specified type for the account. private async Task<IList<Campaign>> GetCampaignsByAccountIdAsync( long accountId, CampaignType campaignType) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType }; return (await Service.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)).Campaigns; }
// Retrieves all the requested campaign types in the account. private async Task<GetCampaignsByAccountIdResponse> GetCampaignsByAccountIdAsync( long accountId, CampaignType campaignType, CampaignAdditionalField returnAdditionalFields) { var request = new GetCampaignsByAccountIdRequest { AccountId = accountId, CampaignType = campaignType, ReturnAdditionalFields = returnAdditionalFields }; return (await CampaignService.CallAsync((s, r) => s.GetCampaignsByAccountIdAsync(r), request)); }