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

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

    // 
    // Summary:
    // This class handles the request from the UI Agent to delete the store. 
    // This is achieved by deleting all the data in the store. 
    //
    class DeleteStoreRequest : UIAgentRequest 
    {
        //
        // Summary:
        //  Constructs a new DeleteStoreRequest instance. 
        //
        // Parameters: 
        //  rpcHandle    - Handle to the RPC call from the UI Agent 
        //  inArgs       - Stream for the incoming information. Null in this case.
        //  outArgs      - Stream used to collect the outbound data. 
        //
        public DeleteStoreRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parentRequest )
            : base( rpcHandle, inArgs, outArgs, parentRequest )
        { 

        } 
 
        //
        // Summary 
        //  Event for marshalling the request information
        //
        protected override void OnMarshalInArgs()
        { 
            //
            // No input arguments. 
            // 
            ;
        } 

        //
        // Summary
        //  Event for processing the user request 
        //
        protected override void OnProcess() 
        { 

            StoreConnection connection = StoreConnection.GetConnection(); 
            try
            {
                connection.BeginTransaction();
 
                try
                { 
                    QueryParameter delStoreQuery = DataSource.CreateDeleteStoreTypeQuery(); 

                    ICollection list = ( ICollection ) connection.Query( 
                        QueryDetails.Identifiers,
                        connection.LocalDataSource,
                        delStoreQuery );
 
                    if( null != list && list.Count > 0 )
                    { 
                        foreach( DataRow row in list ) 
                        {
                            connection.Delete( row ); 
                        }
                    }

                    connection.CommitTransaction(); 
                    AuditLog.AuditStoreDeletion();
                } 
                catch 
                {
                    connection.RollbackTransaction(); 
                    throw;
                }

            } 
            finally
            { 
                connection.Close(); 
            }
        } 

        //
        // Summary
        //  Event for marshalling the response information 
        //
        // Remarks 
        //  Nothing. 
        //
        protected override void OnMarshalOutArgs() 
        {
            //
            // Nothing to marshal out.
            // 
            ;
 
        } 
    }
} 

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