Ejemplo n.º 1
0
        private static IState Instance(EJLimitWarningException e)
        {
            EJEXCEPTION = (EJException)e;
            /*if current address of ej is higer then ej limit */

            return(AlertCashier.Instance(new Confirm(String.Format("{0}\n{1}", PosMessage.EJ_AVAILABLE_LINES, e.Usage))));
        }
Ejemplo n.º 2
0
        private static IState Instance(EJIdMismatchException e)
        {
            EJEXCEPTION = (EJException)e;

            /*if ej is changed and it is not new
             * allow only ej reports menu
             * if system under power failuere error
             * allow nothing, because power failure cannot be cleaned at this mode
             */
            try
            {
                cr.Printer.CheckPrinterStatus();
            }
            catch (PowerFailureException pfe)
            {
                switch (pfe.LastCommand)
                {
                case 40:
                case 45:
                    DisplayError(PosMessage.EJ_PASIVE_VALID_EJ_REQUIRED);
                    return(state);
                }
            }
            catch { }
            if (oldState is States.Selling || oldState is States.Payment ||
                (cr.Document != null && cr.Document.Items.Count > 0))
            {
                DisplayError(PosMessage.EJ_PASIVE_VALID_EJ_REQUIRED);
            }
            else
            {
                DisplayError(PosMessage.EJ_PASIVE_ONLY_EJ_REPORTS);
            }
            return(state);
        }
Ejemplo n.º 3
0
 private static IState Instance(EJFormatException e)
 {
     EJEXCEPTION = (EJException)e;
     if (cr.Printer.CurrentDocumentId == 0)
     {
         return(ConfirmCashier.Instance(new Confirm(PosMessage.CONFIRM_NEW_EJ_FORMAT,
                                                    new StateInstance(FormatJournal),
                                                    new StateInstance(EscapeFormatJournal))));
     }
     else
     {
         return(AlertCashier.Instance(new Confirm(PosMessage.ZREPORT_NECCESSARY_FOR_NEW_EJ, NewEJZRequired)));
     }
 }
Ejemplo n.º 4
0
        private static IState Instance(EJChangedException e)
        {
            EJEXCEPTION = (EJException)e;

            /*if login fails then it will be caught case 1 else condition
             * if sucessful login means that ej is active ej
             */
            int id = int.Parse(e.EJId);

            DisplayError(e.Message + id);

            if (cr.Document != null && cr.Document.Items.Count > 0)
            {
                if (activeEJ == "" && int.Parse(e.EJId.Trim()) < int.Parse(e.PreviousEJ))
                {
                    activeEJ = e.PreviousEJ;
                    return(Instance(new EJIdMismatchException()));
                }
                if (activeEJ != "" && activeEJ != e.EJId)
                {
                    return(Instance(new EJIdMismatchException()));
                }

                activeEJ = "";
            }

            if (cr.CurrentCashier != null)
            {
                try
                {
                    Login.SignInCashier(cr.CurrentCashier);
                    try
                    {
                        cr.Printer.PrintSubTotal(cr.Document, false);
                    }
                    catch (CmdSequenceException)
                    {
                        cr.Document.Void();
                    }
                    return(States.Start.Instance());
                }
                catch { }
            }
            state.Escape();
            return(cr.State = States.Start.Instance());
        }
Ejemplo n.º 5
0
        public static IState Instance(Exception e)
        {
            if (!(e is EJException))
            {
                return(Start.Instance());
            }
            EJEXCEPTION = (EJException)e;

            if (!(cr.State is States.ElectronicJournalError))
            {
                oldState = cr.State;
            }

            if (e is EJFormatException)
            {
                return(Instance((EJFormatException)e));
            }
            if (e is EJFiscalIdMismatchException)
            {
                return(Instance((EJFiscalIdMismatchException)e));
            }
            if (e is EJIdMismatchException)
            {
                return(Instance((EJIdMismatchException)e));
            }
            if (e is EJChangedException)
            {
                return(Instance((EJChangedException)e));
            }
            if (e is EJCommException)
            {
                return(Instance((EJCommException)e));
            }
            if (e is EJFullException)
            {
                return(Instance((EJFullException)e));
            }
            if (e is EJLimitWarningException)
            {
                return(Instance((EJLimitWarningException)e));
            }
            throw new Exception("BÝLÝNMEYEN \n EKÜ HATASI");
        }
Ejemplo n.º 6
0
 private static IState Instance(EJCommException e)
 {
     EJEXCEPTION = (EJException)e;
     DisplayError(PosMessage.EJ_NOT_AVAILABLE);
     return(state);
 }
Ejemplo n.º 7
0
 private static IState Instance(EJFiscalIdMismatchException e)
 {
     EJEXCEPTION = (EJException)e;
     return(AlertCashier.Instance(new Error(e, ValidEJRequired)));
 }