示例#1
0
        public ResponseBase <EmptyResponse> UpdateNodeStatus(UpdateNodeStatusRequest req)
        {
            var node = noderepository.FindSingle(x => x.id == req.NodeId);

            if (node == null)
            {
                return(ResponseToClient <EmptyResponse>(ResponesStatus.Failed, "当前节点" + req.NodeId + "不存在库中!"));
            }
            var nodeModel = noderepository.FindSingle(x => x.id == req.NodeId);

            nodeModel.nodestatus         = (int)req.NodeStatus;
            nodeModel.nodelastupdatetime = req.NodeStatus == NodeStatus.NoRun? nodeModel.nodelastupdatetime.AddYears(-1):nodeModel.nodelastupdatetime;
            noderepository.Update(nodeModel);
            if (req.NodeStatus == NodeStatus.NoRun)//停止
            {
                //把当前节点下所有的任务都改为未调度
                List <int> taskidList = taskversionRep.Find(x => x.nodeid == req.NodeId).Select(x => x.taskid).ToList();

                List <tb_task> tasklist = taskRep.Find(x => taskidList.Contains(x.id)).ToList();

                taskRep.UpdateById(taskidList, new Dictionary <string, string>()
                {
                    { "taskschedulestatus", ((int)TaskScheduleStatus.StopSchedule).ToString() }, { "ispauseschedule", "0" }
                });
            }
            return(ResponseToClient <EmptyResponse>(ResponesStatus.Success, ""));
        }
        public Microsoft.XLANGs.Core.StopConditions segment2(Microsoft.XLANGs.Core.StopConditions stopOn)
        {
            Microsoft.XLANGs.Core.Envelope __msgEnv__ = null;
            Microsoft.XLANGs.Core.Segment __seg__ = _segments[2];
            Microsoft.XLANGs.Core.Context __ctx__ = (Microsoft.XLANGs.Core.Context)_stateMgrs[2];
            ____scope41_2 __ctx2__ = (____scope41_2)_stateMgrs[2];
            __subUpdateNodeStatus_root_0 __ctx0__ = (__subUpdateNodeStatus_root_0)_stateMgrs[0];
            __subUpdateNodeStatus_1 __ctx1__ = (__subUpdateNodeStatus_1)_stateMgrs[1];

            switch (__seg__.Progress)
            {
            case 0:
                __ctx__.PrologueCompleted = true;
                if ( !PostProgressInc( __seg__, __ctx__, 1 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 1;
            case 1:
                if ( !PreProgressInc( __seg__, __ctx__, 2 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[6],__eventData[2],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 2;
            case 2:
                {
                    __messagetype_System_Xml_XmlDocument __Context = new __messagetype_System_Xml_XmlDocument("Context", __ctx1__);
                    UpdateNodeStatusRequest __SQLUpdateNodeStatusRequest = new UpdateNodeStatusRequest("SQLUpdateNodeStatusRequest", __ctx1__);

                    __ctx1__.__tempXmlDoc.UnderlyingXmlDocument = new System.Xml.XmlDocument();
                    __ctx1__.__tempString = System.String.Format("<ns0:UpdateNodeStatusRequest xmlns:ns0=\"http://inami-riziv.fgov.be.medega\"><ns0:sp_UpdateMedegaXmlNodeStatus NodeId=\"{0}\" NodeStatus=\"{1}\" ReasonOfFailure=\"{2}\" /></ns0:UpdateNodeStatusRequest>", __ctx1__.__NodeId, __ctx1__.__StatusId, __ctx1__.__ReasonOfFailure);
                    __ctx1__.__tempXmlDoc.UnderlyingXmlDocument.LoadXml(__ctx1__.__tempString);
                    __SQLUpdateNodeStatusRequest.parameters.LoadFrom((System.Xml.XmlDocument)__ctx1__.__tempXmlDoc.UnderlyingXmlDocument);
                    __Context.part.CopyFrom(__SQLUpdateNodeStatusRequest.parameters);

                    if (__ctx1__.__Context != null)
                        __ctx1__.UnrefMessage(__ctx1__.__Context);
                    __ctx1__.__Context = __Context;
                    __ctx1__.RefMessage(__ctx1__.__Context);
                    if (__ctx1__.__SQLUpdateNodeStatusRequest != null)
                        __ctx1__.UnrefMessage(__ctx1__.__SQLUpdateNodeStatusRequest);
                    __ctx1__.__SQLUpdateNodeStatusRequest = __SQLUpdateNodeStatusRequest;
                    __ctx1__.RefMessage(__ctx1__.__SQLUpdateNodeStatusRequest);
                }
                __ctx1__.__Context.ConstructionCompleteEvent(false);
                __ctx1__.__SQLUpdateNodeStatusRequest.ConstructionCompleteEvent(false);
                if ( !PostProgressInc( __seg__, __ctx__, 3 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 3;
            case 3:
                if ( !PreProgressInc( __seg__, __ctx__, 4 ) )
                    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__.__SQLUpdateNodeStatusRequest);
                    Tracker.FireEvent(__eventLocations[7],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 4;
            case 4:
                if ( !PreProgressInc( __seg__, __ctx__, 5 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[8],__eventData[4],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 5;
            case 5:
                if (!__ctx2__.PrepareToPendingCommit(__seg__))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if ( !PostProgressInc( __seg__, __ctx__, 6 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 6;
            case 6:
                if ( !PreProgressInc( __seg__, __ctx__, 7 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                SQLUpdateNodeStatusPort.SendMessage(0, __ctx1__.__SQLUpdateNodeStatusRequest, null, null, out __ctx0__.__subWrapper0, __ctx2__, __seg__ );
                if ((stopOn & Microsoft.XLANGs.Core.StopConditions.OutgoingRqst) != 0)
                    return Microsoft.XLANGs.Core.StopConditions.OutgoingRqst;
                goto case 7;
            case 7:
                if ( !PreProgressInc( __seg__, __ctx__, 8 ) )
                    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__.__SQLUpdateNodeStatusRequest);
                    __edata.PortName = @"SQLUpdateNodeStatusPort";
                    Tracker.FireEvent(__eventLocations[9],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (__ctx1__ != null && __ctx1__.__SQLUpdateNodeStatusRequest != null)
                {
                    __ctx1__.UnrefMessage(__ctx1__.__SQLUpdateNodeStatusRequest);
                    __ctx1__.__SQLUpdateNodeStatusRequest = null;
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 8;
            case 8:
                if ( !PreProgressInc( __seg__, __ctx__, 9 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                Tracker.FireEvent(__eventLocations[10],__eventData[5],_stateMgrs[2].TrackDataStream );
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 9;
            case 9:
                if (!SQLUpdateNodeStatusPort.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__.__SQLUpdateNodeStatusResponse != null)
                    __ctx1__.UnrefMessage(__ctx1__.__SQLUpdateNodeStatusResponse);
                __ctx1__.__SQLUpdateNodeStatusResponse = new UpdateNodeStatusResponse("SQLUpdateNodeStatusResponse", __ctx1__);
                __ctx1__.RefMessage(__ctx1__.__SQLUpdateNodeStatusResponse);
                SQLUpdateNodeStatusPort.ReceiveMessage(0, __msgEnv__, __ctx1__.__SQLUpdateNodeStatusResponse, null, (Microsoft.XLANGs.Core.Context)_stateMgrs[2], __seg__);
                if ( !PostProgressInc( __seg__, __ctx__, 10 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 10;
            case 10:
                if ( !PreProgressInc( __seg__, __ctx__, 11 ) )
                    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__.__SQLUpdateNodeStatusResponse);
                    __edata.PortName = @"SQLUpdateNodeStatusPort";
                    Tracker.FireEvent(__eventLocations[11],__edata,_stateMgrs[2].TrackDataStream );
                }
                if (__ctx1__ != null && __ctx1__.__SQLUpdateNodeStatusResponse != null)
                {
                    __ctx1__.UnrefMessage(__ctx1__.__SQLUpdateNodeStatusResponse);
                    __ctx1__.__SQLUpdateNodeStatusResponse = null;
                }
                if (IsDebugged)
                    return Microsoft.XLANGs.Core.StopConditions.InBreakpoint;
                goto case 11;
            case 11:
                if (!__ctx2__.CleanupAndPrepareToCommit(__seg__))
                    return Microsoft.XLANGs.Core.StopConditions.Blocked;
                if ( !PostProgressInc( __seg__, __ctx__, 12 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                goto case 12;
            case 12:
                if ( !PreProgressInc( __seg__, __ctx__, 13 ) )
                    return Microsoft.XLANGs.Core.StopConditions.Paused;
                __ctx2__.OnCommit();
                goto case 13;
            case 13:
                __seg__.SegmentDone();
                _segments[1].PredecessorDone(this);
                break;
            }
            return Microsoft.XLANGs.Core.StopConditions.Completed;
        }