protected void EmailContextMenuClick(object sender, RadMenuEventArgs e) { String UserID = Util.GetUserId(); String ActionCode = e.Item.Value; Contact c = new Contact(ContactID); bool Refresh = true; switch (ActionCode) { case "v": c.ToggleEmailVerified(UserID); break; // verify case "r": c.RemoveEmailAddress(UserID); break; // remove case "ree": c.RemoveEmailEstimated(); break; // remove email estimated flag case "est_dg": EstimateEmailWithDataGeek(c); Refresh = false; break; // estimate with dg case "est_eh": EstimateEmailEmailHunter(c); Refresh = false; break; // estimate with email hunter case "oo": c.ToggleEmailOptedOut(); break; // toggle opted out case "oi": c.ToggleEmailOptedIn(); break; // toggle opted in case "ro": c.RemoveOptedStatus(); break; // remove opted case "b": c.MarkEmailAsBounced(); break; // mark as bounced case "sub": Refresh = false; break; // mag subs parent node, cancel default: e.Item.Enabled = false; e.Item.ImageUrl = "~/images/leads/ico_verified.png"; MailChimpAPI.AddSubscriberToList(ActionCode, c.WorkEmail, c.FirstName, c.LastName); Util.PageMessageAlertify(this, "Subscription Added", "Subscribed"); Refresh = false; break; // magazine subscriptions } if (Refresh) { RefreshParent(); } }
public void ConfigureControl(bool FromContactManager, String ParentRefreshMethodName, String ContactID, String LeadID = null) { this.ContactID = ContactID; this.LeadID = LeadID; this.ParentRefreshMethodName = ParentRefreshMethodName; this.FromContactManager = FromContactManager; if (!String.IsNullOrEmpty(ContactID)) { Contact c = new Contact(ContactID); String WorkEmail = c.WorkEmail; String PersonalEmail = c.PersonalEmail; bool EmailVerified = c.EmailVerified; bool EmailEstimated = c.EmailEstimated; bool EstimatedWithDataGeek = c.EmailEstimatedWithDataGeek; bool EstimatedWithEmailHunter = c.EmailEstimatedWithHunter; bool OptedOut = c.OptOut; bool OptedIn = c.OptIn; rcm_e.Items.Clear(); img_s.Visible = false; if (WorkEmail != String.Empty) { // Copy to clipboard RadMenuItem rmi_cpy = new RadMenuItem(" Copy E-mail to Clipboard") { Value = "c", ImageUrl = "~/images/leads/ico_clipboard.png" }; rmi_cpy.Attributes.Add("onclick", "CopyToClipboard('" + WorkEmail + "');"); rcm_e.Items.Add(rmi_cpy); hl_email.NavigateUrl = "mailto:" + WorkEmail; hl_email.Text = WorkEmail; img_s.Visible = true; if (EmailVerified) { String VerifiedToolTip = "This e-mail address has been verified."; hl_email.CssClass = "EmailVerified"; hl_email.ToolTip = img_s.ToolTip = VerifiedToolTip; img_s.ImageUrl = "~/images/leads/ico_verified.png"; rcm_e.Items.Add(new RadMenuItem(" De-Verify E-mail Address") { Value = "v", ImageUrl = "~/images/leads/ico_unknown.png" }); } else { String NotVerifiedToolTip = "This e-mail address has not been verified yet."; hl_email.ToolTip = img_s.ToolTip = NotVerifiedToolTip; hl_email.CssClass = String.Empty; img_s.ImageUrl = "~/images/leads/ico_unknown.png"; rcm_e.Items.Add(new RadMenuItem(" Verify E-mail Address") { Value = "v", ImageUrl = "~/images/leads/ico_verified.png" }); } if (EmailEstimated && !EmailVerified) { String EstimatedToolTip = String.Empty; if (EstimatedWithEmailHunter) { EstimatedToolTip = "This e-mail address has been estimated with E-mail Hunter."; hl_email.CssClass = "EmailEstimatedEH"; img_s.ImageUrl = "~/images/leads/ico_hunter.png"; } else if (EstimatedWithDataGeek) { EstimatedToolTip = "This e-mail address has been estimated with DataGeek."; hl_email.CssClass = "EmailEstimatedDG"; img_s.ImageUrl = "~/images/leads/ico_datageek_small.png"; } rcm_e.Items.Add(new RadMenuItem(" Remove 'Estimated E-mail' Flag") { Value = "ree", ImageUrl = "~/images/leads/ico_blue_tick.png" }); hl_email.ToolTip = img_s.ToolTip = EstimatedToolTip; } // Delete e-mail RadMenuItem rmi_d = new RadMenuItem(" Remove E-mail Address") { Value = "r", ImageUrl = "~/images/leads/ico_delete.png" }; rcm_e.Items.Add(rmi_d); // Toggle opting in/out //if (!OptedIn) //{ // RadMenuItem rmi_oi = new RadMenuItem(" Mark E-mail as Opted In to Mailers") { Value = "oi", ImageUrl = "~/images/leads/ico_exclaim_green.png" }; // rcm_e.Items.Add(rmi_oi); //} //if (!OptedOut) //{ // RadMenuItem rmi_oo = new RadMenuItem(" Mark E-mail as Opted Out from Mailers") { Value = "oo", ImageUrl = "~/images/leads/ico_exclaim_red.png" }; // rcm_e.Items.Add(rmi_oo); //} //if (OptedOut || OptedIn) //{ // RadMenuItem rmi_ro = new RadMenuItem(" Mark E-mail as Neutral Regarding Mailers") { Value = "ro", ImageUrl = "~/images/leads/ico_exclaim_yellow.png" }; // rcm_e.Items.Add(rmi_ro); //} //// Mark as bounced //RadMenuItem rmi_b = new RadMenuItem(" Mark E-mail as Bounced") { Value = "b", ImageUrl = "~/images/leads/ico_shuffle.png" }; //rcm_e.Items.Add(rmi_b); // Magazine subscriptions if (EnableMagazineSubscriptionOption) { RadMenuItem rmi_subs = new RadMenuItem(" Magazine Subscriptions") { Value = "sub", ImageUrl = "~/images/leads/ico_feed.png" }; rcm_e.Items.Add(rmi_subs); if (MailChimpAPI.Lists != null) { foreach (MailChimp.Net.Models.List list in MailChimpAPI.Lists) { String ImageURL = "~/images/leads/ico_feed.png"; String Sub = "Subscribe " + Server.HtmlEncode(c.FirstName); bool AlreadyInList = MailChimpAPI.IsEmailInList(list.Id, c.WorkEmail); if (AlreadyInList) { ImageURL = "~/images/leads/ico_verified.png"; Sub = "Already subscribed"; } rmi_subs.Items.Add(new RadMenuItem() { Text = " " + Sub + " to <b>" + Server.HtmlEncode(MailChimpAPI.GetBeautifiedListNameByListID(list.Id)) + "</b> (" + Util.CommaSeparateNumber(MailChimpAPI.GetListSubscriberCountByListID(list.Id), false) + " Subs)", Value = list.Id, ImageUrl = ImageURL, Enabled = !AlreadyInList }); } } else { rmi_subs.Enabled = false; } } } else if (PersonalEmail != String.Empty) { hl_email.NavigateUrl = "mailto:" + PersonalEmail; hl_email.Text = PersonalEmail + " (pers.)"; } else { hl_email.Text = Server.HtmlEncode(NoEmailText); hl_email.CssClass = "NoEmail HandCursor"; //// add e-mail hunter search //RadMenuItem rmi_eh = new RadMenuItem(" Estimate E-mail with E-mail Hunter"); //rmi_eh.Value = "est_eh"; //rmi_eh.ToolTip = "Click to have E-mail Hunter estimate this contact's business e-mail." + Environment.NewLine // + "E-mail will be estimated using company name, website, first and last name," + Environment.NewLine + "and where possible, any other e-mail domain names found for this company."; //rmi_eh.ImageUrl = "~/images/leads/ico_hunter.png"; //rcm_e.Items.Add(rmi_eh); // add datageek email builder rcm_e.Items.Add(new RadMenuItem(" Estimate E-mail with DataGeek") { Value = "est_dg", ImageUrl = "~/images/leads/ico_datageek_small.png", Enabled = true }); } // view email history RadMenuItem rmi_emh = new RadMenuItem(" View Contact E-mail History") { Value = "h", ImageUrl = "~/images/leads/ico_history.png", Enabled = true }; if (rmi_emh.Enabled) { rmi_emh.Attributes.Add("onclick", "var t='Contact E-mail History'; var rw=rwm_master_radopen('/dashboard/leads/viewcontactemailhistory.aspx?ctc_id=" + ContactID + "',t); if(rw!=null) rw.set_title(t); return false;"); } rcm_e.OnClientItemClicking = "function f(s,e){$find('" + rcm_e.ClientID + "').hide();var v=e.get_item().get_value();if(v=='h' || v=='c')e.set_cancel(true);else if(v=='r'){" + "if(!confirm('Are you sure?'))e.set_cancel(true);}}"; rcm_e.Items.Add(rmi_emh); hl_email.ToolTip += Environment.NewLine + "Right-click for e-mail options."; } }