///// <summary> ///// This Method will retry around certain number of times if it fails ///// </summary> ///// <param name="Key"></param> ///// <param name="Installation_No"></param> ///// <param name="Bar_Pos_Port"></param> ///// <param name="DisableMachine"></param> ///// <returns></returns> //private bool InvokeMethod(string Key, int Installation_No, int Bar_Pos_Port, int DisableMachine) //{ // bool retVal = false; // int Count = 0; // try // { // while (Count < RetryCount) // { // ar_wait.WaitOne(2000); // if (Key == "RemoveMachineFromPollingList") // { // if (di_Method[Key].Invoke(Installation_No, DisableMachine)) // { // ar_wait.Set(); // retVal = true; // break; // } // } // else // { // if (di_Method[Key].Invoke(Installation_No, Bar_Pos_Port)) // { // ar_wait.Set(); // retVal = true; // break; // } // } // Count++; // } // } // catch (Exception Ex) // { // ExceptionManager.Publish(Ex); // } // return retVal; //} /// <summary> /// Remove machine from polling list and then adding to polling list with same installtion /// </summary> /// <param name="item_ags"></param> /// <returns>true or false</returns> private bool SendDetailsToExcomms(BMC.Transport.AGSdetails item_ags) { bool retVal = false; try { EnrollmentDataAccess enrollmentDataAccess = new EnrollmentDataAccess(); int Bar_Pos_Port = enrollmentDataAccess.GetBarPosPort(item_ags.Installation_No.Value); if (item_ags.IsNull) { if (UpdateGMUNo.CreateInstance().RemoveMachineFromPollingList(item_ags.Installation_No.Value, 0)) { LogManager.WriteLog(strScreenName + " Remove Machine From PollingList Succeed InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); LogManager.WriteLog(strScreenName + "'NULL' string updated successfully for an asset :" + item_ags.AssetNo, LogManager.enumLogLevel.Info); bool retGMUEvent = UpdateGMUNo.CreateInstance().UpdateGMUDownEvent(item_ags.Installation_No.Value); LogManager.WriteLog(strScreenName + "'GMUDownEvent inserted - " + retGMUEvent.ToString() + " - for an asset :" + item_ags.AssetNo, LogManager.enumLogLevel.Info); retVal = true; } else { BMC.Presentation.MessageBox.ShowBox("MessageID208", BMC_Icon.Error); LogManager.WriteLog(strScreenName + "Unable to Remove Machine From PollingList InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); } } else { if (UpdateGMUNo.CreateInstance().AddToPollingList(item_ags.Installation_No.Value, Bar_Pos_Port)) { LogManager.WriteLog(strScreenName + "Add Machine To PollingList Succeed InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); retVal = true; } else { BMC.Presentation.MessageBox.ShowBox("MessageID508", BMC_Icon.Error); LogManager.WriteLog(strScreenName + "Unable to Add Machine To PollingList InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); } } } catch (Exception ex) { ExceptionManager.Publish(ex); } return(retVal); }
///// <summary> ///// This Method will retry around certain number of times if it fails ///// </summary> ///// <param name="Key"></param> ///// <param name="Installation_No"></param> ///// <param name="Bar_Pos_Port"></param> ///// <param name="DisableMachine"></param> ///// <returns></returns> //private bool InvokeMethod(string Key, int Installation_No, int Bar_Pos_Port, int DisableMachine) //{ // bool retVal = false; // int Count = 0; // try // { // while (Count < RetryCount) // { // ar_wait.WaitOne(2000); // if (Key == "RemoveMachineFromPollingList") // { // if (di_Method[Key].Invoke(Installation_No, DisableMachine)) // { // ar_wait.Set(); // retVal = true; // break; // } // } // else // { // if (di_Method[Key].Invoke(Installation_No, Bar_Pos_Port)) // { // ar_wait.Set(); // retVal = true; // break; // } // } // Count++; // } // } // catch (Exception Ex) // { // ExceptionManager.Publish(Ex); // } // return retVal; //} /// <summary> /// Remove machine from polling list and then adding to polling list with same installtion /// </summary> /// <param name="item_ags"></param> /// <returns>true or false</returns> private bool SendDetailsToExcomms(BMC.Transport.AGSdetails item_ags) { bool retVal = false; try { EnrollmentDataAccess enrollmentDataAccess = new EnrollmentDataAccess(); int Bar_Pos_Port = enrollmentDataAccess.GetBarPosPort(item_ags.Installation_No.Value); if (item_ags.IsNull) { if (UpdateGMUNo.CreateInstance().RemoveMachineFromPollingList(item_ags.Installation_No.Value, 0)) { LogManager.WriteLog(strScreenName + " Remove Machine From PollingList Succeed InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); LogManager.WriteLog(strScreenName + "'NULL' string updated successfully for an asset :" + item_ags.AssetNo, LogManager.enumLogLevel.Info); bool retGMUEvent = UpdateGMUNo.CreateInstance().UpdateGMUDownEvent(item_ags.Installation_No.Value); LogManager.WriteLog(strScreenName + "'GMUDownEvent inserted - " + retGMUEvent.ToString() + " - for an asset :" + item_ags.AssetNo, LogManager.enumLogLevel.Info); retVal = true; } else { BMC.Presentation.MessageBox.ShowBox("MessageID208", BMC_Icon.Error); LogManager.WriteLog(strScreenName + "Unable to Remove Machine From PollingList InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); } } else { if (UpdateGMUNo.CreateInstance().AddToPollingList(item_ags.Installation_No.Value, Bar_Pos_Port)) { LogManager.WriteLog(strScreenName + "Add Machine To PollingList Succeed InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); retVal = true; } else { BMC.Presentation.MessageBox.ShowBox("MessageID508", BMC_Icon.Error); LogManager.WriteLog(strScreenName + "Unable to Add Machine To PollingList InstallationNo:" + item_ags.Installation_No.Value, LogManager.enumLogLevel.Info); } } } catch (Exception ex) { ExceptionManager.Publish(ex); } return retVal; }