Exemplo n.º 1
0
        void ContinueAt(NativeActivityContext context, Bookmark bookmark, Object obj)
        {
            if (!(obj is RequestResult))
            {
                throw new WorkflowException("Invalid ResponseType. Must be RequestResult");
            }
            IDbContext dbContext = context.GetExtension <IDbContext>();
            Process    process   = Process.GetProcessFromContext(context);
            var        rr        = obj as RequestResult;
            Inbox      inbox     = Inbox.Get <Inbox>(context);

            inbox.Resumed(dbContext, rr.InboxId, rr.UserId, rr.Answer);
            context.TrackRecord($"Inbox resumed {{Id: {rr.InboxId}, UserId: {rr.UserId}) Result:'{rr.Answer}'}}");
            // track after
            var trAfter = TrackAfter.Get <TrackRecord>(context);

            if (trAfter != null)
            {
                trAfter         = trAfter.Clone();
                trAfter.UserId  = rr.UserId;
                trAfter.Message = rr.Resolve(trAfter.Message);
                context.DoTrack(dbContext, trAfter);
            }
            // send after
            SendMessage(SendAfter.Get <MessageInfo>(context), inbox, context);
            // state after
            context.DoModelState(dbContext, StateAfter.Get <ModelStateInfo>(context), rr.InboxId, rr.UserId);
            this.Result.Set(context, rr);
        }
Exemplo n.º 2
0
        void ContinueAt(NativeActivityContext context, Bookmark bookmark, Object obj)
        {
            if (!(obj is RequestResult))
            {
                throw new WorkflowException("Invalid ResponseType. Must be RequestResult");
            }
            IDbContext dbContext = context.GetExtension <IDbContext>();
            Process    process   = Process.GetProcessFromContext(context.DataContext);

            process.DbContext = dbContext;
            var   rr    = obj as RequestResult;
            Inbox inbox = Inbox.Get <Inbox>(context);

            inbox.Resumed(dbContext, rr.InboxId, rr.UserId, rr.Answer);
            TrackRecord(context, $"Inbox resumed {{Id: {rr.InboxId}, UserId: {rr.UserId}) Result:'{rr.Answer}'}}");
            // track after
            DoTrack(dbContext, TrackAfter.Get <TrackRecord>(context), context, rr.UserId);
            // send after
            SendMessage(SendAfter.Get <MessageInfo>(context), inbox, context);
            this.Result.Set(context, rr);
        }