Beispiel #1
0
        private void HandlePrinting(Campaign campaign, Voucher voucher = null)
        {
            try
            {
                if (campaign == null)
                {
                    throw new ArgumentNullException();
                }

                Printer.InitCommunication();

                Printer.SetHeader(campaign.PrintDateTime);

                Printer.SetImage(GetCampaignImagePath(campaign));

                Printer.SetVoucher(voucher);

                Printer.SetFooter();

                Printer.SetCutPaper(campaign.CutType);

                Printer.CloseCommunication();

                Printer.ExecuteCommands();
            }
            catch (Exception ex)
            {
                LogUtility.Log(LogUtility.LogType.SystemError, MethodBase.GetCurrentMethod().Name, ex.Message);
                throw;
            }
        }
Beispiel #2
0
        public void PrintTestPage(IPrinterHandler printerHandler)
        {
            try
            {
                if (printerHandler == null)
                {
                    throw new ArgumentNullException();
                }

                printerHandler.InitCommunication();

                printerHandler.SetHeader(true);

                printerHandler.SetText(AppStrings.InfoMessage_Printer_Info_PrintTestPage, 12, FontStyle.Bold, 60, Enumerations.TextAlignmentType.Center);

                printerHandler.SetText(string.Format("{0} - {1} - {2}", printerHandler.PrinterConfig.Manufacturer, printerHandler.PrinterConfig.Name, printerHandler.PrinterConfig.ConnectionType), 10, FontStyle.Regular, 60, Enumerations.TextAlignmentType.Center);

                printerHandler.SetFooter();

                printerHandler.SetCutPaper(Enumerations.CutType.Completo);

                printerHandler.CloseCommunication();

                printerHandler.ExecuteCommands();

                HandleStatistic("TestPrinter", new Dictionary <string, string>
                {
                    {
                        "Printer",
                        string.Format("{0} - {1} - {2}", printerHandler.PrinterConfig.Manufacturer,
                                      printerHandler.PrinterConfig.Name, printerHandler.PrinterConfig.ConnectionType)
                    }
                });
            }
            catch (Exception ex)
            {
                LogUtility.Log(LogUtility.LogType.SystemError, MethodBase.GetCurrentMethod().Name, ex.Message);
                throw;
            }
        }