Пример #1
0
        public static IState CheckFiscalId(String FiscalId)
        {
            try
            {
                CashRegister.FiscalRegisterNo = FiscalId.Trim();
                PosConfiguration.Set("FiscalId", CashRegister.FiscalRegisterNo);
                CashRegister.Instance();
            }
            catch (FiscalIdException)
            {
                return(Instance());
            }
            catch (Exception)
            {
            }

            return(States.Start.Instance());
        }
Пример #2
0
        public static IState AcceptFiscalId(int fiscalId)
        {
            if (fiscalId <= 0 || fiscalId > 99999999)
            {
                cr.State = States.AlertCashier.Instance(new Confirm(PosMessage.INVALID_FISCAL_ID,
                                                                    new StateInstance(Instance)));
            }
            else
            {
                try
                {
                    cr.Printer.StartFM(fiscalId);

                    cr.State = States.AlertCashier.Instance(new Confirm(PosMessage.FM_STARTED_SUCCSFLY,
                                                                        new StateInstance(Instance)));
                    PosConfiguration.Set("FiscalId", String.Format("FA{0:D8}", fiscalId));
                }
                catch (PrinterException ex)
                {
                    if (ex.ErrorCode == 22)
                    {
                        cr.State = States.AlertCashier.Instance(new Confirm(PosMessage.CERTIFICATES_CANNOT_UPLOAD));
                    }
                    else
                    {
                        cr.State = States.AlertCashier.Instance(new Confirm(PosMessage.FM_CANNOT_STARTED));
                    }

                    cr.State = States.EnterInteger.Instance(PosMessage.START_FM, fiscalId,
                                                            new StateInstance <int>(AcceptFiscalId),
                                                            new StateInstance(Instance));
                }
            }

            return(cr.State);
        }