/// <summary>
        /// Data for the Partner got loaded and we can determine the Partners' 'Primary E-Mail Address'.
        /// If the Partner has got one we will ask the the E-Mail program to open a new E-Mail with
        /// the Partner's E-Mail address as the recipient of the E-Mail.
        /// </summary>
        /// <param name="Sender">Our instance of <see cref="TUC_PartnerInfo"/>.</param>
        /// <param name="e">Ignored.</param>
        private void PartnerInfoUC_DataLoaded(object Sender, Types.TPartnerKeyData e)
        {
            String PrimaryEmailAddress;

            if (Calculations.GetPrimaryEmailAddress(
                    ((TUC_PartnerInfo)Sender).GetPartnerAttributeData(), out PrimaryEmailAddress))
            {
//            MessageBox.Show(PrimaryEmailAddress.ToString());

                TRtbHyperlinks.DisplayHelper Launcher = new TRtbHyperlinks.DisplayHelper(new TRtbHyperlinks());

                Launcher.LaunchHyperLink(PrimaryEmailAddress, THyperLinkHandling.HYPERLINK_PREFIX_EMAILLINK);
            }
            else
            {
                MessageBox.Show(MPartnerResourcestrings.StrNoPrimaryEmailAvailableToSendEmailTo,
                    MPartnerResourcestrings.StrNoPrimaryEmailAvailableToSendEmailToTitle,
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            // We don't want to get any further notifications (until the 'SendEmailToPartner' Method hooks myself up again!)
            ((TUC_PartnerInfo)Sender).DataLoaded -= PartnerInfoUC_DataLoaded;
        }
        private void LaunchHyperlinkFromValue(object sender, EventArgs e)
        {
            TRtbHyperlinks TempHyperlinkCtrl = new TRtbHyperlinks();
            string LinkType = String.Empty;

            // Don't attempt to launch an 'empty' link
            if (txtValue.Text == String.Empty)
            {
                return;
            }

            // TODO Replace this 'quick solution' when the txtValue Control is replaced with the proper rtbValue Control!
            TRtbHyperlinks.DisplayHelper Launcher = new TRtbHyperlinks.DisplayHelper(TempHyperlinkCtrl);

            switch (FValueKind)
            {
                case TPartnerAttributeTypeValueKind.CONTACTDETAIL_HYPERLINK:
                    LinkType = THyperLinkHandling.HYPERLINK_PREFIX_URLLINK;
                    break;

                case TPartnerAttributeTypeValueKind.CONTACTDETAIL_HYPERLINK_WITHVALUE:
                    TempHyperlinkCtrl.BuildLinkWithValue = BuildLinkWithValue;
                    LinkType = THyperLinkHandling.HYPERLINK_PREFIX_URLWITHVALUELINK;
                    break;

                case TPartnerAttributeTypeValueKind.CONTACTDETAIL_EMAILADDRESS:
                    LinkType = THyperLinkHandling.HYPERLINK_PREFIX_EMAILLINK;
                    break;

                case TPartnerAttributeTypeValueKind.CONTACTDETAIL_SKYPEID:
                    LinkType = THyperLinkHandling.HYPERLINK_PREFIX_SKYPELINK;
                    break;
            }

            Launcher.LaunchHyperLink(txtValue.Text, LinkType);
        }
        private void LaunchHyperlinkEMailWithinOrg(object sender, EventArgs e)
        {
            // TODO Replace this 'quick solution' when the txtValue Control is replaced with the proper rtbValue Control!
            TRtbHyperlinks.DisplayHelper Launcher = new TRtbHyperlinks.DisplayHelper(new TRtbHyperlinks());

            string EmailAddress = cmbEMailWithinTheOrganisation.GetSelectedString();

            // Don't attempt to launch an 'empty' link
            if (EmailAddress == String.Empty)
            {
                return;
            }

            Launcher.LaunchHyperLink(EmailAddress, "||email||");
        }
        private void FileSendEmail(System.Object sender, System.EventArgs e)
        {
            string PrimaryEmailAddress;

            if (Calculations.GetPrimaryEmailAddress(
                    FMainDS.PPartnerAttribute, out PrimaryEmailAddress))
            {
                TRtbHyperlinks.DisplayHelper Launcher = new TRtbHyperlinks.DisplayHelper(new TRtbHyperlinks());

                Launcher.LaunchHyperLink(PrimaryEmailAddress, THyperLinkHandling.HYPERLINK_PREFIX_EMAILLINK);
            }
            else
            {
                MessageBox.Show(MPartnerResourcestrings.StrNoPrimaryEmailAvailableToSendEmailTo,
                    MPartnerResourcestrings.StrNoPrimaryEmailAvailableToSendEmailToTitle,
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 5
0
        private void rtbContactDetails_LinkClicked(string ALinkText, string ALinkType, int ALinkEnd)
        {
            var DisplayHelper = new TRtbHyperlinks.DisplayHelper(rtbContactDetails);

            DisplayHelper.LaunchHyperLink(ALinkText, ALinkType, ALinkEnd);
        }
Esempio n. 6
0
        /// <summary>
        /// Update Contact Details Hyperlink-RichTextBox
        /// </summary>
        private void UpdateControlsContactDetailsData()
        {
            const string LABEL_VALUE_SEPARATOR = ": ";
            string PrimarySuffix = Catalog.GetString("  (Primary)");
            var DisplayHelper = new TRtbHyperlinks.DisplayHelper(rtbContactDetails);
            PartnerInfoTDSPPartnerAttributeRow AttributeDR;
            PPartnerAttributeTypeRow ContactTypeDR;
            DataView ContactDetailsDV;
            TPartnerAttributeTypeValueKind ValueKind;
            int LinkEnd;
            string Filter = String.Format(
                "{0}='{1}' AND {2}='{3}'",
                PartnerEditTDSPPartnerAttributeTable.GetPartnerContactDetailDBName(), true,
                PPartnerAttributeTable.GetCurrentDBName(), true);
            string Sort = "Parent_Parent_CategoryIndex ASC, Parent_AttributeIndex ASC, " +
                          PPartnerAttributeTable.GetIndexDBName() + " ASC";

            rtbContactDetails.Text = String.Empty;

            Calculations.DeterminePartnerContactDetailAttributes(FPartnerInfoDS.PPartnerAttribute);

            Calculations.CreateCustomDataColumnsForAttributeTable(FPartnerInfoDS.PPartnerAttribute,
                FPartnerInfoDS.PPartnerAttributeType);

            ContactDetailsDV = new DataView(FPartnerInfoDS.PPartnerAttribute,
                Filter, Sort, DataViewRowState.CurrentRows);

            for (int Counter = 0; Counter < ContactDetailsDV.Count; Counter++)
            {
                AttributeDR = (PartnerInfoTDSPPartnerAttributeRow)ContactDetailsDV[Counter].Row;

                ContactTypeDR = (PPartnerAttributeTypeRow)FPartnerInfoDS.PPartnerAttributeType.Rows.Find(
                    AttributeDR.AttributeType);

                if (!Enum.TryParse <TPartnerAttributeTypeValueKind>(ContactTypeDR.AttributeTypeValueKind, out ValueKind))
                {
                    // Fallback!
                    ValueKind = TPartnerAttributeTypeValueKind.CONTACTDETAIL_GENERAL;
                }

                switch (ValueKind)
                {
                    case TPartnerAttributeTypeValueKind.CONTACTDETAIL_GENERAL:
                        DisplayHelper.DisplayPlainText(AttributeDR[Calculations.CALCCOLUMNNAME_CONTACTTYPE] + LABEL_VALUE_SEPARATOR, true, false);
                        DisplayHelper.DisplayPlainText(AttributeDR.Value + (AttributeDR.Primary ? PrimarySuffix : String.Empty), true);
                        break;

                    case TPartnerAttributeTypeValueKind.CONTACTDETAIL_HYPERLINK:
                        DisplayHelper.DisplayPlainText(AttributeDR[Calculations.CALCCOLUMNNAME_CONTACTTYPE] + LABEL_VALUE_SEPARATOR, true, false);
                        DisplayHelper.DisplayURL(AttributeDR.Value, false, true);
                        break;

                    case TPartnerAttributeTypeValueKind.CONTACTDETAIL_HYPERLINK_WITHVALUE:
                        DisplayHelper.DisplayPlainText(AttributeDR[Calculations.CALCCOLUMNNAME_CONTACTTYPE] + LABEL_VALUE_SEPARATOR, true, false);
                        LinkEnd = DisplayHelper.DisplayURL(AttributeDR.Value, true, true);

//                        MessageBox.Show(String.Format("Contact Type: {0}; AttributeDR.Value: {1}; LinkEnd: {2}",
//                            AttributeDR[Calculations.CALCCOLUMNNAME_CONTACTTYPE],AttributeDR.Value, LinkEnd));
                        HyperlinkWithValueArguments.Add(AttributeDR.Value + "[[" + LinkEnd + "]]",
                        new Tuple <TPartnerAttributeTypeValueKind, string>(ValueKind, ContactTypeDR.HyperlinkFormat));
                        break;

                    case TPartnerAttributeTypeValueKind.CONTACTDETAIL_EMAILADDRESS:
                        DisplayHelper.DisplayPlainText(AttributeDR[Calculations.CALCCOLUMNNAME_CONTACTTYPE] + LABEL_VALUE_SEPARATOR, true, false);
                        DisplayHelper.DisplayEmailAddress(AttributeDR.Value, true);

                        if (AttributeDR.Primary)
                        {
                            DisplayHelper.DisplayPlainText(PrimarySuffix, true);
                        }

                        break;

                    case TPartnerAttributeTypeValueKind.CONTACTDETAIL_SKYPEID:
                        DisplayHelper.DisplayPlainText(AttributeDR[Calculations.CALCCOLUMNNAME_CONTACTTYPE] + LABEL_VALUE_SEPARATOR, true, false);
                        DisplayHelper.DisplaySkypeID(AttributeDR.Value, true);
                        break;

                    default:
                        throw new Exception("Invalid value for TPartnerAttributeTypeValueKind");
                }
            }
        }