Esempio n. 1
0
        public int GetRegisteredUsersIDs(TerminalDevice device)
        {
            int userCount = 0;

            oTerminal myTerminal = new oTerminal(device.IPAddress, device.ID, device.Port, device.AccKey);

            if (myTerminal.isAlive())
            {
                myTerminal.INT_ReceiveTimeOut = 10000;
                try
                {
                    UserAdapter userAdapter = new UserAdapter();
                    userAdapter.ComputeUserID(myTerminal.GetUserIDList());
                    device.UsersIDs = userAdapter.GetIDlist();
                    if (device.UsersIDs != null)
                    {
                        userCount = device.UsersIDs.Count();
                    }
                }
                catch (Exception ex)
                {
                    DataAccess.InsertError(new ExceptionDB()
                    {
                        Date = DateTime.Now, Message = "DeviceControl-GetRegisteredUsersIDs: " + ex.Message
                    });
                }
            }

            return(userCount);
        }
Esempio n. 2
0
        public void AddUserData(Array userdata, string CardID)
        {
            if (userdata != null)
            {
                UserAdapter userAdapter = new UserAdapter((byte[])userdata);

                if (Users == null)
                {
                    Users = new List <User>();
                }

                if (!string.IsNullOrEmpty(userAdapter.GetUser().EmployeeID))
                {
                    userAdapter.GetUser().CardID = CardID;
                    if (Users.Where(x => x.EmployeeID == userAdapter.GetUser().EmployeeID&& x.CardID == userAdapter.GetUser().CardID).Count() == 0)
                    {
                        Users.Add(userAdapter.GetUser());
                    }
                }
            }
        }