public UserManagement(AttendanceDeviceModel attendanceDevice, IAttendanceDeviceDriver attendanceDeviceDriver, ServiceStatus serviceStatus, MessagePass throwMessage) { this._attendanceDevice = attendanceDevice; this._attendanceDeviceDriver = attendanceDeviceDriver; this._serviceStatus = serviceStatus; this.ThrowMessage = throwMessage; }
private void btnSyncAttendance_Click(object sender, EventArgs e) { try { btnActive.Enabled = true; btnDeActive.Enabled = true; btnSyncAttendance.Enabled = false; btnDeleteAttendanceLog.Enabled = true; OnGuiMessaging("SyncAttendance Button has pressed", MessageType.Info); AttendanceDeviceModel attendanceDeviceModel = new AttendanceDeviceModel(); attendanceDeviceModel.CommunicationKey = _device.CommPassword.ToString(); attendanceDeviceModel.IPAddress = _device.DeviceIp; attendanceDeviceModel.Port = _device.Port; attendanceDeviceModel.DeviceModelNo = _device.DeviceName; attendanceDeviceModel.Id = _device.DeviceId; attendanceDeviceModel.MachineNo = 1; syncThread = null; syncThread = new Synchronization(OnGuiMessaging, attendanceDeviceModel); syncThread.StartSyncAttendance(); } catch (Exception ex) { serviceLog.Error(ex.Message); } finally { btnSyncAttendance.Enabled = true; } }
public Synchronization(ServiceDelegate.DeviceSynchronizedEventHandler throwMessage, AttendanceDeviceModel attendanceDeviceModel) { _serviceStatus = new ServiceStatus(); _syncStatus = new SyncStatus(); _attendanceDeviceModel = attendanceDeviceModel; _throwMessage = throwMessage; }
private void btnDeleteAttendanceLog_Click(object sender, EventArgs e) { try { ////var answer = MessageBox.Show("Are you sure to delete all attendance log?", "Yes/no sample", MessageBoxButtons.YesNo, MessageBoxIcon.Question); ////if (answer == DialogResult.Yes) ////{ //// var thread = new Thread(() => //// { //// _czkem = new CZKEM(); //// //var connect = _czkem.Connect_Net(_device.DeviceIp, _device.Port); //// //if (connect) //// _device.IsConDevice = true; //// if (_device.IsConDevice) //// { //// _czkem.ClearGLog(1); //// _czkem.RefreshData(1); //// OnGuiMessaging("Log Cleared Successfully", MessageType.Success); //// } //// //Application.Run(); //// }); //// thread.IsBackground = true; //// thread.SetApartmentState(ApartmentState.STA); //// thread.Start(); ////} var answer = MessageBox.Show("Are you sure to delete all attendance log?", "Yes/no sample", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (answer == DialogResult.Yes) { btnActive.Enabled = true; btnDeActive.Enabled = true; btnSyncAttendance.Enabled = true; btnDeleteAttendanceLog.Enabled = false; OnGuiMessaging("Delete Button has pressed", MessageType.Info); AttendanceDeviceModel attendanceDeviceModel = new AttendanceDeviceModel(); attendanceDeviceModel.CommunicationKey = _device.CommPassword.ToString(); attendanceDeviceModel.IPAddress = _device.DeviceIp; attendanceDeviceModel.Port = _device.Port; attendanceDeviceModel.DeviceModelNo = _device.DeviceName; attendanceDeviceModel.Id = _device.DeviceId; attendanceDeviceModel.MachineNo = 1; syncThread = null; syncThread = new Synchronization(OnGuiMessaging, attendanceDeviceModel); syncThread.StartDeleteAttendance(); } } catch (Exception ex) { serviceLog.Error(ex.Message); } finally { btnDeleteAttendanceLog.Enabled = true; } }
private void SyncOperation(AttendanceDeviceModel attendanceDeviceModel) { IAttendanceDeviceDriver attendanceDeviceDriver = null; try { attendanceDeviceDriver = AttendanceDeviceDriverFactory(ConfigurationManager.AppSettings["deviceTypeCode"].ToString()); //if (attendanceDeviceDriver == null || attendanceDeviceDriver.OpenConnection() == false) // return; if (attendanceDeviceDriver == null) { return; } #region Thumbs Up //attendanceDeviceDriver.RegEvents(); #endregion #region Device Management var deviceManagement = new DeviceManagement(attendanceDeviceModel, attendanceDeviceDriver); bool isSuccess = deviceManagement.ReadyDevice(); //if (!isSuccess) return; #endregion #region UserManagement var userManagement = new UserManagement(attendanceDeviceModel, attendanceDeviceDriver, _serviceStatus, _syncStatus, OnThrowingMessage); bool isSuc = userManagement.RegisterUser(); // if (!isSuc) return; #endregion #region Attendance Synchronization var attendanceManagement = new AttendanceManagement(attendanceDeviceModel, attendanceDeviceDriver, OnThrowingMessage); attendanceManagement.UpdateAttendance(); #endregion #region Update Time OnThrowingMessage("Sync completed on device " + attendanceDeviceModel.IPAddress + " ", MessageType.Info); #endregion } catch (Exception e) { } }
private void btnActive_Click(object sender, EventArgs e) { try { btnActive.Enabled = false; btnDeActive.Enabled = true; btnSyncAttendance.Enabled = true; btnDeleteAttendanceLog.Enabled = true; OnGuiMessaging("Active Button has pressed", MessageType.Info); if (syncThread == null) { //for the first time AttendanceDeviceModel attendanceDeviceModel = new AttendanceDeviceModel(); attendanceDeviceModel.CommunicationKey = _device.CommPassword.ToString(); attendanceDeviceModel.IPAddress = _device.DeviceIp; attendanceDeviceModel.Port = _device.Port; attendanceDeviceModel.DeviceModelNo = _device.DeviceName; attendanceDeviceModel.Id = _device.DeviceId; attendanceDeviceModel.MachineNo = 1; syncThread = new Synchronization(OnGuiMessaging, attendanceDeviceModel); syncThread.Start(); } else if (syncThread._syncStatus.IsRunning) { //Stop service first OnGuiMessaging("Backend Process running.", MessageType.Info); } else { //just restart //_messageCleared(); syncThread.Restart(); } } catch (Exception ex) { serviceLog.Error(ex.Message); } finally { btnActive.Enabled = true; } }
public DeviceManagement(AttendanceDeviceModel attendanceDevice, IAttendanceDeviceDriver attendanceDeviceDriver) { this._attendanceDevice = attendanceDevice; _attendanceDeviceDriver = attendanceDeviceDriver; }
public AxAttendanceDeviceDriverColor(AttendanceDeviceModel attendanceDevice, MessagePass throwMessage) : base(attendanceDevice, throwMessage) { }
public AttendanceManagement(AttendanceDeviceModel attendanceDevice, IAttendanceDeviceDriver attendanceDeviceDriver, MessagePass throwMessage) { this._attendanceDevice = attendanceDevice; this._attendanceDeviceDriver = attendanceDeviceDriver; this.ThrowMessage = throwMessage; }
public AxAttendanceDeviceDriver(AttendanceDeviceModel attendanceDevice, MessagePass throwMessage) { this._attendanceDevice = attendanceDevice; this._throwMessage = throwMessage; axDevice = new CZKEM(); }