public Result <bool> SaveFile(string name = null) { Result <bool> result = new Result <bool>(); try { var filename = string.IsNullOrEmpty(name) ? CreateFileOffice.GetUniqueOnlyFileName("ifns") : CreateFileOffice.GetUniqueOnlyFileName(name); var ifnsString = GetIfnsToString(_charSeparator); List <string> data = new List <string>(ifnsString.Count + 1) { GetHeader(_charSeparator) }; data.AddRange(ifnsString); var file = _createFile.CreateXlsx(data, filename); _createFile.CreateCsv(data, filename); _createFile.OpenFolderFile(file); } catch (Exception ex) { result.ErrorResult = new ErrorResult(ex.Message, EnumTypeError.ErrorFileFormat); } return(result); }
public FoundFsspService(IRepositoryFssp repository, ISettingsService settings) { _repository = repository; _key = settings?.GetSettings().ApiKeyFssp; _createFile = new CreateFileOffice("Fssp"); BindingOperations.EnableCollectionSynchronization(CollectionRequest, _personCollectionLock); }
public FoundIfnsService(IRepositoryIfns rep) { _repository = rep; _createFile = new CreateFileOffice("Ifns"); BindingOperations.EnableCollectionSynchronization(CollectionIfns, _lock); _parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = 8 }; }
public async Task <Result <RequestFound> > ProcessingList(string file) { Result <RequestFound> result = new Result <RequestFound>(); return(await Task.Run(async() => { try { var str = _serviceFile.ReadFile(file).Skip(1); var t = await _serviceFile.GetTypeData(file).ConfigureAwait(false); var fileName = CreateFileOffice.GetUniqueOnlyFileName(file); if (t.Title == "Физические лица") { await FoundGroopPerson(fileName, str).ConfigureAwait(false); } else if (t.Title == "Юридические лица") { await FoundGroopCompany(fileName, str).ConfigureAwait(false); } else if (t.Title == "Номера исполнительных производств") { await FoundGroopNumber(fileName, str).ConfigureAwait(false); } else { throw new Exception("Неверный тип данных"); } } catch (FormatException fex) { result.ErrorResult = new ErrorResult(fex.Message, EnumTypeError.ErrorFileFormat); } catch (Exception ex) { result.ErrorResult = new ErrorResult(ex.Message, EnumTypeError.ErrorSite); } return result; }).ConfigureAwait(false)); }
public FoundCompanyService(IRepositorySpark rep, ILoggerService logger) { _createFile = new CreateFileOffice("Spark"); _repositorySpark = rep; _logger = logger; }
public FoundServiceRosresstr(IRepositoryRosreestr rep) { _repositoryRosreestr = rep; _createFile = new CreateFileOffice("Rosreestr"); }
public FoundCompanyEgrulService(IRepositoryEgrul rep, ILoggerService logger) { _createFile = new CreateFileOffice("Egrul"); _repositoryEgrul = rep; _logger = logger; }