/// <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 FileDataSourceServer(string filePathServer, string filePathClient, ConvertingModeType convertingModeType, StampPaperSizeType paperSize, string printerName) : base(filePathServer, filePathClient) { PaperSize = paperSize; PrinterName = printerName; ConvertingModeType = convertingModeType; }
/// <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));
/// <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();
public ConvertingMode(ConvertingModeType convertingModeType, bool isUsed) { ConvertingModeType = convertingModeType; IsUsed = isUsed; }
/// <summary> /// Получить принтер по типу конвертации и формату /// </summary> public IResultValue <IPrinterInformation> GetPrinter(ConvertingModeType convertingModeType, ColorPrintType colorPrintType, StampPaperSizeType paperSize) => convertingModeType switch {
/// <summary> /// Преобразовать тип конвертации в наименование /// </summary> public static string ConvertingModeToString(ConvertingModeType convertingModeType) { ConvertingModeTypesString.TryGetValue(convertingModeType, out string convertingModeString); return(convertingModeString); }
private IResultError PrintCommand(IDocumentLibrary documentLibrary, IStamp stamp, string filePath, ConvertingModeType convertingModeType, ColorPrintType colorPrintType, string prefixSearchPaperSize) => PrintCommandFunc(documentLibrary, stamp, colorPrintType, prefixSearchPaperSize). Map(printCommand => convertingModeType switch
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).
public FileDataSourceServer(string filePathServer, string filePathClient, ConvertingModeType convertingModeType, StampPaperSizeType paperSize) : this(filePathServer, filePathClient, convertingModeType, paperSize, "-") { }