示例#1
0
        public async Task UpdateNoeDoc(NoeDoc _noedoc)
        {
            var db         = client.GetDatabase(Constants.ZSUS_NOE_DB_DATABASE);
            var collection = db.GetCollection <BsonDocument>("noe");
            var filter     = Builders <BsonDocument> .Filter.Eq("_id", _noedoc.Id);

            var update = Builders <BsonDocument> .Update
                         .Set("description", _noedoc.description)
                         .Set("timestamp", _noedoc.timestamp)
                         .Set("needsapproval", _noedoc.needsapproval)
                         .Set("approved", _noedoc.approved)
                         .Set("needsnegotiation", _noedoc.needsnegotiation)
                         .Set("negotiated", _noedoc.negotiated)
                         .Set("needsoffering", _noedoc.needsoffering)
                         .Set("offered", _noedoc.offered)
                         .Set("status", _noedoc.status);

            var results = await collection.UpdateOneAsync(filter, update);
        }
示例#2
0
        public async Task Handle(NoeResponse request, IMessageHandlerContext context)
        {
            int    rc;
            String rm = String.Empty;

            try
            {
                NoeDoc doc = await MongoLegacyDriverFactory
                             .GetMongoLegacyDriver()
                             .GetNoeDoc(request.NoeId, request.SagaId.ToString());

                doc.status = request.Status;

                await MongoLegacyDriverFactory.GetMongoLegacyDriver().UpdateNoeDoc(doc);

                EmailNotifcationFactory
                .GetEmailNotifcation()
                .SendSagaStatusChange(new EmailParameters(request.NoeId, request.SagaId, request.Status));

                rc = Constants.ZSUS_NOE_SUCCESS;
                rm = Constants.ZSUS_NOE_SUCCESS_MSG;
                log.InfoFormat(
                    "Workflow (Saga) status change email submitted; sagaid {0}, noeid {1}, status {2}",
                    request.SagaId, request.NoeId, request.Status);
            }
            catch (Exception e)
            {
                rc = Constants.ZSUS_NOE_FAIL;
                rm = e.Message;
                log.ErrorFormat(
                    "Workflow (Saga) status change email not submitted; {0}, {1}, {2}, {3}",
                    request.SagaId, request.NoeId, e.Message, e.StackTrace);
            }

            var response = new NoeResponseComplete(request);

            response.ResponseCode    = rc;
            response.ResponseMessage = rm;
            await context.Reply(response).ConfigureAwait(false);
        }