Click here to Skip to main content
15,885,309 members
Articles / Programming Languages / C#

Fax Adapter

Rate me:
Please Sign up or sign in to vote.
3.62/5 (13 votes)
28 Sep 2006CPOL4 min read 63.5K   994   31  
Fax Adapter for BizTalk Server 2006
//---------------------------------------------------------------------
// File: SyncReceiveSubmitBatch.cs
// 
// Summary: Implementation of an adapter framework sample adapter. 
// This class constitutes one of the BaseAdapter classes, which, are
// a set of generic re-usable set of classes to help adapter writers.
//
// Sample: Base Adapter Class Library v1.0.2
//
// Description: TODO:
//
//---------------------------------------------------------------------
// This file is part of the Microsoft BizTalk Server 2006 SDK
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This source code is intended only as a supplement to Microsoft BizTalk
// Server 2006 release and/or on-line documentation. See these other
// materials for detailed information regarding Microsoft code samples.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//---------------------------------------------------------------------

using System;
using System.Threading;
using System.Collections.Generic;
using Microsoft.BizTalk.TransportProxy.Interop;
using Microsoft.BizTalk.Message.Interop;

namespace Microsoft.Samples.BizTalk.Adapter.Common
{
    public class SyncReceiveSubmitBatch : ReceiveBatch
    {
        private ManualResetEvent workDone;
        private bool overallSuccess = false;
        private ControlledTermination control;

        public SyncReceiveSubmitBatch(IBTTransportProxy transportProxy, ControlledTermination control, int depth)
            : this(transportProxy, control, new ManualResetEvent(false), depth) { }

        private SyncReceiveSubmitBatch(IBTTransportProxy transportProxy, ControlledTermination control,
                                        ManualResetEvent submitComplete, int depth)
            : base(transportProxy, control, submitComplete, depth)
        {
            this.control = control;
            this.workDone = submitComplete;
            base.ReceiveBatchComplete += new ReceiveBatchCompleteHandler(OnBatchComplete);
        }

        private void OnBatchComplete(bool overallSuccess)
        {
            this.overallSuccess = overallSuccess;
        }

        public override void Done()
        {
            bool needToLeave = control.Enter();

            try
            {
                base.Done();
            }
            catch
            {
                if (needToLeave)
                    control.Leave();

                throw;
            }
        }

        public bool Wait()
        {
            this.workDone.WaitOne();

            return this.overallSuccess;
        }
    }
}

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)


Written By
Web Developer
India India
Anil is from Hyderabad, Andhra Pradesh. He is Currently Working with VisualSoft Technologies Ltd., As a Software Engineer.

Anil has more than 4 yrs of experience in the IT industry working on Microsoft Technologies. He is involved in various project activities like System Architecture, Design, and Development. Technical experience most specifically ASP.NET , Javascript, Biztalk 2004/2006, Webservices, C# and .NET framework. He has have worked on various language and platforms. He is Microsoft Certified professional.

The author has won several programming awards within the organizations worked and is well-recognized.


--

Comments and Discussions