SaveRecipientRequest.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 / SaveRecipientRequest.cs / 1 / SaveRecipientRequest.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{ 
    using System;
    using System.IO; 
    using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; 

    // 
    // Summary
    //   This class handles requests from the UI which need to save the updated recipient information
    //
    class SaveRecipientRequest : UIAgentRequest 
    {
        Recipient m_recipient;      // recipient to be saved to the store 
 
        public SaveRecipientRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parent )
            : base( rpcHandle, inArgs, outArgs, parent ) 
        {
            IDT.Assert( IntPtr.Zero != rpcHandle, "Null RPC handle" );
            IDT.Assert( null != inArgs, "Null InArgs" );
            IDT.Assert( null != outArgs, "Null outArgs" ); 
            IDT.TraceDebug( "Intiating a request to save the updated recipient object" );
        } 
 
        protected override void OnInitializeAsSystem()
        { 
            base.OnInitializeAsSystem();
        }

        // 
        // Summary
        //  Deserialize the incoming arguments. 
        // 
        // Remarks
        //   The expected order of data is 
        //     Recipient
        //
        protected override void OnMarshalInArgs()
        { 
            IDT.Assert( null != InArgs, "Null inArgs" );
            m_recipient = new Recipient( InArgs ); 
 
        }
 
        //
        // Summary
        //  Persist the recipient to the store.
        // 
        protected override void OnProcess()
        { 
            StoreConnection connection = StoreConnection.GetConnection(); 
            try
            { 

                IDT.Assert( null != m_recipient, " Null Recipient" );
                connection.BeginTransaction();
                try 
                {
                    m_recipient.Save( connection ); 
                    connection.CommitTransaction(); 
                }
                catch 
                {
                    connection.RollbackTransaction();
                    throw;
                } 
            }
            finally 
            { 
                connection.Close();
            } 
        }


        protected override void OnMarshalOutArgs() 
        {
 
        } 

    } 
}

// 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