Example #1
0
 private void ConnectCashin()
 {
     if (!TurnOffCashInInit)
     {
         if (!CashinOK)
         {
             try
             {
                 //cashin = new CashInManager(PrefFile);
                 cashin = GetCashInManagerInstance();
                 //AssignCashInEventEx();
                 if (!CashIn.AceptorsFound)
                 {
                     Log.Error("Geldschein- und Münzprüfer nicht gefunden", new Exception());
                     CashinOK = false;
                 }
                 else
                 {
                     CashinOK = true;
                 }
             }
             catch (Exception ex)
             {
                 cashin = null;
                 Log.Error("Error initialising Cash-Hardware", ex);
             }
         }
     }
 }
Example #2
0
        public void InitializeCashIn()
        {
            Log.Debug("Init cashin");

            if (!TurnOffCashInInit)
            {
                try
                {
                    cashin = GetCashInManagerInstance();

                    if (CashIn != null && !CashIn.IsDataSetValid())
                    {
                        CashinOK = false;
                        Log.Info("Cash validator dataset is invalid!");
                        throw new CashinDatasetException("Cash validator dataset is invalid!");
                    }
                    if (CashIn != null && !CashIn.AceptorsFound)
                    {
                        Log.Error("Cash validators are not found! Geldschein- und Münzprüfer nicht gefunden", new Exception());
                        CashinOK = false;
                        if (!CashinOK)
                        {
                            AsyncConnectCashin();
                            if (!System.Diagnostics.Debugger.IsAttached)
                            {
                                throw new CashinException("Cashin is not working!");
                            }
                        }
                    }
                    else
                    {
                        CashinOK = true;
                        //  AssignCashInEventEx();
                    }
                }
                catch (CashinException e)
                {
                    throw;
                }
                catch (CashinDatasetException e)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    Log.Error("Error initialising Cash-Hardware", ex);
                }
            }
        }
Example #3
0
        public CashInManager GetCashInManagerInstance()
        {
            string mode = "Active";

            if (Active == (int)StationSr.STATION_TEST)
            {
                mode = "TestMode";
            }

            if (cashin == null)
            {
                lock (locker)
                {
                    if (cashin == null && PrefFile != null)
                    {
                        cashin = new CashInManager(PrefFile, mode);

                        cashin.CashIn += cashin_CashIn;
                        cashin.CashLimitExceededEventHandler += cashin_LimitExceeded;
                    }
                }
            }
            return(cashin);
        }