Ejemplo n.º 1
0
        public EventModel(HttpRequest httpRequest)
        {
            if (httpRequest == null)
            {
                return;
            }

            Utm     = UtmHelper.Get(httpRequest);
            Referer = RefererHelper.Get(httpRequest);
        }
Ejemplo n.º 2
0
        public static void SaveBulkEmailHyperlinks(Guid bulkEmailId, string templateBody, bool replace,
                                                   UserConnection userConnection)
        {
            if (replace)
            {
                ClearBulkEmailHyperlinks(bulkEmailId, userConnection);
            }
            if (string.IsNullOrEmpty(templateBody))
            {
                return;
            }

            IDictionary <string, string> hyperlinks = MailingUtilities.ParseHtmlHyperlinks(templateBody);

            foreach (KeyValuePair <string, string> hyperlink in hyperlinks)
            {
                try {
                    if (HasMacros(hyperlink.Key))
                    {
                        continue;
                    }
                    string decodeUrl = HttpUtility.UrlDecode(hyperlink.Key);
                    string url       = UtmHelper.RemoveUtmFromUri(decodeUrl);
                    string caption   = string.IsNullOrEmpty(hyperlink.Value) ? url : hyperlink.Value;
                    decodeUrl = HttpUtility.UrlDecode(url.ToLower());
                    Guid hashLink           = MailingUtilities.GetMD5HashGuid(decodeUrl);
                    var  bulkEmailHyperlink = new BulkEmailHyperlink(userConnection);
                    Dictionary <string, object> conditions = new Dictionary <string, object> {
                        { "BulkEmail", bulkEmailId },
                        { "Hash", hashLink }
                    };
                    if (!bulkEmailHyperlink.FetchFromDB(conditions))
                    {
                        bulkEmailHyperlink.SetDefColumnValues();
                        bulkEmailHyperlink.BulkEmailId = bulkEmailId;
                        bulkEmailHyperlink.Caption     = caption;
                        bulkEmailHyperlink.Url         = url;
                        bulkEmailHyperlink.Hash        = hashLink;
                        bulkEmailHyperlink.Save();
                    }
                } catch (Exception e) {
                    MailingUtilities.Log.ErrorFormat(
                        "[BulkEmailHyperlinkHelper.SaveBulkEmailHyperlinks]: Error while saving BulkEmailHyperlink" +
                        " \"{0}\" for BulkEmail with Id: {1}", e, hyperlink, bulkEmailId);
                }
            }
        }
Ejemplo n.º 3
0
        private string GetTemplate(BulkEmail bulkEmail, IMessageInfo messageInfo, List <image> messageImages,
                                   MarketingMacrosHelper macrosHelper)
        {
            string templateBodyWithMacros = macrosHelper.SetTemplateBody(bulkEmail.TemplateBody,
                                                                         bulkEmail.OwnerId, bulkEmail.Id, messageInfo.ApplicationUrl);
            string templateCode = InlineimagesProcessing(templateBodyWithMacros, messageImages, messageInfo.ApplicationUrl);

            if (string.IsNullOrEmpty(templateCode))
            {
                return(string.Empty);
            }
            templateCode = UtmHelper.GetTemplateCodeWithUtmLabel(bulkEmail.ConvertToUtmData(templateCode),
                                                                 messageInfo.MessageRId, macrosHelper.UnsubscribeMacrosAliases);
            int templateSize = MandrillUtilities.GetTemplateSize(templateCode, messageImages);

            return(templateSize > MandrillMaxTemplateSize ? string.Empty : templateCode);
        }
Ejemplo n.º 4
0
        private void SaveHyperlink(Guid bulkEmailId, HyperlinkData hyperlink)
        {
            var url            = UtmHelper.RemoveUtmFromUri(hyperlink.Url);
            var query          = GetParams(url);
            var bpmTrackId     = GetIntParameterValue(query, _trackIdQueryParameterName);
            var bpmReplicaMask = GetIntParameterValue(query, _replicaQueryParameterName);
            var caption        = string.IsNullOrEmpty(hyperlink.Caption) ? url : hyperlink.Caption;
            var insert         = new Insert(_userConnection)
                                 .Into(_bulkEmailHyperlinkTableName)
                                 .Set("BulkEmailId", Column.Parameter(bulkEmailId))
                                 .Set("Caption", Column.Parameter(caption))
                                 .Set("Url", Column.Parameter(url))
                                 .Set("BpmReplicaMask", Column.Parameter(bpmReplicaMask))
                                 .Set("BpmTrackId", Column.Parameter(bpmTrackId));

            SetAdditionalColumns(insert, hyperlink.AdditionalColumns);
            insert.Execute();
        }