public bool FlushDevice() { string logMsg = ""; zkemkeeper.CZKEM axCZKEM1 = new zkemkeeper.CZKEM(); try { lock (busy) { if (ui.isLoggingUI) { ui.ChangeStatus(devNo, "Flushing...", Color.Blue); } bool bIsConnected = axCZKEM1.Connect_Net(devIP, 4370); // 4370 is port no of attendance machine if (bIsConnected == true) { //log = "Turnstile[" + (device+1) + "]: Device Connected Successfully\n"; axCZKEM1.ClearDataEx(0, "user"); axCZKEM1.ClearDataEx(0, "userauthorize"); axCZKEM1.Disconnect(); logMsg = logMsg + "Turnstile[" + (devNo + 1) + "]: Device Clear Successfully\n"; log.LogText(logMsg); return(true); } else { logMsg = logMsg + "Turnstile[" + (devNo + 1) + "]: Device Not Cleared/Connected\n"; log.LogText(logMsg); return(false); } } } catch (Exception ex) { try { axCZKEM1.Disconnect(); } catch (Exception exx) { log.LogText("Turnstile[" + (devNo + 1) + "]: Exception inside FlushDevice: " + exx.Message.ToString() + System.Environment.NewLine); Disconect(); } logMsg = logMsg + "Turnstile[" + (devNo + 1) + "]: Device Clear/Connect Error: " + ex.Message.ToString(); log.LogText(logMsg); return(false); } }