Esempio n. 1
0
        internal SQLPointAdapter(String connString)
        {
            try
            {
                sqlConnection = new SqlConnection(connString);

                string timeout = PosConfiguration.Get("PromotionClientTimeout");

                if (timeout == null || !Parser.TryInt(timeout.Trim(), out connectionTimeout))
                {
                    connectionTimeout = 2000;
                }

                //Test connection
                GetSqlDbValue("SELECT Count(CustomerCode) FROM TblDaily");
            }
            catch (Exception ex)
            {
                if (HasOfflineRecords)
                {
                    StartDBController();
                }
            }
            finally
            {
                if (sqlConnection.State == ConnectionState.Open)
                {
                    sqlConnection.Close();
                }
            }
        }
Esempio n. 2
0
        private static IState ExitService(String password)
        {
            try
            {
                cr.Printer.ExitServiceMode(password);

                cr.SetPrinterPort(PosConfiguration.Get("PrinterComPort"));
                CashRegister.LoadCurrentSettings();
                cr.State = States.Start.Instance();
            }
            catch (CashierAutorizeException cae)
            {
                cr.State = AlertCashier.Instance(new Error(cae,
                                                           new StateInstance(Continue),
                                                           new StateInstance(Continue)));
                cr.Log.Error("CashierAutorizeException occured. {0}", cae.Message);
            }
            catch (CmdSequenceException ex)
            {
                cr.State = AlertCashier.Instance(new Error(ex,
                                                           new StateInstance(Continue),
                                                           new StateInstance(Continue)));
                cr.Log.Error("CmdSequenceException occured. {0}", ex.Message);
            }
            catch (SVCPasswordOrPointException ex)
            {
                cr.State = ConfirmCashier.Instance(new Error(ex,
                                                             new StateInstance(Continue),
                                                             new StateInstance(Continue)));
                cr.Log.Error("SVCPasswordOrPointException occured. {0}", ex);
            }

            return(cr.State);
        }
Esempio n. 3
0
        protected override void PreProcess()
        {
            try
            {
                lastKeyPressed = DateTime.Now;
                KeyMap.Load();
                Debugger.Instance().AppendLine("Started Display: " + DateTime.Now.ToLongTimeString());

                DisplayAdapter.Instance();
                DisplayAdapter.Both.Show(PosMessage.PLEASE_WAIT);
                Application.DoEvents();
                Debugger.Instance().AppendLine("Finished Display" + DateTime.Now.ToLongTimeString());

                if (PosConfiguration.Get("BarcodeComPort") != "")
                {
                    ConnectBarcode();
                }

                //Console.CancelKeyPress += new ConsoleCancelEventHandler(pos_OnClosed);

                CashRegister.Instance();
                CashRegister.Printer.DateTimeChanged += new EventHandler(Printer_DateTimeChanged);

                Debugger.Instance().AppendLine("Started BackgroundWorker: " + DateTime.Now.ToLongTimeString());
                Thread thread = new Thread(new ThreadStart(BackgroundWorker.Start));
                thread.Name         = "BackgroundWorker";
                thread.IsBackground = true;
                thread.Priority     = ThreadPriority.BelowNormal;
                thread.Start();
            }
            catch (UnauthorizedAccessException ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        protected override Boolean BlockRemoved()
        {
            try
            {
                attemptCount++;
                cr.Printer.CheckPrinterStatus();
                return(true);
            }
            catch (ServiceRequiredException sre)
            {
                Login.LogoutManager();
                //cr.State = ServiceMenu.Instance();
                States.AlertCashier.Instance(new Confirm(sre.Message));
                return(true);
            }
            catch (Exception ex)
            {
                if (ex.Message == PosMessage.PRINTER_CONNETTION_ERROR || ex is System.Net.Sockets.SocketException ||
                    (attemptCount == 1 && ex is TimeoutException))
                {
                    DisplayAdapter.Cashier.Show(PosMessage.PLEASE_WAIT);
                    cr.SetPrinterPort(PosConfiguration.Get("PrinterComPort"));
                    Login.LogoutManager();
                    cr.State     = States.Start.Instance();
                    attemptCount = 0;
                    return(true);
                }

                return(false);
            }
        }
Esempio n. 5
0
        public ExternalDisplay()
        {
            String portName = PosConfiguration.Get("DisplayComPort");

            serialPort = new SerialPort(portName);
            if (!serialPort.IsOpen)
            {
                serialPort.ReadTimeout = 2048;

                try
                {
                    serialPort.Open();
                }
                catch (System.IO.IOException ex)
                {
                    if (!serialPort.IsOpen)
                    {
                        throw ex;
                    }
                }

                //Write(initializeDisplay, 0, 3);
                //serialPort.Write(horizontalScrollMode, 0, horizontalScrollMode.Length);
                //System.Threading.Thread.Sleep(100);
                //serialPort.Write(normalMode, 0, normalMode.Length);
            }
        }
Esempio n. 6
0
        public TcpService()
        {
            try
            {
                String tcpIp = PosConfiguration.Get("TCPIp");
                int    port  = int.Parse(PosConfiguration.Get("TCPPort"));

                String[] split = tcpIp.Split('.');

                if (split.Length != 4)
                {
                    throw new Exception("IP not accepted");
                }

                byte[] ip = new byte[4];

                for (int i = 0; i < split.Length; i++)
                {
                    ip[i] = Convert.ToByte(split[i].Trim());
                }
                System.Net.IPAddress addr = new System.Net.IPAddress(ip);

                listener = new TcpListener(addr, port);

                listener.Start();

                //wait for client
                System.Threading.ThreadStart ts = new System.Threading.ThreadStart(AccepClient);
                threadClient = new System.Threading.Thread(ts);
                threadClient.Start();
            }
            catch
            {
            }
        }
Esempio n. 7
0
        internal static string GetAutoOrderKey()
        {
            string pwd     = PosConfiguration.Get("FiscalId") + "HUGIN YAZILIM TEKNOLOJILERI";
            string hashkey = PosConfiguration.Get("FiscalId").Substring(2);

            return(Encrypt(hashkey, pwd));
        }
Esempio n. 8
0
 public HYDisplay()
 {
     try
     {
         String portName = PosConfiguration.Get("DisplayComPort");
         serialPort = new SerialPort(portName);
         if (!serialPort.IsOpen)
         {
             serialPort.ReadTimeout = 2048;
             serialPort.Open();
             Write(ledsOff, 0, 6);
             Write(initializeDisplay, 0, 3);
             serialPort.Write(horizontalScrollMode, 0, horizontalScrollMode.Length);
             System.Threading.Thread.Sleep(100);
             serialPort.Write(normalMode, 0, normalMode.Length);
         }
     }
     catch (UnauthorizedAccessException ex)
     {
         throw ex;
     }
     catch
     {
         Display.Log.Fatal("HYDisplay:HyDisplay - Exception {0} is {1}", serialPort.PortName, serialPort.IsOpen ? "Open" : "Closed");
     }
 }
Esempio n. 9
0
        private Display(Target mode)
        {
            this.mode = mode;

            // Screens
            screens = Screen.AllScreens;

            primaryScreenId   = 0;
            secondaryScreenId = 1;

            if (screens.Length > 1 &&
                PosConfiguration.ScreenIdentity == 2)
            {
                primaryScreenId   = 1;
                secondaryScreenId = 0;
            }

            // Font
            pfc = new PrivateFontCollection();
            pfc.AddFontFile(@"Resources/MATRS.TTF");

            // Primary Screen
            touchForm = new CashierForm();
            System.Drawing.Rectangle boundsP = screens[primaryScreenId].Bounds;
            touchForm.SetBounds(boundsP.X, boundsP.Y, boundsP.Width, boundsP.Height);
            touchForm.StartPosition = FormStartPosition.Manual;
            touchForm.Show();
            touchForm.Focus();
            touchForm.ConsumeKey     += new ConsumeKeyHandler(touchForm_ConsumeKey);
            touchForm.DisplayClosed  += new EventHandler(touchForm_DisplayClosed);
            touchForm.SaleSelected   += new SalesSelectedHandler(touchForm_SaleSelected);
            touchForm.SalesFocusLost += new EventHandler(touchForm_SalesFocusLost);

            // Secondary Screen
            if (screens.Length > 1)
            {
                try
                {
                    customerForm = new CustomerForm();

                    System.Drawing.Rectangle bounds = screens[secondaryScreenId].Bounds;
                    customerForm.SetBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height);
                    customerForm.StartPosition = FormStartPosition.Manual;
                    customerForm.Show();
                }
                catch { }
            }

            // External Display
            if (PosConfiguration.Get("DisplayComPort") != "")
            {
                try
                {
                    external = new ExternalDisplay();
                }
                catch { }
            }
        }
Esempio n. 10
0
        public SerialDisplay()
        {
            try
            {
                String portName = PosConfiguration.Get("DisplayComPort");
                serialPort           = new SerialPort(portName);
                serialPort.Handshake = Handshake.RequestToSend;
                stack = new List <string>();

                if (!serialPort.IsOpen)
                {
                    serialPort.Open();
                    //try
                    //{
                    //    serialPort.Open();
                    //}
                    //catch (IOException ioe)
                    //{
                    //    // To circumvent WindowsCE 6.0 bug
                    //    if (ioe.StackTrace.IndexOf("SerialStream.SetBufferSizes") == -1)
                    //        throw ioe;
                    //}
                    TrySerial();
                    serialPort.Encoding = PosConfiguration.DefaultEncoding;
                    //serialPort.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived);
                }
                System.Threading.Thread serialThread = new System.Threading.Thread(delegate() { KeyUp(); });
                serialThread.IsBackground = true;
                serialThread.Start();
            }
            catch (NotSerialException nse)
            {
                if (serialPort.IsOpen)
                {
                    serialPort.Close();
                }
                throw nse;
            }
            catch (UnauthorizedAccessException ex)
            {
                throw ex;
            }
            catch (System.IO.IOException)
            {
                throw new Exception("DÝSPLAY PORTU ARIZALI");
            }
            catch (Exception)
            {
                if (Display.Log == null)
                {
                    return;
                }
                Display.Log.Fatal("HYDisplay:HyDisplay - Exception {0} is {1}", serialPort.PortName, serialPort.IsOpen ? "Open" : "Closed");
                //if (cr.Printer == null) return;
                //cr.Printer.PrintRemark(PosMessage.CAN_NOT_ACCESS_TO_DISPLAYS);
                //CashRegister.Void();
            }
        }
Esempio n. 11
0
        public PromotionClient()
        {
            string timeout = PosConfiguration.Get("PromotionClientTimeout");

            if (timeout == null || !Parser.TryInt(timeout.Trim(), out connectionTimeout))
            {
                connectionTimeout = 2000;
            }

            PromotionServer.Settings.Load();
        }
Esempio n. 12
0
        private FiscalPrinter()
        {
            RegisterId = PosConfiguration.Get("RegisterId");

            guiDocument = new GuiPrinterForm();
            Formatter.SetCoordinates();
            toResponse = new PrinterResponse();

            lastz             = LastZReportNo;
            lastZReportDate   = LastZReportDate;
            currentDocumentId = CurrentDocumentId;
        }
Esempio n. 13
0
        protected override bool BlockRemoved()
        {
            Exception exPrinter = null;

            try
            {
                cr.Printer.CheckPrinterStatus();
                if (cr.Printer.GetLastDocumentInfo(false).Type == ReceiptTypes.VOID)
                {
                    cr.Document.Void();
                }
                else
                {
                    cr.Document.CloseWithoutPrint();
                }

                return(true);
            }
            catch (IncompletePaymentException ipe)
            {
                throw ipe;
            }
            catch (Exception ex)
            {
                exPrinter = ex;
            }


            if (exPrinter != null)
            {
                try
                {
                    if (exPrinter.Message == PosMessage.PRINTER_CONNETTION_ERROR || exPrinter is System.Net.Sockets.SocketException)
                    {
                        DisplayAdapter.Cashier.Show(PosMessage.PLEASE_WAIT);
                        cr.SetPrinterPort(PosConfiguration.Get("PrinterComPort"));

                        // After established new connection, re-login manager
                        Login.LogoutManager();

                        // Check if ECR voided or completed last document, if document is not closed on CEPOS already
                        cr.CheckDocumentAfterReConnected();

                        //cr.State = States.Start.Instance();
                        return(true);
                    }
                }
                catch { }
            }
            return(false);
        }
Esempio n. 14
0
 private static IState ShutdownPOS(string pass)
 {
     if (PosConfiguration.Get("ServicePassword") == pass)
     {
         DisplayAdapter.Cashier.Show(PosMessage.PROGRAM_CLOSING);
         System.Threading.Thread.Sleep(2500);
         Chassis.CloseApplication();
         return(cr.State);
     }
     else
     {
         return(cr.State = AlertCashier.Instance(new Confirm(PosMessage.INVALID_PASS_ENTRY, Instance, Instance)));
     }
 }
Esempio n. 15
0
        public static void Start()
        {
            System.Threading.Thread.Sleep(200);
            DocumentFileHelper[] orders = null;
            int sleepTime = 500;

            if (!Parser.TryInt(PosConfiguration.Get("SleepTime"), out sleepTime))
            {
                sleepTime = 500;
            }

            while (true)
            {
                if (Chassis.Engine.Terminate)
                {
                    break;
                }

                try
                {
                    orders = DocumentFileHelper.GetOpenOrders();
                }
                catch (Exception ex)
                {
                    Debugger.Instance().AppendLine("Order Error: " + ex.Message);
                }
                if (orders != null && orders.Length > 0)
                {
                    try
                    {
                        AutoLoadOrders(orders);
                    }
                    catch (Exception ex)
                    {
                        Debugger.Instance().AppendLine("Order Error: " + ex.Message);
                    }
                }
                else
                {
                    DisplayAdapter.Instance().LedOff(Leds.Order);
                }

                Thread.Sleep(sleepTime);
                while (cr.State == null)
                {
                    Thread.Sleep(200); //I wish this had a comment
                }
            }
        }
Esempio n. 16
0
        //private static readonly String alertTimeoutStr = PosConfiguration.Get("CashierAlertTimeout");

        #region Instance
        public static void SetTimeouts()
        {
            if (alertTimeout == -1)
            {
                try
                {
                    String alertTimeoutStr = PosConfiguration.Get("CashierAlertTimeout");
                    alertTimeout = (int)(decimal.Parse(alertTimeoutStr) * 1000m);
                }
                catch
                {
                    alertTimeout = 1000;
                }
            }
        }
Esempio n. 17
0
        public HuginDisplay()
        {
            try
            {
                String portName = PosConfiguration.Get("DisplayComPort").Substring(1);
                serialPort = new SerialPort(portName, 19200);

                stack = new List <string>();

                if (!serialPort.IsOpen)
                {
                    serialPort.Open();
                    TrySerial();
                    serialPort.Encoding = PosConfiguration.DefaultEncoding;
                    Clear();
                }
                System.Threading.Thread serialThread = new System.Threading.Thread(delegate() { KeyUp(); });
                serialThread.IsBackground = true;
                serialThread.Start();
            }
            catch (NotSerialException nse)
            {
                if (serialPort.IsOpen)
                {
                    serialPort.Close();
                }
                throw nse;
            }
            catch (UnauthorizedAccessException ex)
            {
                throw ex;
            }
            catch (System.IO.IOException ex)
            {
                throw new Exception("DÝSPLAY PORTU ARIZALI");
            }
            catch (Exception ex)
            {
                if (Display.Log == null)
                {
                    return;
                }
                Display.Log.Fatal("HYDisplay:HyDisplay - Exception {0} is {1}", serialPort.PortName, serialPort.IsOpen ? "Open" : "Closed");
                //if (cr.Printer == null) return;
                //cr.Printer.PrintRemark(PosMessage.CAN_NOT_ACCESS_TO_DISPLAYS);
                //CashRegister.Void();
            }
        }
Esempio n. 18
0
 public static IDisplay Instance()
 {
     if (display == null)
     {
         String vga = PosConfiguration.Get("VGA");
         if (vga == "Customer")
         {
             display = new Display(new GuiDisplay(), new GraphicalDisplay(), Target.Both);
         }
         else
         {
             display = display = new GuiDisplay();
         }
     }
     return(display);
 }
Esempio n. 19
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());
        }
Esempio n. 20
0
 public void Reset()
 {
     try
     {
         if (IsPaused)
         {
             return;
         }
         serialPort.Close();
         serialPort.PortName = PosConfiguration.Get("DisplayComPort");
         serialPort.Open();
         serialPort.Write(initializeDisplay, 0, 3);
     }
     catch (Exception)
     {
         Display.Log.Fatal("HyDisplay.Reset Exception occurred. {0} is {1}", serialPort.PortName, serialPort.IsOpen ? "Open" : "Closed");
         //TODO: printerdan Hata mesaji ver?
     }
 }
Esempio n. 21
0
 public void Reset()
 {
     try
     {
         if (IsPaused)
         {
             return;
         }
         serialPort.Close();
         serialPort.PortName = PosConfiguration.Get("DisplayComPort").Substring(1);
         serialPort.Open();
         messageDisplaying = "".PadLeft(20, placer);
     }
     catch (Exception)
     {
         Display.Log.Fatal("HuginDisplay.Reset Exception occurred. {0} is {1}", serialPort.PortName, serialPort.IsOpen ? "Open" : "Closed");
         //TODO: printerdan Hata mesaji ver?
     }
 }
Esempio n. 22
0
        public void LoadTemplate()
        {
            //not to break initialization, try-catch blocks added to LoadLabel(), LoadCell() and twice in LoadTemplate()
            //LoadCell(XPath.SALE_COLUMNCELL, dgSales.ColumnHeadersDefaultCellStyle);
            //LoadCell(XPath.SALE_ROWCELL, dgSales.RowsDefaultCellStyle);
            LoadLabel(XPath.CURRENT_CUST1, lblFirstMessage);
            LoadLabel(XPath.CURRENT_CUST2, lblSecondMessage);

            try
            {
                if (PosConfiguration.Get("AdvertisementPath") != "")
                {
                    string   adsPath = PosConfiguration.Get("AdvertisementPath");
                    string[] ads     = adsPath.Split(',');
                    string   path    = ads[0];
                    adsTimeout = long.Parse(ads[1]);
                    EnableAdvertisementPanel(path);
                }
            }
            catch { }
        }
Esempio n. 23
0
 internal static void ConnectBarcode()
 {
     try
     {
         String newLine = PosConfiguration.BarcodeTerminator;
         if (newLine == "")
         {
             newLine = "\r\n";
         }
         String barcodeComPortName = PosConfiguration.Get("BarcodeComPort");
         barcodeComPort             = new SerialPort(barcodeComPortName);
         barcodeComPort.NewLine     = newLine;
         barcodeComPort.ReadTimeout = 3000;
         if (!barcodeComPort.IsOpen)
         {
             barcodeComPort.Open();
         }
         barcodeComPort.DataReceived += new SerialDataReceivedEventHandler(serial_DataReceived);
     }
     catch { } //log not ready
 }
Esempio n. 24
0
        public void Connect()
        {
            string[] scaleParams = PosConfiguration.Get("ScaleComPort").Split(',');

            string portName = scaleParams[0];

            if (scaleParams.Length > 1)
            {
                request = scaleParams[1];
            }

            serialPort              = new SerialPort(portName);
            serialPort.ReadTimeout  = 1500;
            serialPort.WriteTimeout = 1500;

            if (serialPort.IsOpen)
            {
                serialPort.Close();
            }
            serialPort.Open();
        }
Esempio n. 25
0
        public static IDisplay Instance()
        {
            if (display == null)
            {
                try
                {
                    if (String.IsNullOrEmpty(PosConfiguration.Get("DisplayComPort")))
                    {
                        display = GUI.Display.Instance();
                        return(display);
                    }
                    IDisplay d;

                    d = new SerialDisplay();

                    String vga = PosConfiguration.Get("VGA");
                    if (vga == "Customer")
                    {
                        display = new Display(d,
                                              GUI.Display.Instance(Target.Customer),
                                              Target.Both);
                    }
                    else if (vga == "Cashier")
                    {
                        display = new Display(d,
                                              GUI.Display.Instance(Target.Cashier),
                                              Target.Both);
                    }
                    else
                    {
                        display = new SerialDisplay();
                    }
                }
                catch (NotSerialException)
                {
                    display = new HYDisplay();
                }
            }
            return(display);
        }
Esempio n. 26
0
        public void LoadTemplate()
        {
            //not to break initialization, try-catch blocks added to LoadLabel(), LoadCell() and twice in LoadTemplate()
            LoadLabel(XPath.HEAD_FIRM, lblLogo);

            LoadCell(XPath.SALE_COLUMNCELL, dgSales.ColumnHeadersDefaultCellStyle);
            LoadCell(XPath.SALE_ROWCELL, dgSales.RowsDefaultCellStyle);
            LoadLabel(XPath.CURRENT_CUST1, lblFirstMessage);
            LoadLabel(XPath.CURRENT_CUST2, lblSecondMessage);
            LoadLabel(XPath.CUST_INFO, lblCustomer);
            LoadLabel(XPath.ADJ_TITLE, lblAdjustment);
            LoadLabel(XPath.ADJ_PRODUCT_TITLE, lblProductAdjustment);
            LoadLabel(XPath.ADJ_PRODUCT_VAL, lblProductAdjustAmount);
            LoadLabel(XPath.ADJ_SUB_TITLE, lblSubtotalAdjustment);
            LoadLabel(XPath.ADJ_SUB_VAL, lblSubtotalAdjustAmount);
            LoadLabel(XPath.ADJ_TOTAL_TITLE, lblTotalAdjustment);
            LoadLabel(XPath.ADJ_TOTAL_VAL, lblTotalAdjustAmount);
            LoadLabel(XPath.DOC_ID_TITLE, lblDocument);
            LoadLabel(XPath.DOC_ID_VAL, lblDocumentId);
            LoadLabel(XPath.DOC_DATE_TITLE, lblDate);
            LoadLabel(XPath.DOC_DATE_VAL, lblDocumentDate);
            LoadLabel(XPath.DOC_TIME_TITLE, lblTime);
            LoadLabel(XPath.DOC_TIME_VAL, lblDocumentTime);
            LoadLabel(XPath.DOC_SUBTOTAL_TITLE, lblSubTotal);
            LoadLabel(XPath.DOC_SUBTOTAL_VAL, lblSubtotalValue);

            try
            {
                if (PosConfiguration.Get("AdvertisementPath") != "")
                {
                    string   adsPath = PosConfiguration.Get("AdvertisementPath");
                    string[] ads     = adsPath.Split(',');
                    string   path    = ads[0];
                    adsTimeout = long.Parse(ads[1]);
                    EnableAdvertisementPanel(path);
                }
            }
            catch { }
        }
Esempio n. 27
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);
        }
Esempio n. 28
0
        internal Logger(LogType type)
        {
            this.logType = type;

            switch (type)
            {
            case LogType.Main:
                this.mainLogPath    = PosConfiguration.ArchivePath + MainLogName;
                this.dailyLogPrefix = MainLogPrefix;
                break;

            case LogType.Void:
                this.mainLogPath    = PosConfiguration.ArchivePath + VoidedLogName;
                this.dailyLogPrefix = VoidedLogPrefix;
                break;

            case LogType.Return:
                this.mainLogPath    = PosConfiguration.ArchivePath + ReturnsLogName;
                this.dailyLogPrefix = ReturnsLogPrefix;
                break;

            case LogType.LastDocument:
                this.mainLogPath = PosConfiguration.ArchivePath + DocumentLogName;
                break;
            }
            sequenceNumber = GetSequenceNumber(mainLogPath + suffix) + 1;

            if (PosConfiguration.Get("Logger") == "1" && type != LogType.LastDocument)
            {
                logFormatter = new InterLoger();
            }
            else
            {
                logFormatter = new HuginLogger();
            }

            defaultFormatter = new HuginLogger();
        }
Esempio n. 29
0
 public override void OnEntry()
 {
     if (cr.State == state)
     {
         return;
     }
     autoEnter = 0;
     if ((cr.State is List))
     {
         autoEnter = PosConfiguration.GetListAutoSelect(cr.State);
     }
     if (autoEnter > 0)
     {
         ts.lastKeyPressed = CashRegisterInput.lastKeyPressed;
         if (ts.tmr == null)
         {
             ts.tmr = new Timer(timerCallback, ts, autoEnter, Timeout.Infinite);
         }
         else
         {
             ts.tmr.Change(autoEnter, System.Threading.Timeout.Infinite);
         }
     }
 }
Esempio n. 30
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);
        }