public DayBatchModel CreateDayBatch(ConnectionModel connectionModel, string instrumentName, string serverParkName, DateTime dayBatchDate, bool checkForTreatedCases) { var catiManagementServer = _remoteCatiManagementServerProvider.GetCatiManagementForServerPark(connectionModel, serverParkName); var instrumentId = _surveyService.GetInstrumentId(connectionModel, instrumentName, serverParkName); var catiInstrumentManager = (ICatiInstrumentManager3)catiManagementServer.LoadCatiInstrumentManager(instrumentId); if (catiInstrumentManager.Specification.SurveyDays.All(d => d.Date.Date != dayBatchDate.Date)) { throw new DataNotFoundException($"A survey day does not exist for the required daybatch date '{dayBatchDate.Date}'"); } catiInstrumentManager.CreateDaybatch(dayBatchDate, checkForTreatedCases); return(GetDayBatch(catiManagementServer, instrumentId)); }
public void CreateDayBatch(ConnectionModel connectionModel, string instrumentName, string serverParkName, DateTime dayBatchDate) { var catiManagement = _remoteCatiManagementServerProvider.GetCatiManagementForServerPark(connectionModel, serverParkName); if (catiManagement.LoadCatiInstrumentManager(instrumentName) .Specification .SurveyDays .All(d => d.Date.Date != dayBatchDate.Date)) { throw new DataNotFoundException($"A survey day does not exist for the required daybatch date '{dayBatchDate.Date}'"); } catiManagement .LoadCatiInstrumentManager(instrumentName) .CreateDaybatch(dayBatchDate); }