コード例 #1
0
 /// <summary>
 /// Creates the collect result from the SystemCharacteristics List.
 /// The collectResult systemCharacteristics properties will be the merge of all the systemCharacteristics in the list.
 /// </summary>
 /// <param name="systemCharacteristics">The system characteristics.</param>
 /// <param name="status">The status of the collect result</param>
 /// <returns></returns>
 public CollectResult CreateCollectResultFromOvalSystemCharacteristics(IEnumerable<oval_system_characteristics> systemCharacteristics, CollectStatus status)
 {
     var systemCharacteristicsComplete = systemCharacteristicsFactory.CreateSystemCharacteristicsBy(systemCharacteristics);
     var systemCharacteristicsInXML = systemCharacteristicsComplete.GetSystemCharacteristicsXML();
     var collectResult = this.CreateCollectResult(status, systemCharacteristicsInXML);
     return null;   
 }
コード例 #2
0
 public CollectResult CreateCollectResult(CollectStatus status, String systemCharacteristics)
 {
     return new CollectResult()
     {
         Date = DateTime.Now,
         Status = status,
         SystemCharacteristics = systemCharacteristics
     };
 }
コード例 #3
0
 public CollectResult CreateCollectResult(CollectStatus status, String systemCharacteristics)
 {
     return(new CollectResult()
     {
         Date = DateTime.Now,
         Status = status,
         SystemCharacteristics = systemCharacteristics
     });
 }
コード例 #4
0
        /// <summary>
        /// Store applications records to local database (we are working here with max 200 records)
        /// </summary>
        /// <param name="apps"></param>
        /// <returns></returns>
        private async Task StoreRecords(List <ApplicationInformation> fetchedApps)
        {
            try
            {
                //zero apps, exit
                if (fetchedApps.Count == 0)
                {
                    return;
                }

                //Get stored applications in this session
                var applications = await _unitOfWork.Application.GetEntitesForSession(_session.SessionInformation.SessionId);

                //no application records in database for this session insert all application
                if (applications.Count == 0)
                {
                    //map to entity objects
                    var newApps = fetchedApps.Adapt <List <ApplicationEntity> >();

                    //Insert to database
                    await InsertLogic(newApps);

                    //exit
                    return;
                }

                //update old and get new opened applications
                var newApplications = ModifyOldAndGetNewApps(fetchedApps, applications, out bool databaseEntitesModified);

                //no modification and no new apps
                if (newApplications.Count == 0 && !databaseEntitesModified)
                {
                    return;
                }

                //some entites from database modified and zero new application fetched
                if (databaseEntitesModified && newApplications.Count == 0)
                {
                    _logger.LogInfo("Application entites modified");

                    //save changes for modifed entites
                    await _unitOfWork.CommitAsync();

                    //exit
                    return;
                }

                //save everything
                await InsertLogic(newApplications);
            }
            catch (Exception e)
            {
                CollectStatus = CollectStatus.FAILURE;
                _logger.LogError(e);
            }
        }
コード例 #5
0
        public MessageShortName GetMessageShortNameForCollectResponse(CollectStatus collectStatus, CollectHintCode hintCode, bool authPersonalIdentityNumberProvided, bool accessedFromMobileDevice)
        {
            var mapping = CollectResponseMappings
                          .Where(x => !x.CollectStatuses.Any() || x.CollectStatuses.Contains(collectStatus))
                          .Where(x => !x.CollectHintCodes.Any() || x.CollectHintCodes.Contains(hintCode))
                          .Where(x => x.AuthPersonalIdentityNumberProvided == null || x.AuthPersonalIdentityNumberProvided == authPersonalIdentityNumberProvided)
                          .Where(x => x.AccessedFromMobileDevice == null || x.AccessedFromMobileDevice == accessedFromMobileDevice)
                          .FirstOrDefault(x => x.MessageShortName != MessageShortName.Unknown);

            return(mapping?.MessageShortName ?? MessageShortName.RFA22);
        }
コード例 #6
0
        /// <summary>
        /// Store records to local database (working with max 5000 processes). That case is very rare
        /// </summary>
        /// <param name="apps"></param>
        /// <returns></returns>
        private async Task StoreRecords(List <ProcessInformation> fetchedProcesses)
        {
            try
            {
                //zero processes fetched, so exit
                if (fetchedProcesses.Count == 0)
                {
                    return;
                }

                //Get all stored processes for current session
                var storedProcesses = await _unitOfWork.Process.GetEntitesForSession(_session.SessionInformation.SessionId);

                //no records for this session so add every process to database
                if (storedProcesses.Count == 0)
                {
                    //map them to process entities
                    var newProcesses = fetchedProcesses.Adapt <List <ProcessEntity> >();

                    //save changes of modified entites
                    await InsertLogic(newProcesses);

                    //done
                    return;
                }

                //get processes that are not yet stored in database
                var notStoredProcesses = GetNewProcessesToStore(fetchedProcesses, storedProcesses);

                //map them to process entities
                var processesToStore = notStoredProcesses.Adapt <List <ProcessEntity> >();

                //nothing to store -> exit
                if (processesToStore.Count == 0)
                {
                    return;
                }

                //save changes of modified entites
                await InsertLogic(processesToStore);
            }
            catch (Exception e)
            {
                //on failure change status and log error
                CollectStatus = CollectStatus.FAILURE;
                _logger.LogError(e);
            }
        }
        private CompletionData GetCompletionData(CollectStatus status, string personalIdentityNumber)
        {
            if (status != CollectStatus.Complete)
            {
                return(null);
            }

            return(new CompletionData
            {
                User = new User
                {
                    PersonalIdentityNumber = personalIdentityNumber,
                    Name = _name,
                    GivenName = _givenName,
                    Surname = _surname
                }
            });
        }
コード例 #8
0
 public CollectResponseMapping(MessageShortName messageShortName, CollectStatus collectStatus, params CollectHintCode[] collectHintCodes)
     : this(messageShortName, new List <CollectStatus>() { collectStatus }, collectHintCodes.ToList())
 {
 }
コード例 #9
0
 public CollectResponseMapping(MessageShortName messageShortName, CollectStatus collectStatus, CollectHintCode collectHintCode, bool?authPersonalIdentityNumberProvided = null, bool?accessedFromMobileDevice = null)
     : this(messageShortName, new List <CollectStatus>() { collectStatus }, new List <CollectHintCode>() { collectHintCode }, authPersonalIdentityNumberProvided, accessedFromMobileDevice)
 {
 }
コード例 #10
0
 public CollectResponse(CollectStatus status, CollectHintCode hintCode)
 {
     this.status   = status.ToString();
     this.hintCode = hintCode.ToString();
 }
コード例 #11
0
ファイル: CollectResult.cs プロジェクト: jonaslsl/modSIC
 /// <summary>
 /// Sets collectResult state for the complete.
 /// </summary>
 public void SetComplete()
 {
     this.Status = CollectStatus.Complete;
 }
コード例 #12
0
 public CollectState(CollectStatus status, CollectHintCode hintCode)
 {
     Status   = status;
     HintCode = hintCode;
 }
コード例 #13
0
        /// <summary>
        /// Creates the collect result from the SystemCharacteristics List.
        /// The collectResult systemCharacteristics properties will be the merge of all the systemCharacteristics in the list.
        /// </summary>
        /// <param name="systemCharacteristics">The system characteristics.</param>
        /// <param name="status">The status of the collect result</param>
        /// <returns></returns>
        public CollectResult CreateCollectResultFromOvalSystemCharacteristics(IEnumerable <oval_system_characteristics> systemCharacteristics, CollectStatus status)
        {
            var systemCharacteristicsComplete = systemCharacteristicsFactory.CreateSystemCharacteristicsBy(systemCharacteristics);
            var systemCharacteristicsInXML    = systemCharacteristicsComplete.GetSystemCharacteristicsXML();
            var collectResult = this.CreateCollectResult(status, systemCharacteristicsInXML);

            return(null);
        }
コード例 #14
0
 /// <summary>
 /// Sets collectResult state for the complete.
 /// </summary>
 public void SetComplete()
 {
     this.Status = CollectStatus.Complete;
 }