public ConvertingSettings(ISignatureLibrary personSignature, PdfNamingType pdfNamingType, ColorPrintType colorPrintType, bool useDefaultSignature) { PersonSignature = personSignature; PdfNamingType = pdfNamingType; ColorPrintType = colorPrintType; UseDefaultSignature = useDefaultSignature; }
public HistoryFileDataClient(string filePath, StatusProcessing statusProcessing, ColorPrintType colorPrintType, IEnumerable <IHistoryFileDataSource> historyFileDataSources, int errorCount) { FilePath = filePath; StatusProcessing = statusProcessing; ColorPrintType = colorPrintType; HistoryFileDataSources = historyFileDataSources.ToList(); ErrorCount = errorCount; }
public HistoryFileDataResponse(string filePath, StatusProcessing statusProcessing, ColorPrintType colorPrintType, IList <HistoryFileDataSourceResponse> historyFileDataSources, int errorCount) { FilePath = filePath; StatusProcessing = statusProcessing; ColorPrintType = colorPrintType; HistoryFileDataSourceResponsesList = historyFileDataSources; ErrorCount = errorCount; }
protected FileDataRequestBase(string filePath, ColorPrintType colorPrintType, StatusProcessing statusProcessing, byte[] fileDataSource, string fileExtensionAdditional, byte[] fileDataSourceAdditional) { FilePath = filePath; ColorPrintType = colorPrintType; StatusProcessing = statusProcessing; FileDataSource = fileDataSource; FileExtensionAdditional = fileExtensionAdditional; FileDataSourceAdditional = fileDataSourceAdditional; }
public FileDataServer(string filePathServer, string filePathClient, ColorPrintType colorPrintType, StatusProcessing statusProcessing, int attemptingConvertCount, IEnumerable <IFileDataSourceServer> filesDataSourceServer, IEnumerable <IErrorCommon> fileErrors) : base(filePathServer, filePathClient) { ColorPrintType = colorPrintType; StatusProcessing = statusProcessing; AttemptingConvertCount = attemptingConvertCount; FileErrors = fileErrors?.ToList().AsReadOnly() ?? throw new ArgumentNullException(nameof(fileErrors)); FilesDataSourceServer = filesDataSourceServer?.ToList().AsReadOnly() ?? throw new ArgumentNullException(nameof(filesDataSourceServer)); }
public FileDataEntity(string filePath, ColorPrintType colorPrintType, StatusProcessing statusProcessing, IList <FileDataSourceEntity> fileDataSourceServerEntities, IList <ErrorComponent> fileErrors, IList <byte> fileDataSource, string fileExtensionAdditional, IList <byte> fileDataSourceAdditional) { FilePath = filePath; ColorPrintType = colorPrintType; StatusProcessing = statusProcessing; FileDataSourceServerEntities = fileDataSourceServerEntities; FileErrors = fileErrors; FileDataSource = fileDataSource; FileExtensionAdditional = fileExtensionAdditional; FileDataSourceAdditional = fileDataSourceAdditional; }
public FileData(string filePath, ColorPrintType colorPrintType) { string fileExtension = FilePathOperations.ExtensionWithoutPointFromPath(filePath); string fileName = Path.GetFileNameWithoutExtension(filePath); if (String.IsNullOrEmpty(fileExtension) || String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(filePath)) { throw new ArgumentNullException(nameof(filePath)); } if (!ValidFileExtensions.ContainsInDocAndDgnFileTypes(fileExtension)) { throw new KeyNotFoundException(nameof(fileExtension)); } FileExtensionType = ValidFileExtensions.DocAndDgnFileTypeDictionary[fileExtension]; FileName = fileName; FilePath = filePath; ColorPrintType = colorPrintType; FileErrors = new List <IErrorCommon>(); }
/// <summary> /// Преобразовать цветовое значение в наименование цвета /// </summary> public static string ColorPrintToString(ColorPrintType colorPrintType) { ColorPrintTypesString.TryGetValue(colorPrintType, out string colorPrintString); return(colorPrintString); }
/// <summary> /// Произвести печать /// </summary> private IResultCollection <IFileDataSourceServer> StampContainerPrint(IStampContainer stampContainer, IDocumentLibrary documentLibrary, IFilePath filePath, IConvertingSettings convertingSettings, ConvertingModeType convertingModeType, ColorPrintType colorPrintType) => stampContainer.GetStampsToPrint().ToResultCollectionFromApplication(). ResultValueOkBind(signatures => StampContainerPrinting(stampContainer.GetStampsToPrint().ToResultCollectionFromApplication(), documentLibrary, filePath, convertingSettings, convertingModeType, colorPrintType)). ToResultCollection();
public FileDataServer(string filePathServer, string filePathClient, ColorPrintType colorPrintType, StatusProcessing statusProcessing, IEnumerable <IErrorCommon> fileErrors) : this(filePathServer, filePathClient, colorPrintType, statusProcessing, ATTEMPTING_DEFAULT_COUNT, Enumerable.Empty <IFileDataSourceServer>(), fileErrors) { }
private IResultCollection <IFileDataSourceServer> StampContainerPrinting(IResultCollection <IStamp> stampsToPrint, IDocumentLibrary documentLibrary, IFilePath filePath, IConvertingSettings convertingSettings, ConvertingModeType convertingModeType, ColorPrintType colorPrintType) => stampsToPrint. ResultValueOkBind(stamps => StampFilePath.GetFileNamesByNamingType(stamps, filePath.FileNameWithoutExtensionClient, convertingSettings.PdfNamingType).
private IResultError PrintCommand(IDocumentLibrary documentLibrary, IStamp stamp, string filePath, ConvertingModeType convertingModeType, ColorPrintType colorPrintType, string prefixSearchPaperSize) => PrintCommandFunc(documentLibrary, stamp, colorPrintType, prefixSearchPaperSize). Map(printCommand => convertingModeType switch
/// <summary> /// Добавить файлы /// </summary> public void AddFiles(IEnumerable <string> files, ColorPrintType colorPrintType) => files?.Select(f => new FileData(f, colorPrintType)).Where(CanFileDataBeAddedToList). Void(AddFiles);
/// <summary> /// Конвертировать тип цвета печати в версию для приложения /// </summary> public static ColorPrintApplication ToApplication(ColorPrintType colorPrintType) => Enum.TryParse(colorPrintType.ToString(), true, out ColorPrintApplication colorPrintApplication) ? colorPrintApplication : throw new FormatException(nameof(colorPrintType));
/// <summary> /// Произвести печать PDF /// </summary> private IResultCollection <IFileDataSourceServer> StampContainerCreatePdf(IStampContainer stampContainer, IDocumentLibrary documentLibrary, IFilePath filePath, IConvertingSettings convertingSettings, ConvertingModeType convertingModeType, ColorPrintType colorPrintType) => stampContainer. Void(_ => _messagingService.ShowMessage("Вставка подписей...")). Map(_ => stampContainer.InsertSignatures().ToResultCollectionFromApplication()). ResultVoidOk(signatures => _loggerService.LogByObjects(LoggerLevel.Debug, LoggerAction.Operation, ReflectionInfo.GetMethodBase(this), signatures.Select(signature => signature.SignatureLibrary.PersonInformation.FullName))). ResultValueOkBind(signatures => StampContainerPrinting(stampContainer.GetStampsToPrint().ToResultCollectionFromApplication(), documentLibrary, filePath, convertingSettings, convertingModeType, colorPrintType). Void(_ => _messagingService.ShowMessage("Удаление подписей...")). Void(_ => stampContainer.DeleteSignatures(signatures)). Void(_ => _loggerService.LogByObject(LoggerLevel.Debug, LoggerAction.Operation, ReflectionInfo.GetMethodBase(this), nameof(stampContainer.DeleteSignatures)))). ToResultCollection();
/// <summary> /// Обработать штампы и начать печать /// </summary> private IResultCollection <IFileDataSourceServer> StampContainerProcessing(IStampContainer stampContainer, IDocumentLibrary documentLibrary, FilePathCollection filePathCollection, IConvertingSettings convertingSettings, ColorPrintType colorPrintType) => stampContainer. Void(_ => _messagingService.ShowMessage("Подключение дополнительных элементов...")). Void(_ => documentLibrary.AttachAdditional()). Void(_ => _messagingService.ShowMessage("Форматирование полей...")). CompressFieldsRanges(). Void(_ => _loggerService.LogByObject(LoggerLevel.Debug, LoggerAction.Operation, ReflectionInfo.GetMethodBase(this), nameof(stampContainer.CompressFieldsRanges))). Map(_ => GetSavedFileDataSource(documentLibrary, filePathCollection.FilePathMain)). WhereContinue(_ => ConvertingModeChoice.IsPdfConvertingNeed(convertingSettings.ConvertingModeTypes), filesDataSource => StampContainerCreatePdf(stampContainer, documentLibrary, filePathCollection.FilePathPdf, convertingSettings, ConvertingModeType.Pdf, colorPrintType). Map(filesDataSource.ConcatResult), filesDataSource => filesDataSource). WhereContinue(_ => ConvertingModeChoice.IsPrintConvertingNeed(convertingSettings.ConvertingModeTypes), filesDataSource => StampContainerPrint(stampContainer, documentLibrary, filePathCollection.FilePathPrint, convertingSettings, ConvertingModeType.Print, colorPrintType). Map(filesDataSource.ConcatResult), filesDataSource => filesDataSource). Void(_ => documentLibrary.DetachAdditional());
private IResultCollection <IFileDataSourceServer> CreateProcessingDocument(IDocumentLibrary documentLibrary, FilePathCollection filePathCollection, IConvertingSettings convertingSettings, ColorPrintType colorPrintType) => documentLibrary. Void(_ => _messagingService.ShowMessage("Обработка штампов...")). GetStampContainer(convertingSettings.ToApplication()). Map(stampContainer => StampContainerProcessing(stampContainer, documentLibrary, filePathCollection, convertingSettings, colorPrintType));
public FileDataRequestServer(string filePath, ColorPrintType colorPrintType, StatusProcessing statusProcessing, byte[] fileDataSource, string fileExtensionAdditional, byte[] fileDataSourceAdditional) : base(filePath, colorPrintType, statusProcessing, fileDataSource, fileExtensionAdditional, fileDataSourceAdditional) { }
/// <summary> /// Изменить цвет печати /// </summary> public void SetColorPrint(ColorPrintType colorPrintType) { ColorPrintType = colorPrintType; _loggerService.LogByObject(LoggerLevel.Info, LoggerAction.Update, ReflectionInfo.GetMethodBase(this), ColorPrintType, ToString()); }
/// <summary> /// Получить принтер по типу конвертации и формату /// </summary> public IResultValue <IPrinterInformation> GetPrinter(ConvertingModeType convertingModeType, ColorPrintType colorPrintType, StampPaperSizeType paperSize) => convertingModeType switch {
/// <summary> /// Печать /// </summary> private IResultValue <IFileDataSourceServer> CreatePrintingService(IDocumentLibrary documentLibrary, IStamp stamp, IFilePath filePath, ConvertingModeType convertingModeType, ColorPrintType colorPrintType, IResultValue <IPrinterInformation> printerInformation) => printerInformation. ResultVoidOk(printer => _messagingService.ShowMessage($"Установка принтера {printer.Name}")). ResultVoidOk(printer => SetDefaultPrinter(printer.Name)). ResultVoidOk(printer => _messagingService.ShowMessage($"Печать файла {filePath.FileNameClient}")). ResultValueOkBind(_ => PrintCommand(documentLibrary, stamp, filePath.FilePathServer, convertingModeType, colorPrintType, printerInformation.Value.PrefixSearchPaperSize)). ResultVoidOk(_ => _loggerService.LogByObject(LoggerLevel.Debug, LoggerAction.Operation, ReflectionInfo.GetMethodBase(this), filePath.FilePathServer)). ResultValueOk(_ => new FileDataSourceServer(filePath.FilePathServer, filePath.FilePathClient, convertingModeType, stamp.PaperSize, printerInformation.Value.Name));
public IResultCollection <IFileDataSourceServer> CreateProcessingFile(IDocumentLibrary documentLibrary, FilePathCollection filePathCollection, IConvertingSettings convertingSettings, ColorPrintType colorPrintType) => ExecuteBindResultValue(() => CreateProcessingDocument(documentLibrary, filePathCollection, convertingSettings, colorPrintType), new ErrorCommon(ErrorConvertingType.PdfPrintingError, $"Ошибка обработки файла {filePathCollection.FilePathMain.FileNameClient}")). ToResultCollection();
/// <summary> /// Конвертировать тип цвета печати в версию для приложения /// </summary> public static ColorPrintApplication ToApplication(this ColorPrintType colorPrintType) => ColorPrintToApplicationConverter.ToApplication(colorPrintType);