public override void Process(ActionData actionData)
        {
            var documentId = actionData.GetAsInteger("DocumentId");
            var document   = _accountService.GetAccountTransactionDocumentById(documentId);

            if (document == null)
            {
                return;
            }
            var printerName         = actionData.GetAsString("PrinterName");
            var printerTemplateName = actionData.GetAsString("PrinterTemplateName");
            var printer             = _cacheService.GetPrinters().FirstOrDefault(x => x.Name == printerName);
            var printerTemplate     = _cacheService.GetPrinterTemplates().FirstOrDefault(y => y.Name == printerTemplateName);

            if (printer == null)
            {
                printer = _applicationState.GetTransactionPrinter();
            }
            if (printerTemplate == null)
            {
                var documentType = _cacheService.GetAccountTransactionDocumentTypeById(document.DocumentTypeId);
                printerTemplate = _cacheService.GetPrinterTemplates().First(x => x.Id == documentType.PrinterTemplateId);
            }
            if (printer == null)
            {
                return;
            }
            if (printerTemplate == null)
            {
                return;
            }
            _printerService.PrintObject(document, printer, printerTemplate);
        }
Ejemplo n.º 2
0
        private void OnPrint(string obj)
        {
            var printer           = _applicationState.GetTransactionPrinter();
            var printerTemplateId = _cacheService.GetAccountTransactionDocumentTypeById(Model.DocumentTypeId).PrinterTemplateId;
            var printerTemplate   = _cacheService.GetPrinterTemplates().First(x => x.Id == printerTemplateId);

            _printerService.PrintObject(Model, printer, printerTemplate);
        }
        private AccountTransactionDocument CreatePrintDocument(AccountRowViewModel accountRowViewModel)
        {
            if (SelectedPrinterTemplate == null)
            {
                return(null);
            }
            if (SelectedPrinter == null)
            {
                return(null);
            }
            var document = CreateDocument(accountRowViewModel);

            _printerService.PrintObject(document, SelectedPrinter, SelectedPrinterTemplate);
            return(document);
        }
Ejemplo n.º 4
0
        public AccountTransactionDocument PrintDocument()
        {
            if (SelectedPrinter == null)
            {
                return(null);
            }
            if (SelectedPrinterTemplate == null)
            {
                return(null);
            }
            var document = CreateDocument();

            if (document == null)
            {
                return(null);
            }
            _printerService.PrintObject(document, SelectedPrinter, SelectedPrinterTemplate);
            return(document);
        }
Ejemplo n.º 5
0
        public override void Process(ActionData actionData)
        {
            var entityId = actionData.GetAsInteger("EntityId");
            var entity   = entityId > 0 ? _cacheService.GetEntityById(entityId) : actionData.GetDataValue <Entity>("Entity");

            if (entity == null)
            {
                return;
            }
            var printerName         = actionData.GetAsString("PrinterName");
            var printerTemplateName = actionData.GetAsString("PrinterTemplateName");
            var printer             = _cacheService.GetPrinters().FirstOrDefault(x => x.Name == printerName);
            var printerTemplate     = _cacheService.GetPrinterTemplates().FirstOrDefault(y => y.Name == printerTemplateName);

            if (printer == null)
            {
                return;
            }
            if (printerTemplate == null)
            {
                return;
            }
            _printerService.PrintObject(entity, printer, printerTemplate);
        }