コード例 #1
0
        public bool IsAlive()
        {
            try
            {
                if (Directory.Exists(this.ExtractsFolder))
                {
                    // Try to create and move file
                    var filePath = CprBroker.Utilities.Strings.NewUniquePath(this.ExtractsFolder, "txt");
                    File.WriteAllText(filePath, "ABC");
                    string ss      = File.ReadAllText(filePath);
                    var    tmpFile = ExtractManager.MoveToProcessed(this.ExtractsFolder, filePath);
                    File.Delete(tmpFile);

                    if (this.HasFtpSource)
                    {
                        var files = ListFtpContents();
                    }
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Admin.LogException(ex);
                while (ex.InnerException != null)
                {
                    Admin.LogException(ex.InnerException);
                    ex = ex.InnerException;
                }
            }
            return(false);
        }
コード例 #2
0
        public RegistreringType1 Read(CprBroker.Schemas.PersonIdentifier uuid, LaesInputType input, Func <string, Guid> cpr2uuidFunc, out QualityLevel?ql)
        {
            ql = QualityLevel.Cpr;
            IndividualResponseType response = null;

            response = ExtractManager.GetPerson(uuid.CprNumber);

            if (response != null)
            {
                UuidCache cache = new UuidCache();
                cache.FillCache(response.RelatedPnrs);

                return(response.ToRegistreringType1(cache.GetUuid));
            }
            return(null);
        }
コード例 #3
0
        public static void ExtractLocalFiles(CPRDirectExtractDataProvider prov)
        {
            var files = Directory.GetFiles(prov.ExtractsFolder);

            Admin.LogFormattedSuccess("Found <{0}> files", files.Length);

            foreach (var file in files)
            {
                try
                {
                    Admin.LogFormattedSuccess("Reading file <{0}> ", file);
                    ExtractManager.ImportFileInSteps(file, CprBroker.Config.Properties.Settings.Default.CprDirectExtractImportBatchSize);
                    Admin.LogFormattedSuccess("Importing file <{0}> succeeded", file);

                    MoveToProcessed(prov.ExtractsFolder, file);
                    Admin.LogFormattedSuccess("File <{0}> moved to \\Processed folder", file);
                }
                catch (Exception ex)
                {
                    Admin.LogException(ex);
                }
            }
        }