Click here to Skip to main content
12,304,822 members (63,179 online)
Click here to Skip to main content

Stats

22.4K views
360 downloads
23 bookmarked
Posted

Host and Workflow: Two Worlds to Communicate. Part V

, 4 Oct 2008 CPOL
Part V: Intercommunications with a Workflow instance using Correlation parameter
using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.Activities;

namespace CommunicationManager
{
    /// <summary>
    /// Event argument to send the email address to workflow
    /// </summary>
    [Serializable]
    public class MailEventArgs : ExternalDataEventArgs
    {
        string _typo = string.Empty;
        //string _orderNumber = string.Empty;
        string _email = string.Empty;


        public MailEventArgs(Guid instanceId, string typo, string email)
            : base(instanceId)
        {
            _typo = typo;
            _email = email;
        }

        public string Typo
        {
            get { return _typo; }
            set { _typo = value; }
        }

        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }

        
    }

    /// <summary>
    /// Event argument to send the email address to workflow
    /// </summary>
    [Serializable]
    public class RequestMailEventArgs : ExternalDataEventArgs
    {
        string _typo = string.Empty;
        string _orderNumber = string.Empty;



        public RequestMailEventArgs(Guid instanceId, string typo, string orderNumber)
            : base(instanceId)
        {
            _typo = typo;
            _orderNumber = orderNumber;
        }

        public string Typo
        {
            get { return _typo; }
            set { _typo = value; }
        }

        public string OrderNumber
        {
            get { return _orderNumber; }
            set { _orderNumber = value; }
        }
        //public string Email
        //{
        //    get { return _email; }
        //    set { _email = value; }
        //}


    }

    /// <summary>
    /// Event arguments to notificate the email sendung
    /// </summary>
    [Serializable]
    public class NotificationEventArgs : ExternalDataEventArgs
    {
        string _notification = string.Empty;
        //string _typo = string.Empty;
 
        public NotificationEventArgs(Guid instanceId, string Notification)
            : base(instanceId)
        {
            _notification = Notification;
        //    _typo = typo;
       }

        public string Notification
        {
            get { return _notification; }
            set { _notification = value; }
        }
    }
    
    [ExternalDataExchange]
    [CorrelationParameter("typo")]
    public interface IMailCommunication
    {
        #region Workflow To Host
        /// <summary>
        /// Get the email address based on the typo information.
        /// </summary>
        /// <param name="typo">PROVIDER CUSTOMER</param>
        /// <param name="name">Name of the </param>
        [CorrelationInitializer]
        void GetEmailAddress(Guid wfId, string typo, string orderNumber);
      
        #endregion

        #region Host To Workflow
        /// <summary>
        /// Send the email to workflow
        /// </summary>
        [CorrelationAlias("typo", "e.Typo")]
        event EventHandler<MailEventArgs> SendEmailToWorkflow;
 
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

freedeveloper
Software Developer (Senior) Avalon Development
United States United States
Jose A. Garcia Guirado, Electronic Engineer, graduated in Havana/Cuba 1982, MCTS, MCSD.NET, MCAD.NET, MCSE. Worked in the Institute for Cybernetics and Mathematics of Academy of Science of Cuba for 8 years; since 1995 working as free software architect, developer and adviser, first in Argentina and from 2003 to 2010, in Germany as External consultant in DWS Luxembourg, AIXTRON AG and Shell Deutschland GmbH and from 2010 to 2012 in in Mexico in Twenty Century Fox, and Mexico Stock Exchange (BMV). Actually as freelancer in Florida, USA.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160530.1 | Last Updated 4 Oct 2008
Article Copyright 2008 by freedeveloper
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid