public static void RegAttendance(string userAttId, int state)
        {
            AccessToken accessToken = AccessToken.Get();
            string      URI         = Api + TimeATTEndpoint + "?access_token=" + accessToken.id;
            string      payload     = "{\"userAttId\": " + userAttId + "}";

            if (!AuthApi.CheckAccessToken(accessToken.userId, accessToken.id))
            {
                string ResponseLogin = HttpCallApi.Post(URI, payload);
                var    obj           = JsonConvert.DeserializeObject <dynamic>(ResponseLogin);
                if (obj["error"] != null)
                {
                    string errCode = obj["error"]["statusCode"];
                    string errMsg  = obj["error"]["message"];
                    Logger.WriteLog("ERROR: " + errCode + ". " + errMsg);
                }
                else
                {
                    string pergjigje = obj["pergjigje"];
                    Logger.WriteLog(pergjigje);
                }
            }
            else
            {
                AuthApi.Login();
                RegAttendance(userAttId, state);
            }
        }
 public void StartServer()
 {
     Logger.WriteLog("INFO: Starting Middlware Service...");
     server.Start();
     Logger.WriteLog("INFO: TCP server started");
     AuthApi.Login();
     zktTcpClient.ConnectZKTecoDevice();
     Accept_connection();
 }