public TargetState Response(ResponseInfo info)
 {
     return svr.Response(info);
 }
Exemple #2
0
        public TargetState Response(ResponseInfo info)
        {
            Assert.IsNotNull(info);

            TargetState result = null;
            var chanel = CreateChannel();
            chanel.Call(p =>
            {
                result = p.Response(info);
            });

            return result;
        }
        public TargetState Response(ResponseInfo info)
        {
            var tstate = repoTargetState.Query(o => o.TargetStateId == info.TargetStateId).FirstOrDefault();
            if (tstate == null)
                throw new ArgumentNullException(string.Format("Flow State {0} not found!", info.TargetStateId));

            tstate.ResponsorId = info.UserId;
            tstate.ResponsorName = info.UserName;
            tstate.ResponseTime = info.OperationTime;
            tstate.StateStatus = StateStatus.Responsed;

            repoTargetState.Update(tstate);
            TargetStateChangedMessage msg = new TargetStateChangedMessage()
            {
                OldTargetStates = new TargetState[] { tstate },
                NewTargetState = null,
                OperationId = null,
                DataOperation = DataOperation.Update,
                OperateTime = info.OperationTime,
                OperatorId = info.UserId,
                OperatorName = info.UserName
            };
            try
            {
                MessageManager.Publish<TargetStateChangedMessage>(msg);
            }
            catch (Exception ex)
            {
                //throw ex;
            }

            return tstate;
        }