Example #1
0
        /// <summary>
        /// 重启设备
        /// </summary>
        /// <param name="device_ip"></param>
        /// <returns></returns>
        public ResultSet RestartDevice(string device_ip)
        {
            ResultSet result       = new ResultSet();
            int       successCount = 0;
            int       errorCount   = 0;

            try
            {
                if (Connect(device_ip))
                {
                    if (axCZKEM1.RestartDevice(iMachineNumber))
                    {
                        log.Debug("restart device [" + device_ip + "] is ok.");
                        successCount++;
                    }
                    else
                    {
                        log.Debug("restart device [" + device_ip + "] is fail.");
                        errorCount++;
                    }
                    Close();
                }
            }
            catch (Exception ex)
            {
                log.Fatal(ex);
                _resultset = new ResultSet
                {
                    SeccessFlag = false,
                    Result      = ErrorCode.ToString(),
                    Description = string.Format("Try Catched Error {0}", ex.Message)
                };
            }

            return(new ResultSet
            {
                SeccessFlag = true,
                Result = ErrorCode.ToString(),
                Description = string.Format("Success Count{0}, Error Count {1}", successCount.ToString(), errorCount.ToString())
            });
        }