Beispiel #1
0
        public IEnumerable <CaseModel> GetCasesInDatabase()
        {
            var caseModels = new List <CaseModel>();

            var casesInDatabase = _blaiseCaseApi.GetCases(
                BlaiseConfigurationHelper.InstrumentName, BlaiseConfigurationHelper.ServerParkName);

            while (!casesInDatabase.EndOfSet)
            {
                var caseRecord = casesInDatabase.ActiveRecord;
                var outcome    = _blaiseCaseApi.GetFieldValue(caseRecord, FieldNameType.HOut).IntegerValue.ToString(CultureInfo.InvariantCulture);
                var mode       = _blaiseCaseApi.GetFieldValue(caseRecord, FieldNameType.Mode).EnumerationValue;

                caseModels.Add(new CaseModel(_blaiseCaseApi.GetPrimaryKeyValue(caseRecord), outcome, (ModeType)mode, DateTime.Now));
                casesInDatabase.MoveNext();
            }

            return(caseModels);
        }
        private ReportDto BuildReportDto(string serverParkName, string instrumentName, Guid instrumentId, List <string> fieldIds)
        {
            var reportDto = new ReportDto
            {
                InstrumentName = instrumentName,
                InstrumentId   = instrumentId
            };

            var cases = _blaiseCaseApi.GetCases(instrumentName, serverParkName);

            while (!cases.EndOfSet)
            {
                var caseData = GetReportFieldData(fieldIds, cases.ActiveRecord);

                reportDto.ReportingData.Add(caseData);

                cases.MoveNext();
            }

            return(reportDto);
        }
        public void ImportOnlineDatabaseFile(string databaseFilePath, string instrumentName, string serverParkName)
        {
            var caseRecords = _blaiseApi.GetCases(databaseFilePath);

            while (!caseRecords.EndOfSet)
            {
                var newRecord  = caseRecords.ActiveRecord;
                var primaryKey = _blaiseApi.GetPrimaryKeyValue(newRecord);

                try
                {
                    var existingCase = _blaiseApi.GetCase(primaryKey, instrumentName, serverParkName);
                    _onlineCaseService.UpdateExistingCaseWithOnlineData(newRecord, existingCase,
                                                                        serverParkName, instrumentName, primaryKey);
                }
                catch (Exception ex)
                {
                    _loggingService.LogWarn($"Warning: There was an error updating case '{primaryKey}' - '{ex}'");
                }

                caseRecords.MoveNext();
            }
        }
        public void ImportNisraDatabaseFile(string databaseFilePath, string instrumentName, string serverParkName)
        {
            var existingTelCaseStatusModels = _blaiseApi.GetCaseStatusList(instrumentName, serverParkName).ToList();
            var nisraFileCaseRecords        = _blaiseApi.GetCases(databaseFilePath);

            while (!nisraFileCaseRecords.EndOfSet)
            {
                var nisraRecord = nisraFileCaseRecords.ActiveRecord;

                var nisraCaseStatusModel    = GetNisraCaseStatusModel(nisraRecord);
                var existingCaseStatusModel = GetExistingTelCaseStatusModel(nisraCaseStatusModel.PrimaryKey, existingTelCaseStatusModels);

                if (CaseNeedsToBeUpdated(nisraCaseStatusModel, existingCaseStatusModel, instrumentName))
                {
                    var existingRecord = _blaiseApi.GetCase(nisraCaseStatusModel.PrimaryKey, instrumentName, serverParkName);

                    _onlineCaseUpdateService.UpdateCase(nisraRecord, existingRecord,
                                                        instrumentName, serverParkName);
                }

                nisraFileCaseRecords.MoveNext();
            }
        }