public static List <string> GetReferencedDeals(Microsoft.Office.Interop.Word.Document document)
        {
            var deals = new List <string>();

            foreach (var current in document.Hyperlinks)
            {
                var hyperlink = current as Hyperlink;
                if (hyperlink == null)
                {
                    break;
                }
                if (DealsDrugsCompaniesControl.IsADealHyperlink(hyperlink))
                {
                    if (!string.IsNullOrEmpty(hyperlink.TextToDisplay))
                    {
                        string deal = Regex.Match(hyperlink.TextToDisplay, DealsDrugsCompaniesControl.DealRegex).Groups[1].ToString();
                        if (!deals.Contains(deal))
                        {
                            deals.Add(deal);
                        }
                    }
                    else
                    {
                        string deal = Regex.Match(hyperlink.Range.Text, DealsDrugsCompaniesControl.DealRegex).Groups[1].ToString();
                        if (!deals.Contains(deal))
                        {
                            deals.Add(deal);
                        }
                    }
                }
            }
            return(deals);
        }
Beispiel #2
0
 private void IntelligenceProductsBtn_Click(object sender, RibbonControlEventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     try
     {
         DealsDrugsCompaniesControl myUserControl = new DealsDrugsCompaniesControl();
         CheckLoginAndPerformAction(myUserControl, "Intelligence Products");
     }
     catch
     {
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
 /// <summary>
 /// Hyperlinks that should be transformed are those that author inputs,
 /// not a related article, not a sidebar, and not a deal.
 /// </summary>
 /// <param name="currentHyperlink"></param>
 /// <returns></returns>
 private static bool ShouldNotTransformHyperlink(Hyperlink currentHyperlink)
 {
     return(ArticlesSidebarsControl.IsArticleOrSidebarHyperlink(currentHyperlink) ||
            DealsDrugsCompaniesControl.IsADealHyperlink(currentHyperlink));
 }