public UserManagement(AttendanceDeviceModel attendanceDevice, IAttendanceDeviceDriver attendanceDeviceDriver, ServiceStatus serviceStatus, MessagePass throwMessage) { this._attendanceDevice = attendanceDevice; this._attendanceDeviceDriver = attendanceDeviceDriver; this._serviceStatus = serviceStatus; this.ThrowMessage = throwMessage; }
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 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 { } }
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 { } }
private async void InActiveUser() { attendanceDeviceDriver = AttendanceDeviceDriverFactory(ConfigurationManager.AppSettings["deviceTypeCode"].ToString()); //if (attendanceDeviceDriver == null || attendanceDeviceDriver.OpenConnection() == false) // return; if (attendanceDeviceDriver == null) { return; } while (_serviceStatus.IsRunning) { var obj = new Dictionary <string, string>(); obj.Add("gymid", Settings.Default.BranchId.ToString()); var data = JsonConvert.SerializeObject(obj); var url = ConfigurationManager.AppSettings["ApiUrl"].ToString() + "webappservices/GetInactiveMembers"; var queryString = new StringContent(data, Encoding.UTF8, "text/plain"); using (var client = new HttpClient()) { var result = await client.PostAsync(new Uri(url), queryString); string resultContent = await result.Content.ReadAsStringAsync(); var res = JsonConvert.DeserializeObject <LoginResponse[]>(resultContent).ToList(); _attendanceDeviceModel.LoginResponse = res; if (res != null && res.Any()) { var userManagement = new UserManagement(_attendanceDeviceModel, attendanceDeviceDriver, _serviceStatus, _syncStatus, OnThrowingMessage); bool isSuc = userManagement.UnRegisterUser(); OnThrowingMessage("In-Active Users Done Successfully", MessageType.Info); } else { OnThrowingMessage("No record found to In-Active users", MessageType.Info); } } _serviceStatus.IsRunning = false; } }
public DeviceManagement(AttendanceDeviceModel attendanceDevice, IAttendanceDeviceDriver attendanceDeviceDriver) { this._attendanceDevice = attendanceDevice; _attendanceDeviceDriver = attendanceDeviceDriver; }
public AttendanceManagement(AttendanceDeviceModel attendanceDevice, IAttendanceDeviceDriver attendanceDeviceDriver, MessagePass throwMessage) { this._attendanceDevice = attendanceDevice; this._attendanceDeviceDriver = attendanceDeviceDriver; this.ThrowMessage = throwMessage; }