예제 #1
0
        public bool ClearDevice()
        {
            MyLogger.GetInstance.Info("ZKDevice.ClearDevice() - Clear Device IP: " + this.Device.IP);

            bool result = false;

            ConnectDevice();

            if (bIsConnected == false)
            {
                return(result);
            }

            int idwErrorCode = 0;

            axCZKEM1.EnableDevice(iMachineNumber, false);//disable the device
            if (axCZKEM1.ClearGLog(iMachineNumber))
            {
                if (axCZKEM1.RefreshData(iMachineNumber))
                {
                    //the data in the device should be refreshed
                    result = true;
                    MyLogger.GetInstance.Debug("ZKDevice.ClearDevice() - All att Logs have been cleared from teiminal!.");
                }
            }
            else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MyLogger.GetInstance.Debug("ZKDevice.ClearDevice() - Operation failed,ErrorCode=" + idwErrorCode.ToString());
            }
            axCZKEM1.EnableDevice(iMachineNumber, true);//enable the device

            return(result);
        }
예제 #2
0
        private void ClearLogs(String IpAddress, int MachineNo = 1)
        {
            if (!CheckStatus(IpAddress))
            {
                return;
            }


            axCZKEM1.ClearGLog(MachineNo);
        }
예제 #3
0
        /************************************
        *   clear all record/log/attendance method
        ************************************/
        public bool ClearAttLogAll()
        {
            if (!_bConnected)
            {
                return(false);
            }
            var bClear = false;

            //disable the device
            axCZKEM1.EnableDevice(_con.MachineNo, false);

            if (axCZKEM1.ClearGLog(_con.MachineNo))
            {
                axCZKEM1.RefreshData(_con.MachineNo);//the data in the device should be refreshed
                bClear = true;
            }
            else
            {
                axCZKEM1.GetLastError(ref _idwErrorCode);
            }
            //enable device
            axCZKEM1.EnableDevice(_con.MachineNo, true);
            return(bClear);
        }
예제 #4
0
        /// <summary>
        /// 清除所有记录(考勤/门禁/用餐)
        /// </summary>
        /// <param name="device_ip"></param>
        /// <returns></returns>
        public ResultSet ClearEventLog(string device_ip)
        {
            try
            {
                log.Info(string.Format("Function : ClearEventLog Start, device_ip {0}", device_ip));

                if (Connect(device_ip))
                {
                    log.Info(string.Format("ZKSoftware API : axCZKEM1.ClearGLog"));
                    if (axCZKEM1.ClearGLog(iMachineNumber))
                    {
                        //the data in the device should be refreshed
                        log.Info(string.Format("ZKSoftware API : axCZKEM1.RefreshData"));
                        axCZKEM1.RefreshData(iMachineNumber);

                        _resultset = new ResultSet
                        {
                            SeccessFlag = true,
                            Result      = ErrorCode.ToString(),
                            Description = string.Format("All att Logs have been cleared from teiminal! Success")
                        };
                    }
                    else
                    {
                        axCZKEM1.GetLastError(ref ErrorCode);
                        _resultset = new ResultSet
                        {
                            SeccessFlag = false,
                            Result      = ErrorCode.ToString(),
                            Description = string.Format("Operation failed,ErrorCode: {0} Error", ErrorCode.ToString())
                        };
                    }
                }
                else
                {
                    _resultset = new ResultSet
                    {
                        SeccessFlag = false,
                        Result      = device_ip,
                        Description = string.Format("Can not connect to the device. please check it.")
                    };
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
                _resultset = new ResultSet
                {
                    SeccessFlag = false,
                    Result      = ErrorCode.ToString(),
                    Description = string.Format("Try Catched Error {0}", ex.Message)
                };
            }
            finally
            {
                Close();
                log.Info(string.Format("Function : ClearEventLog finish"));
            }

            return(_resultset);
        }