/// <summary>
        /// Get Settings from Setting table
        /// </summary>
        /// <returns>list with available installations</returns>
        ///  /// Method Revision History
        ///
        /// Author             Date              Description
        /// ---------------------------------------------------
        /// Anuradha       05-Feb-2009          Intial Version 
        /// 

        public static InstallationEntity[] GetInstallations()
        {
            InstallationEntity[] clsInstallation = null;
            DataTable dtInstallations = null;
            int iCount=0;
            try
            {
                // lInstallations = new List<int>();

                //Get available installations.

                dtInstallations = SqlHelper.ExecuteDataset(GetConnectionString(), CommandType.StoredProcedure,
                    DBConstants.RSP_GETINSTALLATIONDETAILS).Tables[0];

                if (dtInstallations != null)
                {
                    clsInstallation = new InstallationEntity[dtInstallations.Rows.Count];
                    //Add the installation no to the list.
                    foreach (DataRow row in dtInstallations.Rows)
                    {
                        clsInstallation[iCount] = new InstallationEntity();
                        clsInstallation[iCount].InstallationNumber = Convert.ToInt32(row["Installation_No"].ToString());
                        clsInstallation[iCount].BarPositionName = row["Bar_Pos_Name"].ToString();
                        clsInstallation[iCount].BarPositionMachineEnabled = row["BarPositionMachineEnabled"].ToString();
                        clsInstallation[iCount].DataPakNumber = int.Parse(row["Datapak_Serial"].ToString());
                        clsInstallation[iCount].BarPositionNo = int.Parse(row["Bar_Pos_No"].ToString());
                        iCount++;
                    }
                }

                //Get the site code.
                string SiteCode = SqlHelper.ExecuteScalar(GetConnectionString(), CommandType.Text,
                   "Select code from site").ToString();
                if (!String.IsNullOrEmpty(SiteCode))
                {
                    for (int k = 0; k < clsInstallation.Length; k++)
                    {
                        clsInstallation[k].SiteCode = SiteCode;
                    }
                }

            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            finally
            {
                if (dtInstallations!=null)
                {
                    dtInstallations.Dispose();
                }
            }
            return clsInstallation;
        }
        //
        //private static string GetEnterpriseConnectionString()
        //{
        //    string strConnectionString = string.Empty;
        //    //BGSGeneral.cConstants objBGSConstants = null;
        //    //BGSEncryptDecrypt.clsBlowFish objDecrypt = null;
        //    //bool bUseHex = true;

        //    try
        //    {
        //        //Check if Connection string already exists.
        //        if (!string.IsNullOrEmpty(strExchangeConnectionString))
        //        {
        //            return strExchangeConnectionString;
        //        }


        //        //Get the connection string from registry
        //        RegistryKey regKeyConnectionString = BMCRegistryHelper.GetRegLocalMachine().OpenSubKey("Software\\Honeyframe\\Cashmaster");
        //        strConnectionString = regKeyConnectionString.GetValue("SQLConnect").ToString();

        //        regKeyConnectionString.Close();

        //        //Decrypt the connection string.
        //        if (!strConnectionString.ToUpper().Contains("SERVER"))
        //        {
        //            //objBGSConstants = new BGSGeneral.cConstants();
        //            //objDecrypt = new BGSEncryptDecrypt.clsBlowFish();
        //            //string strKey = objBGSConstants.ENCRYPTIONKEY;
        //            //strConnectionString = objDecrypt.DecryptString(ref strConnectionString, ref strKey, ref bUseHex);
        //            strConnectionString = BMC.Common.Security.CryptEncode.Decrypt(strConnectionString);

        //        }

        //        //Check if the connection string is properly decrypted.
        //        if (string.IsNullOrEmpty(strExchangeConnectionString))
        //        {
        //            if (strConnectionString.ToUpper().Contains("SERVER"))
        //                strExchangeConnectionString = strConnectionString;
        //            else
        //                throw new Exception("Error Decrypting Registry");
        //        }


        //    }
        //    catch (Exception ex)
        //    {
        //        if (ex.Message == "Connectionstring Not Found.")
        //        {
        //            throw ex;
        //        }
        //        else
        //        {
        //            ExceptionManager.Publish(ex);
        //        }
        //        strExchangeConnectionString = "";
        //    }
        //    finally
        //    {
        //        //objBGSConstants = null;
        //        //objDecrypt = null;
        //    }

        //    return strExchangeConnectionString;
        //}

        #endregion

        #region Check If Time falls within Opening Hours
        /// <summary>
        /// Execute Query
        /// </summary>
        /// <returns>success or failure</returns>
        ///  /// Method Revision History
        ///
        /// Author             Date              Description
        /// ---------------------------------------------------
        /// Anuradha       04-Feb-2009          Intial Version 
        /// 

        public static Dictionary<int,bool> ShouldMachineBeEnabled(InstallationEntity[] Installations)
        {
            Dictionary<int, bool> dMachineShouldbeEnabled = null;
            SqlParameter[] sInstallparams=null;
            object objShouldMachineBeEnabled = null;

            try
            {
                dMachineShouldbeEnabled = new Dictionary<int, bool>();

                foreach (InstallationEntity Installation in Installations)
                {
                    //Get the parameters.
                    objParameters = new Dictionary<string, string>();
                    objParameters.Add("@InstallationNo", Installation.InstallationNumber.ToString());
                    sInstallparams = AddParameter(objParameters);

                    //Check if the machine should be enabled or disabled.
                    objShouldMachineBeEnabled = SqlHelper.ExecuteScalar(GetConnectionString(), CommandType.StoredProcedure,
                        DBConstants.RSP_CHECKSHOULDMACHINEBEENABLED, sInstallparams);

                    //Add the machines and their status.
                    dMachineShouldbeEnabled.Add(Installation.InstallationNumber, Convert.ToBoolean(sInstallparams[1].Value));
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            finally
            {
                objParameters = null;
            }
            return dMachineShouldbeEnabled;
        }