public void ProcessResponse(BMC.Business.NetworkService.EmployeeMasterCardThreadDataResponse threadData) { if (_requestCollection.Count <= 0) { return; } lock (_lockRes) { if (mEvent.WaitOne(NetworkServiceSettings.DBHitWaitTime)) { return; } if (_requestCollection.ContainsKey(threadData.MessageID)) { EmployeeMasterCardThreadData Requestitem = _requestCollection[threadData.MessageID]; if (threadData.Ack) { DBBuilder.UpdateEmployeeCardPolling(Requestitem.EmployeeCardNo, Requestitem.InstallationNo); LogManager.WriteLog("ProcessResponse_EmployeeMasterCard | ACK Updated for EmployeeCard:" + Requestitem.EmployeeCardNo.ToString() + "| in Installation No " + Requestitem.InstallationNo.ToString() + ", Command:" + Requestitem.Command.ToString() , LogManager.enumLogLevel.Info); } else { LogManager.WriteLog("ProcessResponse_EmployeeMasterCard | NACK received for EmployeeCard:" + Requestitem.EmployeeCardNo.ToString() + "| in Installation No " + Requestitem.InstallationNo.ToString() + ", Command:" + Requestitem.Command.ToString() , LogManager.enumLogLevel.Info); } _requestCollection.Remove(threadData.MessageID); } } }
public void GetDataforEmployeecard() { if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime)) { return; } LogManager.WriteLog("[GetDataforEmployeecard]- Start", LogManager.enumLogLevel.Info); DataTable dtEMPCard; int Message_ID = 0; try { dtEMPCard = DBBuilder.GetEmployeeCardPollingData(); LogManager.WriteLog("[GetDataforEmployeecard] | Number of Employeecards to Process: " + dtEMPCard.Rows.Count.ToString(), LogManager.enumLogLevel.Info); if ((dtEMPCard == null) || (dtEMPCard.Rows.Count == 0)) { LogManager.WriteLog("No cards to be broadcasted", LogManager.enumLogLevel.Info); return; } foreach (DataRow row in dtEMPCard.Rows) { if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime)) { break; } EmployeeMasterCardThreadData threadData = new EmployeeMasterCardThreadData() { EmployeeCardNo = row["EmployeeCard"].ToString(), EmployeeFlags = row["EmployeeFlags"].ToString(), InstallationNo = Convert.ToInt32(row["Installation_No"]) }; bool canAdd = true; threadData.Command = eCommand.Enable; Message_ID = EmployeecardSend(threadData.EmployeeCardNo, threadData.EmployeeFlags, threadData.InstallationNo); LogManager.WriteLog("GetDataforEmployeecard | Master card Information " + threadData.EmployeeCardNo.ToString() + "sent to Installation: " + threadData.InstallationNo.ToString() + ", MessageID: " + Message_ID.ToString() , LogManager.enumLogLevel.Info); if (canAdd) { threadData.MessageID = Message_ID; if (!_requestCollection.ContainsKey(Message_ID)) { _requestCollection.Add(Message_ID, threadData); } } } LogManager.WriteLog("[GetDataforEmployeecard]- End", LogManager.enumLogLevel.Info); } catch (Exception Ex) { ExceptionManager.Publish(Ex); } }
public void GetDataforEmployeecard() { if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime)) { return; } LogManager.WriteLog("[GetDataforEmployeecard]- Start", LogManager.enumLogLevel.Info); DataTable dtEMPCard; int Message_ID = 0; try { dtEMPCard = DBBuilder.GetEmployeeCardPollingData(); LogManager.WriteLog("[GetDataforEmployeecard] | Number of Employeecards to Process: " + dtEMPCard.Rows.Count.ToString(), LogManager.enumLogLevel.Info); if ((dtEMPCard == null) || (dtEMPCard.Rows.Count == 0)) { LogManager.WriteLog("No cards to be broadcasted", LogManager.enumLogLevel.Info); return; } foreach (DataRow row in dtEMPCard.Rows) { if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime)) { break; } EmployeeMasterCardThreadData threadData = new EmployeeMasterCardThreadData() { EmployeeCardNo = row["EmployeeCard"].ToString(), EmployeeFlags =row["EmployeeFlags"].ToString(), InstallationNo =Convert.ToInt32(row["Installation_No"]) }; bool canAdd = true; threadData.Command = eCommand.Enable; Message_ID = EmployeecardSend(threadData.EmployeeCardNo, threadData.EmployeeFlags, threadData.InstallationNo); LogManager.WriteLog("GetDataforEmployeecard | Master card Information " + threadData.EmployeeCardNo.ToString() + "sent to Installation: " + threadData.InstallationNo.ToString() + ", MessageID: " + Message_ID.ToString() , LogManager.enumLogLevel.Info); if (canAdd) { threadData.MessageID = Message_ID; if (!_requestCollection.ContainsKey(Message_ID)) _requestCollection.Add(Message_ID, threadData); } } LogManager.WriteLog("[GetDataforEmployeecard]- End", LogManager.enumLogLevel.Info); } catch (Exception Ex) { ExceptionManager.Publish(Ex); } }