Пример #1
0
        public static void PrintSlipReport(FlowDocument document)
        {
            var printer = AppServices.CurrentTerminal.SlipReportPrinter;

            if (printer == null || string.IsNullOrEmpty(printer.ShareName))
            {
                return;
            }
            PrintJobFactory.CreatePrintJob(printer).DoPrint(document);
        }
Пример #2
0
        private static void PrintOrderLines(Ticket ticket, IEnumerable <TicketItem> lines, PrinterMap p)
        {
            if (p == null)
            {
                MessageBox.Show("Yazdırma sırasında bir problem tespit edildi: Yazıcı Haritası null");
                AppServices.Log("Yazıcı Haritası NULL problemi tespit edildi.");
                return;
            }
            if (!string.IsNullOrEmpty(p.PrinterTemplate.LineTemplate) && lines.Count() <= 0)
            {
                return;
            }
            if (p.Printer == null || string.IsNullOrEmpty(p.Printer.ShareName) || p.PrinterTemplate == null)
            {
                return;
            }
            var ticketLines = TicketFormatter.GetFormattedTicket(ticket, lines, p.PrinterTemplate);

            PrintJobFactory.CreatePrintJob(p.Printer).DoPrint(ticketLines);
        }
Пример #3
0
        public static void ExecutePrintJob(PrintJob printJob)
        {
            if (printJob.PrinterMaps.Count > 0)
            {
                var printerMap = printJob.PrinterMaps[0];
                var content    = printerMap
                                 .PrinterTemplate
                                 .HeaderTemplate
                                 .Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                if (!string.IsNullOrEmpty(printerMap.Printer.ShareName))
                {
                    try
                    {
                        PrintJobFactory.CreatePrintJob(printerMap.Printer).DoPrint(content);
                    }
                    catch (Exception e)
                    {
                        AppServices.LogError(e, string.Format(Resources.PrintingErrorMessage_f, e.Message));
                    }
                }
            }
        }