public void ProcessResponse(BMC.Business.NetworkService.AFTEnableDisableThreadDataResponse threadData) { if (_requestCollection.Count <= 0) return; lock (_lockRes) { if (mEvent.WaitOne(NetworkServiceSettings.DBHitWaitTime)) { return; } if (_requestCollection.ContainsKey(threadData.MessageID)) { AFTEnableDisableThreadData Requestitem = _requestCollection[threadData.MessageID]; if (threadData.Ack) { DBBuilder.UpdateAFTPolling(Requestitem.InstallationNo); LogManager.WriteLog("ProcessResponse_AFTEnableDisable | ACK Updated for Installation:" + Requestitem.InstallationNo.ToString() +", Command:"+Requestitem.Command.ToString() , LogManager.enumLogLevel.Info); } else { LogManager.WriteLog("ProcessResponse_AFTEnableDisable | NACK received for Installation:" + Requestitem.InstallationNo.ToString() + ", Command:" + Requestitem.Command.ToString() , LogManager.enumLogLevel.Info); } _requestCollection.Remove(threadData.MessageID); } } }
public void GetDataforAFT() { if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime)) { return; } LogManager.WriteLog("[GetDataforAFT]- Start", LogManager.enumLogLevel.Info); DataTable dtAFT; int Message_ID = 0; try { dtAFT = DBBuilder.GetAFTPollingData(); LogManager.WriteLog("[GetDataforAFT] | Number of Installation to Process: " + dtAFT.Rows.Count.ToString(), LogManager.enumLogLevel.Info); if ((dtAFT == null) || (dtAFT.Rows.Count == 0)) { LogManager.WriteLog("No machine to be enabled/disabled for AFT", LogManager.enumLogLevel.Info); return; } foreach (DataRow row in dtAFT.Rows) { if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime)) { break; } AFTEnableDisableThreadData threadData = new AFTEnableDisableThreadData() { InstallationNo = Convert.ToInt32(row["Installation_No"]) }; bool canAdd = true; switch (Convert.ToInt32(row["AFT_ED_Type"])) { case 1: threadData.Command = eCommand.Enable; Message_ID = AFTEnable(threadData.InstallationNo); LogManager.WriteLog("GetDataforAFT | AFT Enable Request for Installation: " + threadData.InstallationNo.ToString() + ", MessageID: " + Message_ID.ToString() , LogManager.enumLogLevel.Info); break; case 0: threadData.Command = eCommand.Disable; Message_ID = AFTDisable(threadData.InstallationNo); LogManager.WriteLog("GetDataforAFT | AFT Disable Request for Installation: " + threadData.InstallationNo.ToString() + ", MessageID: " + Message_ID.ToString() , LogManager.enumLogLevel.Info); break; default: canAdd = false; break; } if (canAdd) { threadData.MessageID = Message_ID; if (!_requestCollection.ContainsKey(Message_ID)) _requestCollection.Add(Message_ID, threadData); } } LogManager.WriteLog("[GetDataforAFT]- End", LogManager.enumLogLevel.Info); } catch (Exception Ex) { ExceptionManager.Publish(Ex); } }