Пример #1
0
        /// <summary>
        /// Adds a tag to the list of allowed RFID tags.
        /// </summary>
        /// <param name="tag">Tag to be added.</param>
        public void addTag(String tag)
        {
            Person person = new Person();
            Console.WriteLine("\n Tag [" + tag + "]");
            Console.Write("Enter name of owner : ");

            String input = "";
            input = Console.ReadLine();

            person.rfid = tag;
            person.name = input;
            person.email = person.name + "@gmail.com";
            person.birthday = "2000-00-00";

            Console.WriteLine(person.ToString());

            if (personHandler.RegisterPerson(person))
            {
                Logger.Log("[Registred][" + tag + "] " + person.name);
                fileHandler.WriteToFile(personHandler);
            }
        }
Пример #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tag"></param>
        public bool UpdatePerson(Person person)
        {
            foreach (Person registredPerson in personDictionary)
            {
                if (registredPerson.rfid == person.rfid)
                {
                    Logger.Log("Success, Person is now updated");
                    personDictionary.Remove(registredPerson);
                    personDictionary.Add(person);
                    return true;
                }
            }

            Logger.Err("Error, Person is not registred");
            return false;
        }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tag"></param>
        public bool RegisterPerson(Person person)
        {
            foreach (Person registredPerson in personDictionary)
            {
                if (registredPerson.rfid == person.rfid)
                {
                    return false;
                }
            }

            Logger.Err("Success, Person is now registred");
            personDictionary.Add(person);
            return true;
        }