Example #1
0
        private void btnRestartDevice_Click(object sender, EventArgs e)
        {
            DialogResult rslt = MessageBox.Show("Do you wish to restart the device now ??", "Restart Device", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (rslt == DialogResult.Yes)
            {
                if (objZkeeper.RestartDevice(int.Parse(tbxMachineNumber.Text.Trim())))
                {
                    ShowStatusBar("The device is being restarted, Please wait...", true);
                }
                else
                {
                    ShowStatusBar("Operation failed,please try again", false);
                }
            }
        }
Example #2
0
        private void connectToDevice(Device device)
        {
            if (device.officeCode.Equals(config) && PingDevice(device))
            {
                ZkemClient objZkeeper = null;
                try
                {
                    string ipAddress  = device.IP;
                    string port       = device.Port;
                    int    portNumber = 4370;

                    objZkeeper    = new ZkemClient(RaiseDeviceEvent);
                    device.status = objZkeeper.Connect_Net(ipAddress, portNumber);

                    if (device.status)
                    {
                        string deviceInfo = manipulator.FetchDeviceInfo(objZkeeper, int.Parse(device.DeviceId));
                        Console.WriteLine("Device at: " + ipAddress + " is now Connected");
                    }

                    Combination combination = new Combination();
                    combination.device     = device;
                    combination.objZkeeper = objZkeeper;
                    devices.Add(combination);
                    devices2.Add(device);
                    Boolean status  = GetLogsToMySql(combination);
                    Boolean status2 = GetUsersToMySql(combination);

                    if (!status && !status2)
                    {
                        Console.WriteLine("---------------------------->Restart required. Device Restarting..." + device.DeviceId);
                        Boolean returned = objZkeeper.RestartDevice(Int32.Parse(device.DeviceId.Trim()));
                        Console.WriteLine(returned);
                        objZkeeper.RestartDevice(Int32.Parse(device.DeviceId));
                    }
                    objZkeeper.Disconnect();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Example #3
0
        private void RestartDevice(ZkemClient objZkeeper, Device device)
        {
            DialogResult rslt = MessageBox.Show("Do you wish to restart the device now ??", "Restart Device", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (rslt == DialogResult.Yes)
            {
                if (objZkeeper.RestartDevice(int.Parse(device.DeviceId)))
                {
                    ShowStatusBar(device.IP + " -> " + "The device is being restarted, Please wait...", true);
                }
                else
                {
                    ShowStatusBar(device.IP + " -> " + "Operation failed,please try again", false);
                }
            }
        }
Example #4
0
        private void btnRestartDevice_Click(object sender, EventArgs e)
        {
            DialogResult rslt = MessageBox.Show("¿Se encuentra seguro que desea reiniciar esta terminal?", "Reiniciar terminal", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (rslt == DialogResult.Yes)
            {
                if (objZkeeper.RestartDevice(1))
                {
                    ShowStatusBar("La terminal se encuentra reiniciando. Por favor, espere...", true);
                    InsertarEvento("El usuario " + usuario + " ha reiniciado la terminal " + marcadores[Convert.ToInt32(cmbUbicacion.SelectedIndex)].UBICACION);
                }
                else
                {
                    ShowStatusBar("La operación ha fallado. Intentelo nuevamente.", false);
                }
            }
        }