コード例 #1
0
 public ConvertingSettings(ISignatureLibrary personSignature, PdfNamingType pdfNamingType,
                           ColorPrintType colorPrintType, bool useDefaultSignature)
 {
     PersonSignature     = personSignature;
     PdfNamingType       = pdfNamingType;
     ColorPrintType      = colorPrintType;
     UseDefaultSignature = useDefaultSignature;
 }
コード例 #2
0
 public HistoryFileDataClient(string filePath, StatusProcessing statusProcessing, ColorPrintType colorPrintType,
                              IEnumerable <IHistoryFileDataSource> historyFileDataSources, int errorCount)
 {
     FilePath               = filePath;
     StatusProcessing       = statusProcessing;
     ColorPrintType         = colorPrintType;
     HistoryFileDataSources = historyFileDataSources.ToList();
     ErrorCount             = errorCount;
 }
コード例 #3
0
 public HistoryFileDataResponse(string filePath, StatusProcessing statusProcessing, ColorPrintType colorPrintType,
                                IList <HistoryFileDataSourceResponse> historyFileDataSources, int errorCount)
 {
     FilePath         = filePath;
     StatusProcessing = statusProcessing;
     ColorPrintType   = colorPrintType;
     HistoryFileDataSourceResponsesList = historyFileDataSources;
     ErrorCount = errorCount;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
        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));
        }
コード例 #6
0
 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;
 }
コード例 #7
0
        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>();
        }
コード例 #8
0
 /// <summary>
 /// Преобразовать цветовое значение в наименование цвета
 /// </summary>
 public static string ColorPrintToString(ColorPrintType colorPrintType)
 {
     ColorPrintTypesString.TryGetValue(colorPrintType, out string colorPrintString);
     return(colorPrintString);
 }
コード例 #9
0
 /// <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();
コード例 #10
0
 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)
 {
 }
コード例 #11
0
 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).
コード例 #12
0
 private IResultError PrintCommand(IDocumentLibrary documentLibrary, IStamp stamp, string filePath,
                                   ConvertingModeType convertingModeType, ColorPrintType colorPrintType,
                                   string prefixSearchPaperSize) =>
 PrintCommandFunc(documentLibrary, stamp, colorPrintType, prefixSearchPaperSize).
 Map(printCommand => convertingModeType switch
コード例 #13
0
 /// <summary>
 /// Добавить файлы
 /// </summary>
 public void AddFiles(IEnumerable <string> files, ColorPrintType colorPrintType) =>
 files?.Select(f => new FileData(f, colorPrintType)).Where(CanFileDataBeAddedToList).
 Void(AddFiles);
コード例 #14
0
 /// <summary>
 /// Конвертировать тип цвета печати в версию для приложения
 /// </summary>
 public static ColorPrintApplication ToApplication(ColorPrintType colorPrintType) =>
 Enum.TryParse(colorPrintType.ToString(), true, out ColorPrintApplication colorPrintApplication) ?
 colorPrintApplication :
 throw new FormatException(nameof(colorPrintType));
コード例 #15
0
 /// <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();
コード例 #16
0
 /// <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());
コード例 #17
0
 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));
コード例 #18
0
 public FileDataRequestServer(string filePath, ColorPrintType colorPrintType, StatusProcessing statusProcessing,
                              byte[] fileDataSource, string fileExtensionAdditional, byte[] fileDataSourceAdditional)
     : base(filePath, colorPrintType, statusProcessing, fileDataSource, fileExtensionAdditional, fileDataSourceAdditional)
 {
 }
コード例 #19
0
 /// <summary>
 /// Изменить цвет печати
 /// </summary>
 public void SetColorPrint(ColorPrintType colorPrintType)
 {
     ColorPrintType = colorPrintType;
     _loggerService.LogByObject(LoggerLevel.Info, LoggerAction.Update, ReflectionInfo.GetMethodBase(this), ColorPrintType, ToString());
 }
コード例 #20
0
 /// <summary>
 /// Получить принтер по типу конвертации и формату
 /// </summary>
 public IResultValue <IPrinterInformation> GetPrinter(ConvertingModeType convertingModeType, ColorPrintType colorPrintType,
                                                      StampPaperSizeType paperSize) =>
 convertingModeType switch
 {
コード例 #21
0
 /// <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));
コード例 #22
0
 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();
コード例 #23
0
 /// <summary>
 /// Конвертировать тип цвета печати в версию для приложения
 /// </summary>
 public static ColorPrintApplication ToApplication(this ColorPrintType colorPrintType) =>
 ColorPrintToApplicationConverter.ToApplication(colorPrintType);