GetRecipientListRequest.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / GetRecipientListRequest.cs / 1 / GetRecipientListRequest.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{ 
    using System;
    using System.IO; 
    using System.Collections; 
    using System.Collections.Generic;
    using Microsoft.InfoCards.Diagnostics; 
    using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace;
    //
    // This class handles a UI request for recipient information
    // 
    class GetRecipientListRequest : UIAgentRequest
    { 
        IList m_recipientList; 

 
        //
        // Summary
        //  Create a new request to return the list of recipients
        // 
        public GetRecipientListRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parent )
            : base( rpcHandle, inArgs, outArgs, parent ) 
        { 
        }
 

        protected override void OnMarshalInArgs()
        {
 
        }
 
        // 
        // Summary
        //  Retrive the recipient list 
        //
        protected override void OnProcess()
        {
            StoreConnection connection = StoreConnection.GetConnection(); 
            try
            { 
 
                //
                // Retrieve the recipient objects from the store 
                //
                IList rows = ( IList )connection.Query( QueryDetails.FullRow,
                                            new QueryParameter( SecondaryIndexDefinition.ObjectTypeIndex,
                                                          ( Int32 )StorableObjectType.Recipient ) ); 

                if( null != rows ) 
                { 
                    IList recipientList = new List( rows.Count );
 
                    foreach( DataRow row in rows )
                    {
                        recipientList.Add( new Recipient( new MemoryStream( row.GetDataField() ) ) );
                    } 

                    m_recipientList = recipientList; 
                } 
            }
            finally 
            {
                connection.Close();
            }
        } 

        // 
        // Summary 
        //  Serialize the output in the following order
        //    Count of objects 
        //    Recipient objects
        //
        //
        protected override void OnMarshalOutArgs() 
        {
 
            BinaryWriter writer = new BinaryWriter( OutArgs, System.Text.Encoding.Unicode ); 

            UInt32 count = 0; 
            IDT.TraceDebug( "Serialize the recipient List" );
            if( null != m_recipientList )
            {
                count = ( UInt32 )m_recipientList.Count; 
                writer.Write( count );
                foreach( Recipient rec in m_recipientList ) 
                { 
                    rec.Serialize( writer );
                } 
            }
            else
            {
                writer.Write( count ); 
            }
 
 
        }
 
    }
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK