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); } }
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); } }