Ejemplo n.º 1
0
        public override bool GenerateForcedReport(List <string> files, IUserConfiguration user)
        {
            List <string> filteredFiles = FilterFilesByTemplate(files, user);

            if (filteredFiles.Count == 0)
            {
                return(false);
            }

            _logger.Debug($"Crete Edesur report for user {user.Name}.");

            var ftpHelper      = user.Ftp.GetFtpHelper(_logger);
            var filePathHelper = new FilePathHelper(_configuration, user.Name);

            var report = new EdesurReport(_logger, _reportTypeConfiguration)
            {
                SourceFiles = files,
                Separator   = _reportTypeConfiguration.FieldSeparator,
                ReportPath  = filePathHelper.GetForcedReportsFolder(),
                ReportGMT   = user.UserGMT,
                UserId      = user.Credentials.AccountId
            };

            report.Generate();

            return(true);
        }
Ejemplo n.º 2
0
        protected override void ProcessFilesForReports(List <string> files, IUserConfiguration user)
        {
            if (files.Count == 0)
            {
                return;
            }

            _logger.Debug($"Crete Edesur report for user {user.Name}.");

            var ftpHelper      = user.Ftp.GetFtpHelper(_logger);
            var filePathHelper = new FilePathHelper(_configuration, user.Name);

            var report = new EdesurReport(_logger, _reportTypeConfiguration);

            report.SourceFiles = files;
            report.Separator   = _reportTypeConfiguration.FieldSeparator;
            report.ReportPath  = filePathHelper.GetReportsFilesFolder();
            report.ReportGMT   = user.UserGMT;
            report.UserId      = user.Credentials.AccountId;

            string reportFileName = report.Generate();

            if (File.Exists(reportFileName))
            {
                UploadFileToFtp(reportFileName, ((UserApiConfiguration)user).Reports.Folder, ftpHelper);
            }
        }