public override void Execute(CommandContext context) { Assert.ArgumentNotNull(context, "context"); string str = context.Parameters["ids"]; TargetAudience ta = Factory.GetTargetAudience(str); if (ta != null) { Item innerItem; if (context.Items.Length == 0) { ManagerRoot managerRoot = UIFactory.Instance.GetSpeakContext().ManagerRoot; if (managerRoot == null) { return; } innerItem = managerRoot.InnerItem; } else { innerItem = context.Items[0]; } ClientPipelineArgs args = new ClientPipelineArgs(); args.Parameters.Add("rid", str); args.Parameters["itemID"] = innerItem.ID.ToString(); string methodName = "Run"; Util.StartClientPipeline(this, methodName, args); } else { NotificationManager.Instance.Notify("MessageFromCommand", new MessageEventArgs("Please select a Recipient List.")); } }
public MessageStateRepository(ManagerRoot managerRoot, MessageStateInfoTypeConverter converter) { Assert.ArgumentNotNull(managerRoot, "managerRoot"); Assert.ArgumentNotNull(converter, "converter"); this.managerRoot = managerRoot; this.converter = converter; }
private bool CreateList(string nameParameter) { nameParameter = nameParameter.Trim(); if (!String.IsNullOrEmpty(nameParameter)) { using (new SecurityDisabler()) { ManagerRoot root = UIFactory.Instance.GetSpeakContext().ManagerRoot; Util.AssertNotNull(root); List <TargetAudience> taList = root.GetTargetAudiences(); List <string> taNames = new List <string>(); foreach (TargetAudience ta in taList) { taNames.Add(ta.Name); } if (taNames.Contains(nameParameter)) { return(false); } Item listsContainerRoot = UIFactory.Instance.GetSpeakContext().ManagerRoot.GetRecipientListContainerItem(); if (listsContainerRoot != null) { TargetAudience ta = TargetAudienceSource.Create(nameParameter, listsContainerRoot, null, null); return(true); } } } return(false); }
public override void Execute(CommandContext context) { Item innerItem; if (context.Items.Length == 0) { ManagerRoot managerRoot = UIFactory.Instance.GetSpeakContext().ManagerRoot; if (managerRoot == null) { return; } innerItem = managerRoot.InnerItem; } else { innerItem = context.Items[0]; } ClientPipelineArgs args = new ClientPipelineArgs(); args.Parameters["itemID"] = innerItem.ID.ToString(); if (context.Parameters["type"] != null) { args.Parameters["type"] = context.Parameters["type"]; } Util.StartClientPipeline(this, "Run", args); }
public List <RecipientListInfo> GetAllRecipientLists() { ManagerRoot root = UIFactory.Instance.GetSpeakContext().ManagerRoot; List <RecipientListInfo> list = new List <RecipientListInfo>(); if (root != null) { List <TargetAudience> taList = root.GetTargetAudiences(); foreach (TargetAudience ta in taList) { string owner = ta.InnerItem.Statistics.CreatedBy; if (String.IsNullOrEmpty(owner)) { owner = ta.InnerItem.Statistics.CreatedBy; } if (String.IsNullOrEmpty(owner)) { owner = "Admin/Unknown"; } if (CurrentUserIsOwner(owner)) { list.Add(new RecipientListInfo() { Key = ta.ID, Name = ta.Name, Owner = owner, Count = ta.SubscribersNames.Count, CreatedDate = ta.InnerItem.Statistics.Created }); } } } return(list); }
public void UnsubscribeFromAll(ContactIdentifier contactIdentifier, ManagerRoot managerRoot) { _clientApiService.UpdateListSubscription(new UpdateListSubscriptionMessage() { ListSubscribeOperation = ListSubscribeOperation.UnsubscribeFromAll, ContactIdentifier = contactIdentifier, MessageId = Guid.Empty, //note: not used for unsubscribeFromAll, so it can be any guid ManagerRootId = managerRoot.Id }); }
// Methods public BestMessagesRepository() { List<string> list = new List<string>(); list.Add("Value"); list.Add("ValuePerVisit"); list.Add("VisitsPerEmail"); list.Add("ValuePerEmail"); this.orderByList = list; this.managerRoot = UIFactory.Instance.GetSpeakContext().ManagerRoot; this.analyticsDataGateway = AnalyticsFactory.Instance.GetAnalyticsDataGateway(); }
// Methods public BestMessagesRepository() { List <string> list = new List <string>(); list.Add("Value"); list.Add("ValuePerVisit"); list.Add("VisitsPerEmail"); list.Add("ValuePerEmail"); this.orderByList = list; this.managerRoot = UIFactory.Instance.GetSpeakContext().ManagerRoot; this.analyticsDataGateway = AnalyticsFactory.Instance.GetAnalyticsDataGateway(); }
private void GetManagerRoot() { var query = $"fast:/sitecore/content//*[@@templateid='{TemplateIds.ManagerRoot}']"; var rootItem = _db.SelectSingleItem(query); if (rootItem == null) { throw new Exception("ManagerRoot not found"); } _managerRoot = ManagerRoot.FromItem(rootItem); }
private static MarketingPreference CreateMarketingPreference(ManagerRoot managerRoot, string preferenceId, bool selectedPreference) { var database = Context.ContentDatabase ?? Context.Database; var marketingPreference = new MarketingPreference { DateTime = DateTime.UtcNow, ManagerRootId = managerRoot.Id, MarketingCategoryId = database.GetItem(new ID(preferenceId)).ID.ToGuid(), Preference = selectedPreference }; return(marketingPreference); }
public void UnsubscribeFromAll(ContactIdentifier contact, ManagerRoot managerRoot) { if (contact == null) { throw new ArgumentNullException(nameof(contact)); } if (managerRoot == null) { throw new ArgumentNullException(nameof(managerRoot)); } _subscribeContactService.HandleContactUnsubscriptionFromAll(contact, managerRoot); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ManagerRoot != null) { hashCode = hashCode * 59 + ManagerRoot.GetHashCode(); } if (HttpServiceFilter != null) { hashCode = hashCode * 59 + HttpServiceFilter.GetHashCode(); } if (DefaultRender != null) { hashCode = hashCode * 59 + DefaultRender.GetHashCode(); } if (Realm != null) { hashCode = hashCode * 59 + Realm.GetHashCode(); } if (Username != null) { hashCode = hashCode * 59 + Username.GetHashCode(); } if (Password != null) { hashCode = hashCode * 59 + Password.GetHashCode(); } if (Category != null) { hashCode = hashCode * 59 + Category.GetHashCode(); } if (Locale != null) { hashCode = hashCode * 59 + Locale.GetHashCode(); } if (Loglevel != null) { hashCode = hashCode * 59 + Loglevel.GetHashCode(); } if (Plugins != null) { hashCode = hashCode * 59 + Plugins.GetHashCode(); } return(hashCode); } }
private List <MarketingPreference> GetMarketingPreferences(ManagerRoot managerRoot) { var marketingPreferences = new List <MarketingPreference>(); if (Tracker.Current == null || Tracker.Current.Contact == null || Tracker.Current.Contact.IsNew) { return(marketingPreferences); } var knownContact = _xConnectContactService.GetXConnectContactByEmailAddress(); if (knownContact != null) { marketingPreferences = _marketingPreferencesService.GetPreferences(knownContact, managerRoot.Id); } return(marketingPreferences); }
private void SubscribeContact(ManagerRoot managerRoot, Guid listId, ContactIdentifier contactIdentifier, List <MarketingPreference> marketingPreferences) { if (_useDoubleOptIn) { // If DoubleOptIn should be used the contact is subscribed to the selected contact list and gets a confirmation mail // The contact is only subscribed to the global contact list, which is used as source for the segmented lists, if he confirms the link in the mail var message = new SubscribeContactMessage { RecipientListId = listId, ContactIdentifier = contactIdentifier, ManagerRootId = managerRoot.Id, SendSubscriptionConfirmation = true, ContextLanguage = Language.Current }; _exmSubscriptionClientApiService.Subscribe(message); } var contact = GetXConnectContactByIdentifer(contactIdentifier); _marketingPreferenceService.SavePreferences(contact, marketingPreferences); }
private bool RenameList(string rid, string nameParameter) { nameParameter = nameParameter.Trim(); if (!String.IsNullOrEmpty(nameParameter)) { using (new SecurityDisabler()) { ManagerRoot root = UIFactory.Instance.GetSpeakContext().ManagerRoot; Util.AssertNotNull(root); List <TargetAudience> taList = root.GetTargetAudiences(); TargetAudience rl = Sitecore.Modules.EmailCampaign.Factory.GetTargetAudience(rid); List <string> taNames = new List <string>(); foreach (TargetAudience ta in taList) { if (ta.Name != rl.Name) { taNames.Add(ta.Name.ToLowerInvariant()); } } if (taNames.Contains(nameParameter.ToLowerInvariant())) { return(false); } if (rl.Name != nameParameter) { using (new EditContext(rl.InnerItem)) { rl.InnerItem.Name = nameParameter; } rl.Source.Name = nameParameter; } return(true); } } return(false); }
public IEnumerable <MarketingPreference> GetSelectedMarketingPreferences(ListViewModel model, ManagerRoot managerRoot, IReadOnlyCollection <MarketingPreference> contactMarketingPreferences) { var preferencesList = new List <MarketingPreference>(); if (model == null || !model.Value.Any()) { return(preferencesList); } foreach (var listFieldItem in model.Items) { if (listFieldItem.Selected) { preferencesList.Add(CreateMarketingPreference(managerRoot, listFieldItem.Value, true)); } else if (contactMarketingPreferences != null && contactMarketingPreferences.Any(x => x.MarketingCategoryId.ToString("B").ToUpper() == listFieldItem.Value)) { preferencesList.Add(CreateMarketingPreference(managerRoot, listFieldItem.Value, listFieldItem.Selected)); } } return(preferencesList); }
private void UnsubscribeFromAll(ContactIdentifier contactIdentifier, ManagerRoot managerRoot) { _saveMarketingPreferencesService.ResetExmKeyBehaviorCache(contactIdentifier); _exmSubscriptionClientApiService.UnsubscribeFromAll(contactIdentifier, managerRoot); }
private bool HandleContactSubscriptionInternal(Guid recipientListId, Contact contact, ManagerRoot managerRoot, bool sendConfirmationMail) { var contactList = _listManagerWrapper.FindById(recipientListId); if (contactList == null) { return(false); } if (contactList.ContactListDefinition.Type == ListType.SegmentedList) { return(false); //note: segmented list is not allowed to subscribe to! } var isSubscribed = _listManagerWrapper.IsSubscribed(recipientListId, contact); if (isSubscribed && !managerRoot.GlobalSubscription.IsInDefaultExcludeCollection(contact)) { return(true); } if (sendConfirmationMail) { return(_subscriptionManager.SendConfirmationMessage(contact, recipientListId, managerRoot)); } var wasSuccessful = true; if (!isSubscribed) { wasSuccessful = _listManagerWrapper.SubscribeContact(recipientListId, contact); } if (!_subscriptionManager.SendSubscriptionNotification(managerRoot, contact)) { var alias = contact.GetAlias(); _logger.LogError($"Failed to send subscription notification to {alias?.ToLogFile()}"); } if (managerRoot.GlobalSubscription.IsInDefaultExcludeCollection(contact) && !_subscriptionManager.RemoveContactFromList(contact, managerRoot.GlobalSubscription.GetGlobalOptOutListId())) { var alias = contact.GetAlias(); _logger.LogError($"Failed to remove {alias?.ToLogFile()} from global opt out list"); } return(wasSuccessful); }
private int round; // round++ when leaderboards are refreshed private void Awake() { interfaceManager = GameObject.FindWithTag("InterfaceTag").GetComponent <InterfaceManager>(); managerRoot = GameObject.FindWithTag("ManagerRootTag").GetComponent <ManagerRoot>(); }
/// <summary> /// Returns true if OrgApacheFelixWebconsoleInternalServletOsgiManagerProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheFelixWebconsoleInternalServletOsgiManagerProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheFelixWebconsoleInternalServletOsgiManagerProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ManagerRoot == other.ManagerRoot || ManagerRoot != null && ManagerRoot.Equals(other.ManagerRoot) ) && ( HttpServiceFilter == other.HttpServiceFilter || HttpServiceFilter != null && HttpServiceFilter.Equals(other.HttpServiceFilter) ) && ( DefaultRender == other.DefaultRender || DefaultRender != null && DefaultRender.Equals(other.DefaultRender) ) && ( Realm == other.Realm || Realm != null && Realm.Equals(other.Realm) ) && ( Username == other.Username || Username != null && Username.Equals(other.Username) ) && ( Password == other.Password || Password != null && Password.Equals(other.Password) ) && ( Category == other.Category || Category != null && Category.Equals(other.Category) ) && ( Locale == other.Locale || Locale != null && Locale.Equals(other.Locale) ) && ( Loglevel == other.Loglevel || Loglevel != null && Loglevel.Equals(other.Loglevel) ) && ( Plugins == other.Plugins || Plugins != null && Plugins.Equals(other.Plugins) )); }
public DispatchedMessageRepository(ManagerRoot managerRoot) { Assert.ArgumentNotNull(managerRoot, "managerRoot"); this.managerRoot = managerRoot; }
public RecentlyDispatchedRepository() { this.managerRoot = UIFactory.Instance.GetSpeakContext().ManagerRoot; this.analyticsFactory = AnalyticsFactory.Instance; }
public bool HandleContactUnsubscriptionFromAll(ContactIdentifier contactIdentifer, ManagerRoot managerRoot) { if (contactIdentifer == null) { throw new ArgumentNullException(nameof(contactIdentifer)); } if (managerRoot == null) { throw new ArgumentNullException(nameof(managerRoot)); } var contact = _xConnectContactService.GetXConnectContact(contactIdentifer, PersonalInformation.DefaultFacetKey, ExmKeyBehaviorCache.DefaultFacetKey, EmailAddressList.DefaultFacetKey, ListSubscriptions.DefaultFacetKey); return(_subscriptionManager.UnsubscribeFromAll(contact, managerRoot)); }