コード例 #1
0
        public void RegisterTimer(Guid processId, string name, DateTime nextExecutionDateTime, bool notOverrideIfExists)
        {
            var dbcoll = Store.GetCollection <WorkflowProcessTimer>(MongoDBConstants.WorkflowProcessTimerCollectionName);
            var timer  = dbcoll.FindOne(Query <WorkflowProcessTimer> .Where(item => item.ProcessId == processId && item.Name == name));

            if (timer == null)
            {
                timer = new WorkflowProcessTimer()
                {
                    Id   = Guid.NewGuid(),
                    Name = name,
                    NextExecutionDateTime = nextExecutionDateTime,
                    ProcessId             = processId
                };

                timer.Ignore = false;
                dbcoll.Insert(timer);
            }

            if (!notOverrideIfExists)
            {
                timer.NextExecutionDateTime = nextExecutionDateTime;
                dbcoll.Save(timer);
            }
        }
コード例 #2
0
        public void RegisterTimer(Guid processId, string name, DateTime nextExecutionDateTime, bool notOverrideIfExists)
        {
            var dbcoll = Store.GetCollection <WorkflowProcessTimer>(MongoDBConstants.WorkflowProcessTimerCollectionName);
            var timer  = dbcoll.Find(item => item.ProcessId == processId && item.Name == name).FirstOrDefault();

            if (timer == null)
            {
                timer = new WorkflowProcessTimer
                {
                    Id   = Guid.NewGuid(),
                    Name = name,
                    NextExecutionDateTime = nextExecutionDateTime,
                    ProcessId             = processId
                };

                timer.Ignore = false;
                dbcoll.InsertOne(timer);
            }
            else if (!notOverrideIfExists)
            {
                timer.NextExecutionDateTime = nextExecutionDateTime;
                Save(dbcoll, timer, doc => doc.Id == timer.Id);
            }
        }