public Microsoft.XLANGs.Core.StopConditions segment2(Microsoft.XLANGs.Core.StopConditions stopOn)
        {
            bool __condition__;
            Microsoft.XLANGs.Core.Segment __seg__ = _segments[2];
            Microsoft.XLANGs.Core.Context __ctx__ = (Microsoft.XLANGs.Core.Context)_stateMgrs[2];
            ____scope37_2 __ctx2__ = (____scope37_2)_stateMgrs[2];
            __subImportFile_1 __ctx1__ = (__subImportFile_1)_stateMgrs[1];
            ____scope38_3 __ctx3__ = (____scope38_3)_stateMgrs[3];

            switch (__seg__.Progress)
            {
            case 0:
                __ctx2__.__xpathString = default(System.String);
                __ctx__.PrologueCompleted = true;
                if ( !PostProgressInc( __seg__, __ctx__, 1 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 1;
            case 1:
                __ctx2__.__xpathString = "";
                if ( !PostProgressInc( __seg__, __ctx__, 2 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 2;
            case 2:
                if ( !PreProgressInc( __seg__, __ctx__, 3 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[9],__eventData[6],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 3;
            case 3:
                __condition__ = (__ctx1__.__GuardsFile.GetPropertyValueNoThrow(typeof(FILE.ReceivedFileName)) != null);
                if (!__condition__)
                {
                    if ( !PostProgressInc( __seg__, __ctx__, 6 ) )
                        return Microsoft.XLANGs.Core.StopConditions.Paused;
                    goto case 6;
                }
                if ( !PostProgressInc( __seg__, __ctx__, 4 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 4;
            case 4:
                __ctx1__.__receivedFileName = (System.String)__ctx1__.__GuardsFile.GetPropertyValueThrows(typeof(FILE.ReceivedFileName));
                if ( !PostProgressInc( __seg__, __ctx__, 5 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 5;
            case 5:
                if ( !PostProgressInc( __seg__, __ctx__, 12 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 12;
            case 6:
                if ( !PreProgressInc( __seg__, __ctx__, 7 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[7],__eventData[6],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 7;
            case 7:
                __condition__ = (__ctx1__.__GuardsFile.GetPropertyValueNoThrow(typeof(FTP.ReceivedFileName)) != null);
                if (!__condition__)
                {
                    if ( !PostProgressInc( __seg__, __ctx__, 10 ) )
                        return Microsoft.XLANGs.Core.StopConditions.Paused;
                    goto case 10;
                }
                if ( !PostProgressInc( __seg__, __ctx__, 8 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 8;
            case 8:
                __ctx1__.__receivedFileName = (System.String)__ctx1__.__GuardsFile.GetPropertyValueThrows(typeof(FTP.ReceivedFileName));
                if ( !PostProgressInc( __seg__, __ctx__, 9 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 9;
            case 9:
                if ( !PostProgressInc( __seg__, __ctx__, 11 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 11;
            case 10:
                __ctx1__.__receivedFileName = "";
                if ( !PostProgressInc( __seg__, __ctx__, 11 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 11;
            case 11:
                if ( !PreProgressInc( __seg__, __ctx__, 12 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[8],__eventData[7],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 12;
            case 12:
                if ( !PreProgressInc( __seg__, __ctx__, 13 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[10],__eventData[7],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 13;
            case 13:
                if ( !PreProgressInc( __seg__, __ctx__, 14 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[11],__eventData[2],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 14;
            case 14:
                {
                    __messagetype_System_Xml_XmlDocument __Context = new __messagetype_System_Xml_XmlDocument("Context", __ctx1__);
                    CreateMedegaFileRequest __SQLCreateMedegaFileRequest = new CreateMedegaFileRequest("SQLCreateMedegaFileRequest", __ctx1__);

                    __ctx1__.__tempXmlDoc.UnderlyingXmlDocument = new System.Xml.XmlDocument();
                    __ctx1__.__status = System.Convert.ToInt32(MedegaImport.MedegaImportTypes.MedegaFileStatusEnum.ImportStarted);
                    __ctx1__.__tmpString = "<ns0:CreateMedegaFileRequest xmlns:ns0='http://inami-riziv.fgov.be.medega'><ns0:sp_BTSCreateMedegaFile FileName='" + __ctx1__.__receivedFileName + "' FileStatus='" + System.Convert.ToString(__ctx1__.__status) + "' /></ns0:CreateMedegaFileRequest>";
                    __ctx1__.__tempXmlDoc.UnderlyingXmlDocument.LoadXml(__ctx1__.__tmpString);
                    __SQLCreateMedegaFileRequest.parameters.LoadFrom((System.Xml.XmlDocument)__ctx1__.__tempXmlDoc.UnderlyingXmlDocument);
                    __Context.part.CopyFrom(__SQLCreateMedegaFileRequest.parameters);

                    if (__ctx1__.__Context != null)
                        __ctx1__.UnrefMessage(__ctx1__.__Context);
                    __ctx1__.__Context = __Context;
                    __ctx1__.RefMessage(__ctx1__.__Context);
                    if (__ctx1__.__SQLCreateMedegaFileRequest != null)
                        __ctx1__.UnrefMessage(__ctx1__.__SQLCreateMedegaFileRequest);
                    __ctx1__.__SQLCreateMedegaFileRequest = __SQLCreateMedegaFileRequest;
                    __ctx1__.RefMessage(__ctx1__.__SQLCreateMedegaFileRequest);
                }
                __ctx1__.__Context.ConstructionCompleteEvent(false);
                __ctx1__.__SQLCreateMedegaFileRequest.ConstructionCompleteEvent(false);
                if ( !PostProgressInc( __seg__, __ctx__, 15 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 15;
            case 15:
                if ( !PreProgressInc( __seg__, __ctx__, 16 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Construct);
                    __edata.Messages.Add(__ctx1__.__Context);
                    __edata.Messages.Add(__ctx1__.__SQLCreateMedegaFileRequest);
                    Tracker.FireEvent(__eventLocations[12],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 16;
            case 16:
                if ( !PreProgressInc( __seg__, __ctx__, 17 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[13],__eventData[5],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 17;
            case 17:
                __ctx3__ = new ____scope38_3(this);
                _stateMgrs[3] = __ctx3__;
                if ( !PostProgressInc( __seg__, __ctx__, 18 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 18;
            case 18:
                __ctx2__.StartContext(__seg__, __ctx3__);
                if ( !PostProgressInc( __seg__, __ctx__, 19 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                return Microsoft.XLANGs.Core.StopConditions.Blocked;
            case 19:
                if ( !PreProgressInc( __seg__, __ctx__, 20 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                if (__ctx2__ != null)
                    __ctx2__.__xpathString = null;
                if (__ctx1__ != null && __ctx1__.__SQLCreateMedegaFileRequest != null)
                {
                    __ctx1__.UnrefMessage(__ctx1__.__SQLCreateMedegaFileRequest);
                    __ctx1__.__SQLCreateMedegaFileRequest = null;
                }
                Tracker.FireEvent(__eventLocations[29],__eventData[13],_stateMgrs[2].TrackDataStream );
                __ctx3__.Finally();
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 20;
            case 20:
                if (!__ctx2__.CleanupAndPrepareToCommit(__seg__))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if ( !PostProgressInc( __seg__, __ctx__, 21 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 21;
            case 21:
                if ( !PreProgressInc( __seg__, __ctx__, 22 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                __ctx2__.OnCommit();
                goto case 22;
            case 22:
                __seg__.SegmentDone();
                _segments[1].PredecessorDone(this);
                break;
            }
            return Microsoft.XLANGs.Core.StopConditions.Completed;
        }
        public Microsoft.XLANGs.Core.StopConditions segment2(Microsoft.XLANGs.Core.StopConditions stopOn)
        {
            Microsoft.XLANGs.Core.Envelope __msgEnv__ = null;
            bool __condition__;
            Microsoft.XLANGs.Core.Segment __seg__ = _segments[2];
            Microsoft.XLANGs.Core.Context __ctx__ = (Microsoft.XLANGs.Core.Context)_stateMgrs[2];
            ____scope38_3 __ctx3__ = (____scope38_3)_stateMgrs[3];
            __subImportGuardRecord_1 __ctx1__ = (__subImportGuardRecord_1)_stateMgrs[1];
            __subImportGuardRecord_root_0 __ctx0__ = (__subImportGuardRecord_root_0)_stateMgrs[0];
            ____scope37_2 __ctx2__ = (____scope37_2)_stateMgrs[2];

            switch (__seg__.Progress)
            {
            case 0:
                __ctx2__.__tempString = default(System.String);
                __ctx__.PrologueCompleted = true;
                if ( !PostProgressInc( __seg__, __ctx__, 1 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 1;
            case 1:
                __ctx2__.__tempString = "";
                if ( !PostProgressInc( __seg__, __ctx__, 2 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 2;
            case 2:
                if ( !PreProgressInc( __seg__, __ctx__, 3 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[12],__eventData[6],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 3;
            case 3:
                {
                    __messagetype_MedegaImport_Schemas_DB2_ImportXml_ImportXmlRequest __DB2ImportXmlRequest = new __messagetype_MedegaImport_Schemas_DB2_ImportXml_ImportXmlRequest("DB2ImportXmlRequest", __ctx1__);
                    __messagetype_MedegaImportSchema_Schemas_Medega_Guard_Record __ImportGuardRecord = new __messagetype_MedegaImportSchema_Schemas_Medega_Guard_Record("ImportGuardRecord", __ctx1__);
                    __messagetype_System_Xml_XmlDocument __Context = new __messagetype_System_Xml_XmlDocument("Context", __ctx1__);

                    __ctx1__.__xpathString = System.String.Format("/*[local-name()='ROWSET']/*[local-name()='ROW'][{0}]", __ctx1__.__counter);
                    __ImportGuardRecord.part.XPathAssign(__ctx1__.__ImportGuard.part, __ctx1__.__xpathString);
                    ApplyTransform(typeof(MedegaImport.Mappings.CreateDB2ImportXmlRequest), new object[] {__DB2ImportXmlRequest.part}, new object[] {__ImportGuardRecord.part, __ctx1__.__ImportFileResponse.part});
                    __Context.CopyFrom(__DB2ImportXmlRequest);
                    __DB2ImportXmlRequest.SetPropertyValue(typeof(BTS.SSOTicket), __ctx1__.__SSOHelper.IssueSelfTicket());

                    if (__ctx1__.__DB2ImportXmlRequest != null)
                        __ctx1__.UnrefMessage(__ctx1__.__DB2ImportXmlRequest);
                    __ctx1__.__DB2ImportXmlRequest = __DB2ImportXmlRequest;
                    __ctx1__.RefMessage(__ctx1__.__DB2ImportXmlRequest);
                    if (__ctx1__.__ImportGuardRecord != null)
                        __ctx1__.UnrefMessage(__ctx1__.__ImportGuardRecord);
                    __ctx1__.__ImportGuardRecord = __ImportGuardRecord;
                    __ctx1__.RefMessage(__ctx1__.__ImportGuardRecord);
                    if (__ctx1__.__Context != null)
                        __ctx1__.UnrefMessage(__ctx1__.__Context);
                    __ctx1__.__Context = __Context;
                    __ctx1__.RefMessage(__ctx1__.__Context);
                }
                __ctx1__.__DB2ImportXmlRequest.ConstructionCompleteEvent(true);
                __ctx1__.__ImportGuardRecord.ConstructionCompleteEvent(true);
                __ctx1__.__Context.ConstructionCompleteEvent(true);
                if ( !PostProgressInc( __seg__, __ctx__, 4 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 4;
            case 4:
                if ( !PreProgressInc( __seg__, __ctx__, 5 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Construct);
                    __edata.Messages.Add(__ctx1__.__DB2ImportXmlRequest);
                    __edata.Messages.Add(__ctx1__.__ImportGuardRecord);
                    __edata.Messages.Add(__ctx1__.__Context);
                    __edata.Messages.Add(__ctx1__.__ImportFileResponse);
                    Tracker.FireEvent(__eventLocations[13],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (__ctx1__ != null && __ctx1__.__ImportGuardRecord != null)
                {
                    __ctx1__.UnrefMessage(__ctx1__.__ImportGuardRecord);
                    __ctx1__.__ImportGuardRecord = null;
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 5;
            case 5:
                if ( !PreProgressInc( __seg__, __ctx__, 6 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[14],__eventData[8],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 6;
            case 6:
                if (!__ctx2__.PrepareToPendingCommit(__seg__))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if ( !PostProgressInc( __seg__, __ctx__, 7 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 7;
            case 7:
                if ( !PreProgressInc( __seg__, __ctx__, 8 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                DB2_ImportXml.SendMessage(0, __ctx1__.__DB2ImportXmlRequest, null, null, out __ctx0__.__subWrapper0, __ctx2__, __seg__ );
                if ((stopOn & Microsoft.XLANGs.Core.StopConditions.OutgoingRqst) != 0)
                    return Microsoft.XLANGs.Core.StopConditions.OutgoingRqst;
                goto case 8;
            case 8:
                if ( !PreProgressInc( __seg__, __ctx__, 9 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Send);
                    __edata.Messages.Add(__ctx1__.__DB2ImportXmlRequest);
                    __edata.PortName = @"DB2_ImportXml";
                    Tracker.FireEvent(__eventLocations[15],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 9;
            case 9:
                if ( !PreProgressInc( __seg__, __ctx__, 10 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[16],__eventData[9],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 10;
            case 10:
                if (!DB2_ImportXml.GetMessageId(__ctx0__.__subWrapper0.getSubscription(this), __seg__, __ctx1__, out __msgEnv__, _locations[0]))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if (__ctx0__ != null && __ctx0__.__subWrapper0 != null)
                {
                    __ctx0__.__subWrapper0.Destroy(this, __ctx0__);
                    __ctx0__.__subWrapper0 = null;
                }
                if (__ctx1__.__DB2ImportXmlResponse != null)
                    __ctx1__.UnrefMessage(__ctx1__.__DB2ImportXmlResponse);
                __ctx1__.__DB2ImportXmlResponse = new __messagetype_MedegaImport_Schemas_DB2_ImportXml_ImportXmlResponse("DB2ImportXmlResponse", __ctx1__);
                __ctx1__.RefMessage(__ctx1__.__DB2ImportXmlResponse);
                DB2_ImportXml.ReceiveMessage(0, __msgEnv__, __ctx1__.__DB2ImportXmlResponse, null, (Microsoft.XLANGs.Core.Context)_stateMgrs[2], __seg__);
                if ( !PostProgressInc( __seg__, __ctx__, 11 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 11;
            case 11:
                if ( !PreProgressInc( __seg__, __ctx__, 12 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Receive);
                    __edata.Messages.Add(__ctx1__.__DB2ImportXmlResponse);
                    __edata.PortName = @"DB2_ImportXml";
                    Tracker.FireEvent(__eventLocations[17],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 12;
            case 12:
                if ( !PreProgressInc( __seg__, __ctx__, 13 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[18],__eventData[7],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 13;
            case 13:
                __ctx3__ = new ____scope38_3(this);
                _stateMgrs[3] = __ctx3__;
                if ( !PostProgressInc( __seg__, __ctx__, 14 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 14;
            case 14:
                __ctx2__.StartContext(__seg__, __ctx3__);
                if ( !PostProgressInc( __seg__, __ctx__, 15 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                return Microsoft.XLANGs.Core.StopConditions.Blocked;
            case 15:
                if ( !PreProgressInc( __seg__, __ctx__, 16 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[26],__eventData[12],_stateMgrs[2].TrackDataStream );
                __ctx3__.Finally();
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 16;
            case 16:
                if ( !PreProgressInc( __seg__, __ctx__, 17 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[27],__eventData[13],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 17;
            case 17:
                __condition__ = __ctx1__.__returnCode <= 0;
                if (!__condition__)
                {
                    if ( !PostProgressInc( __seg__, __ctx__, 24 ) )
                        return Microsoft.XLANGs.Core.StopConditions.Paused;
                    goto case 24;
                }
                if ( !PostProgressInc( __seg__, __ctx__, 18 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 18;
            case 18:
                if ( !PreProgressInc( __seg__, __ctx__, 19 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[28],__eventData[6],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 19;
            case 19:
                {
                    __messagetype_System_Xml_XmlDocument __ExceptionMsg = new __messagetype_System_Xml_XmlDocument("ExceptionMsg", __ctx1__);

                    __ExceptionMsg.CopyFrom(__ctx1__.__DB2ImportXmlResponse);

                    if (__ctx1__.__ExceptionMsg != null)
                        __ctx1__.UnrefMessage(__ctx1__.__ExceptionMsg);
                    __ctx1__.__ExceptionMsg = __ExceptionMsg;
                    __ctx1__.RefMessage(__ctx1__.__ExceptionMsg);
                }
                __ctx1__.__ExceptionMsg.ConstructionCompleteEvent(false);
                if ( !PostProgressInc( __seg__, __ctx__, 20 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 20;
            case 20:
                if ( !PreProgressInc( __seg__, __ctx__, 21 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Construct);
                    __edata.Messages.Add(__ctx1__.__ExceptionMsg);
                    Tracker.FireEvent(__eventLocations[29],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 21;
            case 21:
                if ( !PreProgressInc( __seg__, __ctx__, 22 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[30],__eventData[14],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 22;
            case 22:
                throw __ctx1__.__ImportXmlException;
            case 23:
                if ( !PostProgressInc( __seg__, __ctx__, 53 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 53;
            case 24:
                if ( !PreProgressInc( __seg__, __ctx__, 25 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[31],__eventData[6],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 25;
            case 25:
                {
                    MedegaImport.GuardsImportService.GuardsImportService_.ImportMedegaGuard_request __WSGuardsImportRequest = new MedegaImport.GuardsImportService.GuardsImportService_.ImportMedegaGuard_request("WSGuardsImportRequest", __ctx2__);
                    __messagetype_System_Xml_XmlDocument __Context = new __messagetype_System_Xml_XmlDocument("Context", __ctx1__);

                    ApplyTransform(typeof(MedegaImport.Mappings.DB2ImportXMLtoImportGuardRequest), new object[] {__WSGuardsImportRequest.medegaGuardRequest}, new object[] {__ctx1__.__DB2ImportXmlRequest.part, __ctx1__.__DB2ImportXmlResponse.part});
                    __Context.part.CopyFrom(__WSGuardsImportRequest.medegaGuardRequest);

                    if (__ctx2__.__WSGuardsImportRequest != null)
                        __ctx2__.UnrefMessage(__ctx2__.__WSGuardsImportRequest);
                    __ctx2__.__WSGuardsImportRequest = __WSGuardsImportRequest;
                    __ctx2__.RefMessage(__ctx2__.__WSGuardsImportRequest);
                    if (__ctx1__.__Context != null)
                        __ctx1__.UnrefMessage(__ctx1__.__Context);
                    __ctx1__.__Context = __Context;
                    __ctx1__.RefMessage(__ctx1__.__Context);
                }
                __ctx2__.__WSGuardsImportRequest.ConstructionCompleteEvent(true);
                __ctx1__.__Context.ConstructionCompleteEvent(true);
                if ( !PostProgressInc( __seg__, __ctx__, 26 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 26;
            case 26:
                if ( !PreProgressInc( __seg__, __ctx__, 27 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Construct);
                    __edata.Messages.Add(__ctx2__.__WSGuardsImportRequest);
                    __edata.Messages.Add(__ctx1__.__Context);
                    __edata.Messages.Add(__ctx1__.__DB2ImportXmlRequest);
                    __edata.Messages.Add(__ctx1__.__DB2ImportXmlResponse);
                    Tracker.FireEvent(__eventLocations[32],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 27;
            case 27:
                if ( !PreProgressInc( __seg__, __ctx__, 28 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[33],__eventData[2],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 28;
            case 28:
                __ctx1__.__returnCode = -1;
                if ( !PostProgressInc( __seg__, __ctx__, 29 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 29;
            case 29:
                if ( !PreProgressInc( __seg__, __ctx__, 30 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[34],__eventData[3],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 30;
            case 30:
                if ( !PreProgressInc( __seg__, __ctx__, 31 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[35],__eventData[8],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 31;
            case 31:
                if (!__ctx2__.PrepareToPendingCommit(__seg__))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if ( !PostProgressInc( __seg__, __ctx__, 32 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 32;
            case 32:
                if ( !PreProgressInc( __seg__, __ctx__, 33 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                GuardsImportWS.SendMessage(0, __ctx2__.__WSGuardsImportRequest, null, null, out __ctx0__.__subWrapper1, __ctx2__, __seg__ );
                if ((stopOn & Microsoft.XLANGs.Core.StopConditions.OutgoingRqst) != 0)
                    return Microsoft.XLANGs.Core.StopConditions.OutgoingRqst;
                goto case 33;
            case 33:
                if ( !PreProgressInc( __seg__, __ctx__, 34 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Send);
                    __edata.Messages.Add(__ctx2__.__WSGuardsImportRequest);
                    __edata.PortName = @"GuardsImportWS";
                    Tracker.FireEvent(__eventLocations[36],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (__ctx2__ != null && __ctx2__.__WSGuardsImportRequest != null)
                {
                    __ctx2__.UnrefMessage(__ctx2__.__WSGuardsImportRequest);
                    __ctx2__.__WSGuardsImportRequest = null;
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 34;
            case 34:
                if ( !PreProgressInc( __seg__, __ctx__, 35 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[37],__eventData[9],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 35;
            case 35:
                if (!GuardsImportWS.GetMessageId(__ctx0__.__subWrapper1.getSubscription(this), __seg__, __ctx2__, out __msgEnv__, _locations[1]))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if (__ctx0__ != null && __ctx0__.__subWrapper1 != null)
                {
                    __ctx0__.__subWrapper1.Destroy(this, __ctx0__);
                    __ctx0__.__subWrapper1 = null;
                }
                if (__ctx2__.__WSGuardsImportResponse != null)
                    __ctx2__.UnrefMessage(__ctx2__.__WSGuardsImportResponse);
                __ctx2__.__WSGuardsImportResponse = new MedegaImport.GuardsImportService.GuardsImportService_.ImportMedegaGuard_response("WSGuardsImportResponse", __ctx2__);
                __ctx2__.RefMessage(__ctx2__.__WSGuardsImportResponse);
                GuardsImportWS.ReceiveMessage(0, __msgEnv__, __ctx2__.__WSGuardsImportResponse, null, (Microsoft.XLANGs.Core.Context)_stateMgrs[2], __seg__);
                if ( !PostProgressInc( __seg__, __ctx__, 36 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 36;
            case 36:
                if ( !PreProgressInc( __seg__, __ctx__, 37 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Receive);
                    __edata.Messages.Add(__ctx2__.__WSGuardsImportResponse);
                    __edata.PortName = @"GuardsImportWS";
                    Tracker.FireEvent(__eventLocations[38],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 37;
            case 37:
                if ( !PreProgressInc( __seg__, __ctx__, 38 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[39],__eventData[13],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 38;
            case 38:
                __condition__ = (System.String)__ctx2__.__WSGuardsImportResponse.ImportMedegaGuardResult.GetDistinguishedField("GuardStatus") == "Error";
                if (!__condition__)
                {
                    if ( !PostProgressInc( __seg__, __ctx__, 49 ) )
                        return Microsoft.XLANGs.Core.StopConditions.Paused;
                    goto case 49;
                }
                if ( !PostProgressInc( __seg__, __ctx__, 39 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 39;
            case 39:
                if ( !PreProgressInc( __seg__, __ctx__, 40 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[40],__eventData[2],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 40;
            case 40:
                __ctx1__.__BusinessErrorOccured = true;
                if ( !PostProgressInc( __seg__, __ctx__, 41 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 41;
            case 41:
                if ( !PreProgressInc( __seg__, __ctx__, 42 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[41],__eventData[3],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 42;
            case 42:
                if ( !PreProgressInc( __seg__, __ctx__, 43 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[42],__eventData[6],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 43;
            case 43:
                {
                    ExceptionType __MailErrorMsg = new ExceptionType("MailErrorMsg", __ctx2__);

                    __MailErrorMsg.Context.CopyFrom(__ctx1__.__Context.part);
                    __MailErrorMsg.ErrMsg.CopyFrom(__ctx2__.__WSGuardsImportResponse.ImportMedegaGuardResult);

                    if (__ctx2__.__MailErrorMsg != null)
                        __ctx2__.UnrefMessage(__ctx2__.__MailErrorMsg);
                    __ctx2__.__MailErrorMsg = __MailErrorMsg;
                    __ctx2__.RefMessage(__ctx2__.__MailErrorMsg);
                }
                __ctx2__.__MailErrorMsg.ConstructionCompleteEvent(false);
                if ( !PostProgressInc( __seg__, __ctx__, 44 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 44;
            case 44:
                if ( !PreProgressInc( __seg__, __ctx__, 45 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Construct);
                    __edata.Messages.Add(__ctx2__.__MailErrorMsg);
                    Tracker.FireEvent(__eventLocations[43],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 45;
            case 45:
                if ( !PreProgressInc( __seg__, __ctx__, 46 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[44],__eventData[8],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 46;
            case 46:
                if (!__ctx2__.PrepareToPendingCommit(__seg__))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if ( !PostProgressInc( __seg__, __ctx__, 47 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 47;
            case 47:
                if ( !PreProgressInc( __seg__, __ctx__, 48 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                MailBusinessException.SendMessage(0, __ctx2__.__MailErrorMsg, null, null, __ctx2__, __seg__ , Microsoft.XLANGs.Core.ActivityFlags.None );
                if ((stopOn & Microsoft.XLANGs.Core.StopConditions.OutgoingRqst) != 0)
                    return Microsoft.XLANGs.Core.StopConditions.OutgoingRqst;
                goto case 48;
            case 48:
                if ( !PreProgressInc( __seg__, __ctx__, 49 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                {
                    Microsoft.XLANGs.RuntimeTypes.EventData __edata = new Microsoft.XLANGs.RuntimeTypes.EventData(Microsoft.XLANGs.RuntimeTypes.Operation.End | Microsoft.XLANGs.RuntimeTypes.Operation.Send);
                    __edata.Messages.Add(__ctx2__.__MailErrorMsg);
                    __edata.PortName = @"MailBusinessException";
                    Tracker.FireEvent(__eventLocations[45],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (__ctx2__ != null && __ctx2__.__MailErrorMsg != null)
                {
                    __ctx2__.UnrefMessage(__ctx2__.__MailErrorMsg);
                    __ctx2__.__MailErrorMsg = null;
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 49;
            case 49:
                if ( !PreProgressInc( __seg__, __ctx__, 50 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[46],__eventData[15],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 50;
            case 50:
                if ( !PreProgressInc( __seg__, __ctx__, 51 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[47],__eventData[2],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 51;
            case 51:
                __ctx2__.__tempString = System.String.Format("GaurdStatus= {0}, FailureDesc= {1}, FailureCode= {2} ", (System.String)__ctx2__.__WSGuardsImportResponse.ImportMedegaGuardResult.GetDistinguishedField("GuardStatus"), (System.String)__ctx2__.__WSGuardsImportResponse.ImportMedegaGuardResult.GetDistinguishedField("FailureDescription"), (System.String)__ctx2__.__WSGuardsImportResponse.ImportMedegaGuardResult.GetDistinguishedField("FailureCode"));
                if (__ctx2__ != null && __ctx2__.__WSGuardsImportResponse != null)
                {
                    __ctx2__.UnrefMessage(__ctx2__.__WSGuardsImportResponse);
                    __ctx2__.__WSGuardsImportResponse = null;
                }
                if ( !PostProgressInc( __seg__, __ctx__, 52 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 52;
            case 52:
                Tracker.FireEvent(__eventLocations[48],__eventData[3],_stateMgrs[2].TrackDataStream );
                if ( !PostProgressInc( __seg__, __ctx__, 53 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 53;
            case 53:
                if ( !PreProgressInc( __seg__, __ctx__, 54 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                if (__ctx2__ != null)
                    __ctx2__.__tempString = null;
                if (__ctx1__ != null && __ctx1__.__DB2ImportXmlResponse != null)
                {
                    __ctx1__.UnrefMessage(__ctx1__.__DB2ImportXmlResponse);
                    __ctx1__.__DB2ImportXmlResponse = null;
                }
                if (__ctx1__ != null && __ctx1__.__DB2ImportXmlRequest != null)
                {
                    __ctx1__.UnrefMessage(__ctx1__.__DB2ImportXmlRequest);
                    __ctx1__.__DB2ImportXmlRequest = null;
                }
                Tracker.FireEvent(__eventLocations[49],__eventData[15],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 54;
            case 54:
                if (!__ctx2__.CleanupAndPrepareToCommit(__seg__))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if ( !PostProgressInc( __seg__, __ctx__, 55 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 55;
            case 55:
                if ( !PreProgressInc( __seg__, __ctx__, 56 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                __ctx2__.OnCommit();
                goto case 56;
            case 56:
                __seg__.SegmentDone();
                _segments[1].PredecessorDone(this);
                break;
            }
            return Microsoft.XLANGs.Core.StopConditions.Completed;
        }