예제 #1
0
        public override void Escape()
        {
            if (onReporting)
            {
                DisplayAdapter.Cashier.Show(PosMessage.REPORT_STOPPING);
                onReporting = false;
                if (exReporting != null)
                {
                    if (exReporting.InnerException == null)
                    {
                        exReporting = new Exception(exReporting.Message, exReporting);
                    }

                    Exception ex = exReporting.InnerException;
                    exReporting = null;
                    if (!(ex is ParameterRelationException) && ex is ParameterException)
                    {
                        cr.State = States.ConfirmCashier.Instance(
                            new Confirm(PosMessage.NO_DOCUMENT_FOUND_IN_EJ,
                                        Continue));
                    }
                    else
                    {
                        throw ex;
                    }
                }
                else
                {
                    cr.Printer.InterruptReport();
                }
                return;
            }
            if (ejOnly)
            {
                cr.State = ElectronicJournalError.Instance();
                ejOnly   = false;
                return;
            }
            if (displayingReport.Subreports.Count > 0 && displayingReport.Parent != null)
            {
                displayingReport = displayingReport.Parent;
                cr.State         = Instance();
                return;
            }
            base.Escape();
        }
예제 #2
0
        public static IState PrintZReport()
        {
            ICashier cashier = cr.CurrentCashier;

            try
            {
                cr.Printer.CheckPrinterStatus();
                ReportMenu.PrintZReport();
            }
            catch (EJException eje)
            {
                return(ElectronicJournalError.Instance(eje));
            }
            catch (CashierAlreadyAssignedException)
            {
                States.Login.SignOutCashier();
                ReportMenu.PrintZReport();
            }

            return(cr.State = States.Login.Instance());
        }
예제 #3
0
        protected override Boolean BlockRemoved()
        {
            try
            {
                DisplayAdapter.Cashier.Show(PosMessage.CONNECTING_TO_PRINTER);
                String port = PosConfiguration.Get("PrinterComPort");
                cr.SetPrinterPort(port);
                if (cr.State is PrinterConnectionError)
                {
                    return(false);
                }
                cr.Log.Success("Connected to printer. {0}", port);

                cr.CheckDocumentAfterReConnected();

                return(true);
            }
            catch (BlockingException)
            {
                cr.State = PrinterBlockingError.Instance();
                return(false);
            }
            catch (PowerFailureException)
            {
                cr.Void();
            }
            catch (EJException ej)
            {
                cr.State = ElectronicJournalError.Instance(ej);
            }
            catch (Exception e)
            {
                errorMessage = new Error(e).Message;
                DisplayAdapter.Cashier.Show(errorMessage);
                cr.Log.Error("Error in PrinterConnectionError: {0}", errorMessage);
            }
            return(false);
        }
예제 #4
0
        public static IState PrintZReport()
        {
            IPrinterResponse response = null;

            try
            {
                cr.State = States.WaitingState.Instance();
                DisplayAdapter.Cashier.Show(PosMessage.WRITING_Z_REPORT);
                response = cr.Printer.PrintZReport();
                if (!response.HasError)
                {
                    cr.DataConnector.SaveReport("ZRAPORU", response.Detail);
                }
            }
            catch (EJFullException eje) { cr.State = ElectronicJournalError.Instance(eje); }
            finally
            {
                if (cr.CurrentCashier == null && !(cr.State is ElectronicJournalError))
                {
                    cr.State = States.Login.Instance();
                }
            }
            return(cr.State);
        }