コード例 #1
0
        public void Validate(string recipient, string subject)
        {
            var rHelper = new RecipientHelper();

            if (!rHelper.ValidRecipient(recipient))
            {
                throw new ArgumentException(ResourceHelper.Resources[3].Text);
            }

            if (string.IsNullOrEmpty(subject))
            {
                throw new ArgumentException(ResourceHelper.Resources[5].Text);
            }
        }
コード例 #2
0
ファイル: MessageValidator.cs プロジェクト: majidgorbani/mm
        /// <summary>
        /// Validate Recipient in mailitem,
        /// Only contains one recipient, valid personNo or OrgNo.
        /// </summary>
        public bool ValidateRecipientInMailItem(ref bool Cancel)
        {
            if (OutlookMailItem.Recipients.Count > 1)
            {
                MessageBox.Show(ResourceHelper.Resources[4].Text, ResourceHelper.Resources[1].Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Cancel = true;
                return(false);
            }

            var recipientHelper = new RecipientHelper();

            if (!recipientHelper.ValidRecipient(OutlookMailItem.To))
            {
                MessageBox.Show(ResourceHelper.Resources[3].Text, ResourceHelper.Resources[1].Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Cancel = true;
                return(false);
            }
            return(true);
        }
コード例 #3
0
        /// <summary>
        /// returns a object containing ServiceSupplier and if the recipient isReachable.
        /// </summary>
        /// <param name="recipient"></param>
        /// <returns></returns>
        public IsReachableResult IsReachableResult(string recipient, string senderOrg)
        {
            var isReachableResult = new IsReachableResult();

            try
            {
                //Validate recipient
                var recipientHelper  = new RecipientHelper();
                var recipientService = new RecipientService();

                // recipient = recipientHelper.GetRecipientAdress(recipient); //MG Not sure if we need this

                if (recipientHelper.ValidRecipient(recipient))
                {
                    isReachableResult = recipientService.IsReachable(recipient, senderOrg);
                }
            }
            catch (System.Exception e)
            {
                // LogManager.Log(new Log.Log() { EventId = EventId.GenerelizedException, Exception = e, Level = Level.Error, Message = "Something went wrong checking recipient against FaRService." });
                return(null);
            }
            return(isReachableResult);
        }