private void CheckSiteStatus()
        {
            try
            {
                LogManager.WriteLog("Inside CheckSiteStatus", LogManager.enumLogLevel.Info);

                SqlConnection sqlConnection = new SqlConnection(DBCalls.GetConnRegSettings());

                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection = sqlConnection;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlCommand.CommandText = ProcGetSiteStatus;

                //Execute the command.
                sqlConnection.Open();
                int siteStatus = Convert.ToInt32(sqlCommand.ExecuteScalar());
                sqlConnection.Close();

                if (SiteEnabledStatus != siteStatus)
                {
                    BMCMonitoring objMonitoring = new BMCMonitoring();

                    string strServiceNames = DBBuilder.DBCalls.GetServiceNames();
                    List<string> serviceNames = new List<string>(strServiceNames.Split(','));

                    foreach (string service in serviceNames)
                    {
                        if (service.Trim().ToUpper() == BMCGuardianService) { continue; }

                        if (siteStatus == 1)
                        {
                            objMonitoring.EnableService(service.Trim());
                        }
                        else
                        {
                            objMonitoring.DisableService(service.Trim());
                        }
                    }
                }
                else
                {
                    LogManager.WriteLog("Site Status not changed, hence skipping the Site Enable/Disable process.", LogManager.enumLogLevel.Info);
                }

                SiteEnabledStatus = siteStatus;

            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void GetServiceStatusForExchange()
        {
            string strServiceNames = string.Empty;
            int interval = Convert.ToInt32("0" + ConfigManager.Read("Exchange_ServicesStatusInterval"));
            interval = interval == 0 ? 30 : interval;
            while (isServiceRunning)
            {
                try
                {
                    BMCMonitoring objMonitoring = new BMCMonitoring();

                    if (strServiceNames == string.Empty)
                        strServiceNames = DBBuilder.DBCalls.GetServiceNames();
                    string strSiteStatus = string.Empty;
                    if (!string.IsNullOrEmpty(strServiceNames))
                    {
                        strSiteStatus = objMonitoring.GetSiteStatusForExchange(strServiceNames);
                    }
                    if (!string.IsNullOrEmpty(strSiteStatus))
                    {
                        UpdateSiteServiceDetails(strSiteStatus);
                        LogManager.WriteLog("Site status updated in exchange.", LogManager.enumLogLevel.Info);
                    }
                    _onstopexc.WaitOne(interval * 1000);//waits current thread in finite time(i.e 30 sec default)
                }
                catch (Exception ex)
                {
                    ExceptionManager.Publish(ex);
                    strServiceNames = string.Empty;
                }
            }
        }
        private void UpdateStatusInEnterprise()
        {
            try
            {
                int SystemEventsToGet = Convert.ToInt16(ConfigManager.Read("NoofSystemLogsToGet"));
                string SiteCode = DBBuilder.DBCalls.GetSiteName();
                Proxy objService = new Proxy(SiteCode);
                BMCMonitoring objMonitoring = new BMCMonitoring();
                string strServiceNames = DBBuilder.DBCalls.GetServiceNames();
                string strSiteStatus = string.Empty;
                if (!string.IsNullOrEmpty(strServiceNames))
                {
                    strSiteStatus = objMonitoring.GetSiteStatus(strServiceNames, SystemEventsToGet);
                }
                if (!string.IsNullOrEmpty(strSiteStatus))
                {
                    //UpdateSiteServiceDetails(SiteCode, strSiteStatus);
                    //LogManager.WriteLog("Site status updated in exchange.", LogManager.enumLogLevel.Info);

                    objService.UpdateSiteStatsInEnterprise(SiteCode, strSiteStatus);
                    LogManager.WriteLog("Site status updated in enterrprise.", LogManager.enumLogLevel.Info);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        private void RestartServices()
        {
            string strServiceName = string.Empty;
            try
            {
                BMCMonitoring objMonitoring = new BMCMonitoring();
                string strServiceNames = DBBuilder.DBCalls.GetServiceNames();
                LogManager.WriteLog("RestartServices: Service to restart " + strServiceNames, LogManager.enumLogLevel.Info);
                string strSiteStatus = string.Empty;
                int SystemEventsToGet = Convert.ToInt16(ConfigManager.Read("NoofSystemLogsToGet"));
                if (!string.IsNullOrEmpty(strServiceNames))
                {
                    strSiteStatus = objMonitoring.GetSiteStatus(strServiceNames, SystemEventsToGet);
                    DataTable dtServiceStatus = GetServiceStatus(strSiteStatus);
                    foreach (DataRow dr in dtServiceStatus.Rows)
                    {
                        if (dr["ServiceStatus"].ToString().ToUpper() != "RUNNING")
                        {
                            strServiceName = dr["ServiceName"].ToString();

                            if (strServiceName.ToUpper() != "BMCGUARDIANSERVICE")
                            {
                                try
                                {
                                    if (objMonitoring.RestartService(strServiceName))
                                    {
                                        LogManager.WriteLog(strServiceName + " Restarted", LogManager.enumLogLevel.Info);
                                    }
                                    else
                                    { LogManager.WriteLog("Error while restarting " + strServiceName, LogManager.enumLogLevel.Info); }
                                }
                                catch (Exception ex1)
                                {
                                    LogManager.WriteLog("Error while restarting " + strServiceName, LogManager.enumLogLevel.Error);
                                    ExceptionManager.Publish(ex1);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
        }
        /// <summary>
        /// Check Message Queue for Exchange if not there and check the MSMQ service is running 
        /// if not running start it and create queue.else if service is already running create the queue simply.
        /// <Author>Vineetha Mathew</Author>
        /// <DateCreated>Date Created 11-Dec-2008</DateCreated>
        /// <param name=strMSMQExchangepath>string</param>
        /// <returns>true</returns>
        /// </summary>      
        /// Method Revision History
        ///
        /// Author             Date              Description
        /// ---------------------------------------------------
        ///Vineetha Mathew      11-12-2008      Created
        public static bool CreateMSMQ(string strMSMQExchangepath)
        {
            bool bMSMQServiceStatus = false;
            DataTable dtMSMQServicesStatus = new DataTable();
            BMCMonitoring objBMCMonitoring = new BMCMonitoring();
            bool bReturn = false;

            try
            {
                
                dtMSMQServicesStatus = objBMCMonitoring.GetServiceStatus("MSMQ", BMCMonitoring.ServiceTypes.All);

                if (dtMSMQServicesStatus.Rows.Count > 0)
                {
                    for (int i = 0; i < dtMSMQServicesStatus.Rows.Count; i++)
                    {
                        
                        if (dtMSMQServicesStatus.Rows[i][0].ToString() == "MSMQ" && dtMSMQServicesStatus.Rows[i][1].ToString() == "Stopped")
                        {
                            bMSMQServiceStatus = objBMCMonitoring.StartService("MSMQ");
                            if (bMSMQServiceStatus == true)
                            {
                                
                                System.Threading.Thread.Sleep(5000);
                                MessageQueue.Create(strMSMQExchangepath, true);
                                MessageQueue objMessagqQueue = new MessageQueue(strMSMQExchangepath);
                                objMessagqQueue.SetPermissions("Everyone", MessageQueueAccessRights.FullControl);
                                bReturn = true;
                                break;
                            }
                        }
                        else if (dtMSMQServicesStatus.Rows[i][0].ToString() == "MSMQ" && dtMSMQServicesStatus.Rows[i][1].ToString() == "Running")
                        {
                            
                            MessageQueue.Create(strMSMQExchangepath, true);
                            MessageQueue objMessagqQueue = new MessageQueue(strMSMQExchangepath);
                            objMessagqQueue.SetPermissions("Everyone", MessageQueueAccessRights.FullControl);
                            bReturn = true;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("CreateMSMQ" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
                bReturn = false;
            }
            return bReturn;
        }
        void serviceStatusTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            string strServiceName = "BMCNetworkService";

            try
            {
                DataSet dsData = DBBuilder.DBCalls.GetServiceStatusDetails();
                bool bRequired = false;

                LogManager.WriteLog("Service Status Details - Timer Triggered.", LogManager.enumLogLevel.Error);

                if (dsData.Tables.Count > 0)
                {
                    if (dsData.Tables[0].Rows.Count > 0)
                    {
                        DateTime dtNextRun;

                        try
                        {
                            dtNextRun = Convert.ToDateTime(dsData.Tables[0].Rows[0]["SS_NextRunTime"]);
                        }
                        catch (Exception ex)
                        {
                            dtNextRun = DateTime.Now;
                            ExceptionManager.Publish(ex);
                        }

                        int iStatus = DateTime.Compare(DateTime.Now, dtNextRun);

                        LogManager.WriteLog("Service Status Details - Current Date " + DateTime.Now.ToString() + " NextRunDate " +
                            dtNextRun.ToString() + " Status " + iStatus.ToString(), LogManager.enumLogLevel.Error);

                        if (iStatus > 0)
                        {
                            bRequired = true;
                        }
                    }
                    else
                    {
                        bRequired = true;
                    }
                }
                else
                {
                    bRequired = true;
                }

                if (bRequired)
                {
                    BMCMonitoring objMonitoring = new BMCMonitoring();

                    LogManager.WriteLog("Service Status Details - Starting Process.", LogManager.enumLogLevel.Error);

                    if (objMonitoring.RestartService(strServiceName))
                    {
                        DBBuilder.DBCalls.UpdateServiceStatusDetails();
                        LogManager.WriteLog(strServiceName + " Restarted", LogManager.enumLogLevel.Info);
                    }
                    else
                    {
                        LogManager.WriteLog("Error while restarting " + strServiceName, LogManager.enumLogLevel.Info);
                    }
                }
            }
            catch (Exception exserviceStatusTimer_Elapsed)
            {
                LogManager.WriteLog("Error while restarting " + strServiceName, LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(exserviceStatusTimer_Elapsed);
            }
        }
        public string GetServiceStatus(string strServiceNames, BMCMonitoring.ServiceTypes serviceStatus)
        {
            CheckSecurity();

            string strSiteName = string.Empty;
            try
            {
                var dtServiceStatus = new DataTable("Services");

                var objMonitoring = new BMCMonitoring();
                switch (serviceStatus)
                {
                    case BMCMonitoring.ServiceTypes.All:
                        dtServiceStatus = objMonitoring.GetServiceStatus(strServiceNames, BMCMonitoring.ServiceTypes.All);
                        break;
                    case BMCMonitoring.ServiceTypes.Running:
                        dtServiceStatus = objMonitoring.GetServiceStatus(strServiceNames, BMCMonitoring.ServiceTypes.Running);
                        break;
                    case BMCMonitoring.ServiceTypes.NotRunning:
                        dtServiceStatus = objMonitoring.GetServiceStatus(strServiceNames, BMCMonitoring.ServiceTypes.NotRunning);
                        break;
                }
                var objWriter = new StringWriter();
                dtServiceStatus.WriteXml(objWriter);
                return objWriter.ToString();
            }
            catch
            {
                LogManager.WriteLog("Error in getting status from site " + strSiteName, LogManager.enumLogLevel.Error);
                return "<OutputXML><ErrorMessage>no records found </ErrorMessage></OutputXML> ";
            }
        }
        public bool StartService(string strServiceName)
        {
            CheckSecurity();

            try
            {
                var objMonitoring = new BMCMonitoring();
                return objMonitoring.StartService(strServiceName);

            }
            catch
            {
                LogManager.WriteLog("Error in starting service " + strServiceName, LogManager.enumLogLevel.Error);
                return false;
            }
        }
 /// <summary>
 /// To End the selected service 
 /// <param name="strServicename">string</param>
 /// <returns name="service status">bool</returns>
 /// </summary>     
 private bool EndService(string strServicename)
 {
     try
     {
         BMCMonitoring objBMCMonitoring = new BMCMonitoring();
         return objBMCMonitoring.EndService(strServicename);                
     }
     catch (Exception ex)
     {
         LogManager.WriteLog("EndService" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
         ExceptionManager.Publish(ex);
         return false;
     }
 }
        public string GetSiteStatus()
        {
            CheckSecurity();

            try
            {
                string strServiceNames = GetValueFromSetting("ServiceNames", "BGSExchangeHost");
                var objMonitoring = new BMCMonitoring();
                return objMonitoring.GetSiteStatus(strServiceNames, 10);
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("Error in getting stats from site " + "--" + ex.Message, LogManager.enumLogLevel.Error);
                return "<OutputXML><ErrorMessage>no records found </ErrorMessage></OutputXML> ";
            }

        }
        /// <summary>
        /// To get the status of a particular service
        /// <Author>Vineetha Mathew</Author>       
        /// <param name="strServiceName">string</param>
        /// <returns></returns>
        /// </summary>       
        private string GetServiceStatus(string strServiceName)
        {
            BMCMonitoring objBMCMonitoring = new BMCMonitoring();
            DataTable dtServicesStatus = new DataTable();
            StringBuilder strServicelist = new StringBuilder();
            try
            {
                dtServicesStatus = objBMCMonitoring.GetServiceStatus(strServiceName, BMCMonitoring.ServiceTypes.All);
                Application.DoEvents();
                if (dtServicesStatus.Rows.Count > 0)
                {
                    for (int j = 0; j < dtServicesStatus.Columns.Count; j++)
                    {
                        for (int i = 0; i < dtServicesStatus.Rows.Count; i++)
                        {
                            if (j != dtServicesStatus.Columns.Count - 1)
                            {
                                if (dtServicesStatus.Rows[i][j].ToString() == strServiceName && dtServicesStatus.Rows[i][j + 1].ToString() == "Stopped")
                                {
                                    strServiceStatus = "STOP";
                                }
                                else if (dtServicesStatus.Rows[i][j].ToString() == strServiceName && dtServicesStatus.Rows[i][j + 1].ToString() == "Running")
                                {
                                    strServiceStatus = "RUN";

                                }
                                else if (dtServicesStatus.Rows[i][j].ToString() == strServiceName && dtServicesStatus.Rows[i][j + 1].ToString() == "Pending")
                                {
                                    strServiceStatus = "PEND";
                                }
                                else if (dtServicesStatus.Rows[i][j].ToString() == strServiceName && dtServicesStatus.Rows[i][j + 1].ToString() == "Service not found")
                                {
                                    strServiceStatus = "NOSERVICE";
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }

            }
            catch (IndexOutOfRangeException iex)
            {
                LogManager.WriteLog("GetServiceStatus" + iex.Message.ToString() + iex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(iex);
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("GetServiceStatus" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }
            finally
            {
                dtServicesStatus.Dispose();
            }
            return strServiceStatus;
        }
        /// <summary>
        /// To get all the status of the services on form load
        /// <Author>Vineetha Mathew</Author>      
        /// <param name=""></param>
        /// <returns></returns>
        /// </summary>      
        private void GetServiceStatusToListView()
        {
            BMCMonitoring objBMCMonitoring = new BMCMonitoring();
            DataTable dtServicesStatus = new DataTable();
            StringBuilder strServicelist = new StringBuilder();           
            try
            {
                lvServiceslist.BeginUpdate();

                for (int i = 0; i < lvServiceslist.Items.Count; i++)
                {                                     
                    strServicelist.Append(lvServiceslist.Items[i].Text + ",");
                }
                dtServicesStatus = objBMCMonitoring.GetServiceStatus(strServicelist.ToString(), BMCMonitoring.ServiceTypes.All);
                Application.DoEvents();
                if (dtServicesStatus.Rows.Count > 0)
                {
                    for (int j = 0; j < dtServicesStatus.Columns.Count; j++)
                    {
                        for (int i = 0; i < dtServicesStatus.Rows.Count; i++)
                        {
                            if (j != dtServicesStatus.Columns.Count - 1)
                            {
                                if (dtServicesStatus.Rows[i][j].ToString() == lvServiceslist.Items[i].Text.ToString() && dtServicesStatus.Rows[i][j + 1].ToString() == "Stopped")
                                {   
                                    lvServiceslist.Items[i].ForeColor = Color.Red;
                                    lvServiceslist.Items[i].SubItems[1].Text = "Stopped";                                    
                                }
                                else if (dtServicesStatus.Rows[i][j].ToString() == lvServiceslist.Items[i].Text.ToString() && dtServicesStatus.Rows[i][j + 1].ToString() == "Running")
                                {                                   
                                    lvServiceslist.Items[i].ForeColor = Color.Blue;                                   
                                    lvServiceslist.Items[i].SubItems[1].Text = "Running";                                    

                                }
                                else if (dtServicesStatus.Rows[i][j].ToString() == lvServiceslist.Items[i].Text.ToString() && dtServicesStatus.Rows[i][j + 1].ToString() == "Pending")
                                {   
                                    lvServiceslist.Items[i].ForeColor = Color.MediumSeaGreen;                                   
                                    lvServiceslist.Items[i].SubItems[1].Text = "Pending";                                    
                                }
                                else if (dtServicesStatus.Rows[i][j].ToString() == lvServiceslist.Items[i].Text.ToString() && dtServicesStatus.Rows[i][j + 1].ToString() == "Service not found")
                                {
                                    lvServiceslist.Items[i].ForeColor = Color.Green;
                                    lvServiceslist.Items[i].SubItems[1].Text = "Service not found";                                    
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
               
            }
            catch (IndexOutOfRangeException iex)
            {
                LogManager.WriteLog("GetServiceStatus" + iex.Message.ToString() + iex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(iex);
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("GetServiceStatus" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }
            finally
            {
                lvServiceslist.EndUpdate();
            }
        }
示例#13
0
        private void GetServiceStatus()
        {
            BMCMonitoring objBMCMonitoring = new BMCMonitoring();
            DataTable dtServicesStatus = new DataTable();
            StringBuilder strServicelist = new StringBuilder();
            //Rectangle itemBoundRectangle = new Rectangle(0, 0, 0, 0);
            ListViewItem itemListview = new ListViewItem();
            string[] strListarray = null;
            try
            {
                strListarray = ConfigManager.Read("ServicesList").ToString().Split(',');
                if (strListarray != null)
                {
                    for (int i = 0; i < strListarray.Length; i++)
                    {
                        strServicelist.Append(strListarray[i].ToString() + ",");
                    }
                }
                dtServicesStatus = objBMCMonitoring.GetServiceStatus(strServicelist.ToString(), BMCMonitoring.ServiceTypes.All);
                string strServiceStatus = string.Empty;
                string strServiceStatus1 = string.Empty;
                bool blnFoundNotRunning = false;
                int ServiceCount = dtServicesStatus.Rows.Count / 2;
                int RowCount = 0;
                if (dtServicesStatus.Rows.Count > 0)
                {
                    SetListviewItemStyle("Services", 0);
                    foreach (DataRow dr in dtServicesStatus.Rows)
                    {
                        if (!blnFoundNotRunning && dr["Status"].ToString().ToUpper().Trim() !="RUNNING")
                        {
                            SetListviewItemStyle("Services",1);
                            SetListviewItemStyle("Services1", -1);
                            blnFoundNotRunning = true;
                        }
                        if (RowCount > ServiceCount)
                            strServiceStatus1 += dr["ServiceName"].ToString() + ":" + dr["Status"].ToString() + "; ";    
                        else
                            strServiceStatus+= dr["ServiceName"].ToString()+":" +dr["Status"].ToString()+"; ";
                        RowCount++;
                    }

                    if (lvGoLive.Items["Services"].SubItems.Count > 2)
                        lvGoLive.Items["Services"].SubItems[2].Text = strServiceStatus;
                    else
                        lvGoLive.Items["Services"].SubItems.Add(strServiceStatus);
                    if (!string.IsNullOrEmpty(strServiceStatus1))
                    {
                        if (lvGoLive.Items["Services1"].SubItems.Count > 2)
                            lvGoLive.Items["Services1"].SubItems[2].Text = strServiceStatus1;
                        else
                            lvGoLive.Items["Services1"].SubItems.Add(strServiceStatus1);
                    }
                    else
                    {
                        lvGoLive.Items["Services1"].Remove();
                    }
                    
                }
                #region unused code
                //if (dtServicesStatus.Rows.Count > 0)
                //{
                //    for (int j = 0; j < dtServicesStatus.Columns.Count; j++)
                //    {
                //        for (int i = 0; i < dtServicesStatus.Rows.Count; i++)
                //        {
                //            if (j != dtServicesStatus.Columns.Count - 1)
                //            {
                //                if (dtServicesStatus.Rows[i][j + 1].ToString() == "Stopped")
                //                {
                //                    lvGoLive.Items["Services"].ImageIndex = 1;
                           
                //                    if (lvGoLive.Items["Services"].SubItems.Count > 2)
                //                    {
                //                        lvGoLive.Items["Services"].SubItems[2].Text = lvGoLive.Items["Services"].SubItems[2].Text + ";" + dtServicesStatus.Rows[i][j].ToString() +" Service is in Stopped State";
                //                    }
                //                    else
                //                    {
                //                        lvGoLive.Items["Services"].SubItems.Add(dtServicesStatus.Rows[i][j].ToString() + " Service is in Stopped State");

                //                    }
                //                }
                //                 else if (dtServicesStatus.Rows[i][j + 1].ToString() == "Pending")
                //                {
                //                    lvGoLive.Items["Services"].ImageIndex = 1;

                //                    if (lvGoLive.Items["Services"].SubItems.Count > 2)
                //                    {
                //                        lvGoLive.Items["Services"].SubItems[2].Text = lvGoLive.Items["Services"].SubItems[2].Text + ";" + dtServicesStatus.Rows[i][j].ToString() + " Service is in Pending State";
                //                    }
                //                    else
                //                    {
                //                        lvGoLive.Items["Services"].SubItems.Add(dtServicesStatus.Rows[i][j].ToString() + " Service is in Pending State");

                //                    }

                //                }

                //                else if (dtServicesStatus.Rows[i][j + 1].ToString().ToUpper() == "Service not found".ToUpper())
                //                {
                //                    lvGoLive.Items["Services"].ImageIndex = 1;
                //                    if (lvGoLive.Items["Services"].SubItems.Count > 2)
                //                    {
                //                        lvGoLive.Items["Services"].SubItems[2].Text = lvGoLive.Items["Services"].SubItems[2].Text + ";" + dtServicesStatus.Rows[i][j].ToString() + " Service not found.";
                //                    }
                //                    else
                //                    {
                //                        lvGoLive.Items["Services"].SubItems.Add(dtServicesStatus.Rows[i][j].ToString() + " Service not found");

                //                    }


                //                }

                //            }
                //            else
                //            {
                //                break;
                //            }
                //        }
                //    }
                //}

                //lvGoLive.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent);
                //if (lvGoLive.Items["Services"].ImageIndex != 1)
                //{
                //    lvGoLive.Items["Services"].ImageIndex = 0;
                //    lvGoLive.Items["Services"].BackColor = Color.White;
                //    lvGoLive.Items["Services"].ForeColor = Color.Black;
                    
                //}
                //else
                //{
                //    lvGoLive.Items["Services"].BackColor = Color.Red;
                //    lvGoLive.Items["Services"].ForeColor = Color.White;
                //}
                #endregion
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);

               
                SetListviewItemStyle("Services", 1);
            }
        }
 /// <summary>
 /// To End the selected service 
 /// <param name="strServicename">string</param>
 /// <returns name="service status">bool</returns>
 /// </summary>     
 private bool EndService(string strServicename)
 {
     try
     {
         BMCMonitoring objBMCMonitoring = new BMCMonitoring();
         return objBMCMonitoring.EndService(strServicename, new TimeSpan(0, serviceTimeOut, 0));
     }
     catch (Exception ex)
     {
         LogManager.WriteLog("EndService" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
         ExceptionManager.Publish(ex);
         MessageBox.ShowBox("MessageID74", BMC_Icon.Error);
         return false;
     }
 }
        /// <summary>
        /// Display the Ticketing server details.
        /// <param name="CMPServerEntries"></param>
        /// <returns></returns>
        /// </summary>        
        //private void GetTicketingServerSettings(Dictionary<string, string> TicketingServerSettings)
        //{
        //    try
        //    {
        //        if (TicketingServerSettings != null)
        //        {
        //            foreach (KeyValuePair<string, string> objKeyValue in TicketingServerSettings)
        //            {
        //                if (objKeyValue.Key.ToUpper() == "SERVER")
        //                {
        //                    txtticketserver.Text = objKeyValue.Value;
        //                }
        //                else if (objKeyValue.Key.ToUpper() == "UID")
        //                {
        //                    txtticketusername.Text = objKeyValue.Value;
        //                }
        //                else if (objKeyValue.Key.ToUpper() == "PASSWORD")
        //                {
        //                    txtticketPassword.Password = objKeyValue.Value;
        //                }
        //                else if (objKeyValue.Key.ToUpper() == "DATABASE")
        //                {
        //                    lblticketDBname.Text = objKeyValue.Value;
        //                }
        //                else if (objKeyValue.Key.ToUpper() == "TIMEOUT")
        //                {
        //                    txtticketTimeout.Text = objKeyValue.Value;
        //                }
        //                else if (objKeyValue.Key.ToUpper() == "INSTANCE")
        //                {
        //                    txticketInstance.Text = objKeyValue.Value;
        //                }

        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        LogManager.WriteLog("GetTicketingServerSettings" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
        //        ExceptionManager.Publish(ex);
        //        MessageBox.ShowBox("MessageID74", BMC_Icon.Error);
        //    }
        //}

        /// <summary>
        /// Load Services information to lisview
        /// </summary>
        /// <param name="strListarray"></param>
        private void LoadServicesToListView(string[] strListarray)
        {
            BMCMonitoring objBMCMonitoring = new BMCMonitoring();
            DataTable dtServicesStatus = new DataTable();
            StringBuilder strServicelist = new StringBuilder();

            for (int i = 0; i < strListarray.Length; i++)
            {
                strServicelist.Append(strListarray[i] + ",");
            }

            dtServicesStatus = objBMCMonitoring.GetServiceStatus(strServicelist.ToString(), BMCMonitoring.ServiceTypes.All);

            if (_LoadListViewCollection.Count > 0) { _LoadListViewCollection.Clear(); }

            foreach (DataRow dataRow in dtServicesStatus.Rows)
            {
                _LoadListViewCollection.Add(new LoadListView { Check = 0, ServiceName = dataRow[0].ToString(), ServiceStatus = dataRow[1].ToString() });
            }

            lvServiceslist.ItemsSource = LoadListViewCollection;
        }