Exemplo n.º 1
0
        private bool CheckTabTerminalHardware(IPrefSupplier pref, string mode)
        {
            bool result = false;

            try
            {
                if (TabTerminal.TabTerminal.CheckTabBoard())
                {
                    result = true;
                    Type t = Type.GetType("Nbt.Services.Scf.CashIn.Validator.TabTerminal.TabTerminal");
                    if (t != null)
                    {
                        AValidator v = (AValidator)Activator.CreateInstance(t, new object[] { pref, "Validator", mode });
                        if (v != null)
                        {
                            ValFound = v.ValFound;
                            validators.Add(v);
                        }
                    }
                }
            }
            catch
            {
            }

            return(result);
        }
Exemplo n.º 2
0
        public ValidatorComposite(IPrefSupplier pref, string mode)
        {
            string validatorKey = "Validator";
            string validator;

            ValFound = false;
            bool validatorFound = false;


            if (pref != null && pref.Count() > 0)
            {
                if (CheckTabTerminalHardware(pref, mode))
                {
                }
                else
                {
                    for (int i = 1; i < CashInSettings.Default.NumOfValidators; i++)
                    {
                        if ((validator = pref.GetStringEntry(validatorKey + i + "_Type")) != null)
                        {
                            validatorFound = true;
                            try
                            {
                                Type t = Type.GetType(this.GetType().Namespace + '.' + validator);
                                if (t != null)
                                {
                                    AValidator v = (AValidator)Activator.CreateInstance(t, new object[] { pref, validatorKey + i, mode });
                                    if (!ValFound && v != null)
                                    {
                                        ValFound = v.ValFound;
                                    }
                                    validators.Add(v);
                                }
                                else
                                {
                                    Log.Error("Could not create an instance of class:" + this.GetType().Namespace + '.' + validator);
                                }
                            }
                            catch (Exception e)
                            {
                                Log.Error("In ValidatorComposite.", e);
                            }
                        }
                        else if (!validatorFound)
                        {
                            ValFound = true;
                        }
                    }
                }

                foreach (AValidator v in validators)
                {
                    v.CashIn += this.Refresh;
                    v.CashLimitExceededEventHandler += this.OnCashLimitExceeded;
                    Log.Debug("validator:" + v.ToString() + ",credit=" + v.GetCredit() + ",enable=" + v.IsEnabled());
                }
            }
        }
Exemplo n.º 3
0
 public bool RemoveValidator(AValidator validator)
 {
     return(validators.Remove(validator));
 }
Exemplo n.º 4
0
 public bool AddValidator(AValidator validator)
 {
     validators.Add(validator);
     return(true);
 }