Exemplo n.º 1
0
        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) { }
        }
Exemplo n.º 2
0
        private void SyncAttendance()
        {
            attendanceDeviceDriver = AttendanceDeviceDriverFactory(ConfigurationManager.AppSettings["deviceTypeCode"].ToString());
            //if (attendanceDeviceDriver == null || attendanceDeviceDriver.OpenConnection() == false)
            //    return;

            if (attendanceDeviceDriver == null)
            {
                return;
            }

            while (_serviceStatus.IsRunning)
            {
                var attendanceManagement = new AttendanceManagement(_attendanceDeviceModel, attendanceDeviceDriver, OnThrowingMessage);
                attendanceManagement.UpdateAttendance();
                _serviceStatus.IsRunning = false;
            }
            try { _SyncThread.Abort(); }
            catch { }
        }
Exemplo n.º 3
0
        private void DeleteAttendance()
        {
            attendanceDeviceDriver = AttendanceDeviceDriverFactory(ConfigurationManager.AppSettings["deviceTypeCode"].ToString());
            //if (attendanceDeviceDriver == null || attendanceDeviceDriver.OpenConnection() == false)
            //    return;
            if (attendanceDeviceDriver == null)
            {
                return;
            }
            while (_serviceStatus.IsRunning)
            {
                var attendanceManagement = new AttendanceManagement(_attendanceDeviceModel, attendanceDeviceDriver, OnThrowingMessage);
                attendanceManagement.DeleteAttendance();
                _serviceStatus.IsRunning = false;
            }

            Thread.Sleep(10000);
            this.Restart();
            //try { _deleteDataThread.Abort(); }
            //catch { }
        }