public void GenerateAlarmFired() { using (var transaction = _session.BeginTransaction()) { var processInstances = _processInstanceRepository.Fetch(null, null); Random random = new Random(); var numbersOfProcessInstance = random.Next(1, processInstances.Count()); var numbersOfAlarms = random.Next(5, 10); for (var j = 0; j < numbersOfProcessInstance; j++) { var processInstance = processInstances[j]; for (var i = 0; i < numbersOfAlarms; i++) { AlarmFired entity = new AlarmFired(); entity.AlarmColor = (AlarmColor)random.Next(1, 3); entity.IsActive = true; entity.Parameter = processInstance.Process.Parameters[random.Next(0, processInstance.Process.Parameters.Count)]; entity.Result = random.Next(50, 250).ToString(); entity.ProcessInstance = processInstance; _alarmFiredRepository.Save(entity); } } transaction.Commit(); } }
public IList <ProcessInstance> Fetch(string name, Guid?doctorId, Guid?processId, Guid?patientId, ProcessInstanceState?processInstanceState, PaginationModel pagination, OrderByModel orderBy) { var entities = _processInstanceRepository.Fetch(name, doctorId, processId, patientId, processInstanceState, pagination, orderBy); return(entities); }