/// <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();
/// <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());