/// <summary> /// Экспорт файла в Dwg /// </summary> public IResultAppValue <string> Export(string filePath, StampDocumentType stampDocumentType) => Path.GetExtension(filePath). WhereContinue(fileExtension => ValidMicrostationExtensions.IsFileExtensionEqual(fileExtension, FileExtensionMicrostation.Dwg), okFunc: fileExtension => new ResultAppValue <string>(filePath). ResultVoidOk(_ => DesignFile.SaveAs(filePath, true, MsdDesignFileFormat.msdDesignFileFormatDWG)), badFunc: fileExtension => new ResultAppValue <string>(new ErrorApplication(ErrorApplicationType.IncorrectExtension, $"Некорректное расширение {fileExtension} для файла типа dgn")));
public SignatureCreatingWord(ITableElementWord tableStamp, StampIdentifier stampIdentifier, IResultAppValue <ITableElementWord> tableApprovalPerformers, IResultAppValue <ITableElementWord> tableApprovalChief, IStampFieldsWord stampFieldsWord, StampDocumentType stampDocumentType, SignaturesSearching signaturesSearching, string personId, bool useDefaultSignature) : base(signaturesSearching, personId, useDefaultSignature) { _tableStamp = tableStamp ?? throw new ArgumentNullException(nameof(tableStamp)); _stampIdentifier = stampIdentifier; _tableApprovalPerformers = tableApprovalPerformers ?? throw new ArgumentNullException(nameof(tableApprovalPerformers)); _tableApprovalChief = tableApprovalChief ?? throw new ArgumentNullException(nameof(tableApprovalChief)); _stampFieldsWord = stampFieldsWord ?? throw new ArgumentNullException(nameof(stampFieldsWord)); _stampDocumentType = stampDocumentType; }
public IResultValue <IFileDataSourceServer> CreateExportFile(IDocumentLibrary documentLibrary, IFilePath filePath, StampDocumentType stampDocumentType) => ExecuteAndHandleError(() => documentLibrary.Export(filePath.FilePathServer, stampDocumentType), errorMessage: new ErrorCommon(ErrorConvertingType.ExportError, $"Ошибка экспорта файла {filePath.FileNameClient}")). ResultValueOk(fileExportPath => new FileDataSourceServer(filePath.FilePathServer, filePath.FilePathClient, ConvertingModeType.Export));
/// <summary> /// Экспортировать таблицы Word по их типу /// </summary> private IResultAppValue <string> ExportByTableType(IEnumerable <ITableElementWord> tablesWord, string filePath, StampDocumentType stampDocumentType) => stampDocumentType switch {
/// <summary> /// Экспорт файла /// </summary> public IResultAppValue <string> Export(string filePath, StampDocumentType stampDocumentType) => new ResultAppCollection <ITableElementWord>(Tables). ResultValueOk(FilteringExportTables). ToResultCollection(new ErrorApplication(ErrorApplicationType.TableNotFound, "Таблицы для экспорта не найдены")). ResultValueOkBind(tables => ExportByTableType(tables, filePath, stampDocumentType));
/// <summary> /// Экспортировать в другие форматы /// </summary> private IResultValue <IFileDataSourceServer> ExportFile(IDocumentLibrary documentLibrary, IFilePath filePath, StampDocumentType stampDocumentType) => new ResultError(). ResultVoidOk(_ => _messagingService.ShowMessage("Экспорт файла")). ResultVoidOk(_ => _loggerService.LogByObject(LoggerLevel.Info, LoggerAction.Operation, ReflectionInfo.GetMethodBase(this), filePath.FileNameServer)). ResultValueOk(_ => ConvertingFilePath.CreateSavingPath(filePath.FilePathServer, _applicationConverting.GetExportFileExtension(filePath.FileExtensionType), _fileSystemOperations)). ResultValueOkBind(fileExportPath => _applicationConverting.CreateExportFile(documentLibrary, filePath.ChangeServerPath(fileExportPath), stampDocumentType)). Void(result => _messagingService.ShowErrors(result.Errors));