/// <summary>
 /// This method must have the implementation of the work that is going to perform by this job.
 /// </summary>
 public void DoWork()
 {
     //Dictionary<string, string> dictServiceentries = null;
     //RegistrySetting oRegistrySetting = null;
     try
     {
         DBConnect oDbConnect = new DBConnect();
         if ((oDbConnect.RunHourlyVTPService()) && (HourlyDailyEntity.IsReadInHourly) && (HourlyDailyEntity.HasReadRunWithHourly))
         {
             LogManager.WriteLog("Read has been run with Hourly, so update the registry entries for last auto read.", LogManager.enumLogLevel.Info);
             //      dictServiceentries = new Dictionary<string, string>();
             // oRegistrySetting = new RegistrySetting();
             //    dictServiceentries.Add(HourlyDailyEntity.sRegistryPath + "\\\\LastAutoRead", DateTime.Now.ToString("dd MMM yyyy"));
             //  oRegistrySetting.SetRegistryEntries(dictServiceentries, HourlyDailyEntity.sRegistryPath);
             BMCRegistryHelper.SetRegKeyValue(HourlyDailyEntity.sRegistryPath, "LastAutoRead", Microsoft.Win32.RegistryValueKind.String, DateTime.Now.ToString("dd MMM yyyy"));
             HourlyDailyEntity.IsReadInHourly = false;
         }
         oDbConnect.UpdateHourlyStatsGamingday();
         //HourlyDailyEventLog.WriteToEventLog(HourlyDailyEntity.EventLogName, "Hourly Service DoWork: ", "Hourly has been executed successfully.", EventLogEntryType.SuccessAudit);
     }
     catch (Exception ex)
     {
         // HourlyDailyEventLog.WriteToEventLog(HourlyDailyEntity.EventLogName, "Hourly Service DoWork: ", "Message: " + ex.Message + "Source: " + ex.Source, EventLogEntryType.Error);
         ExceptionManager.Publish(ex);
     }
 }
Exemplo n.º 2
0
        public static void Main()
        {
            LogManager.WriteLog("Entering Cash Desk Operator EXE", LogManager.enumLogLevel.Debug);
            BMCRegistryHelper.ActiveInstallationType = BMCCategorizedInstallationTypes.Exchange;
            LogManager.WriteLog("BMCRegistryHelper.InstallationTypes is :" + BMCRegistryHelper.ActiveInstallationType, LogManager.enumLogLevel.Debug);

            string strDefaultServerIP = string.Empty;

            strDefaultServerIP = BMCRegistryHelper.GetRegKeyValue("Cashmaster\\Exchange", "Default_Server_IP");
            clientObj          = new ClientObject();
            client             = new Client("tcp://" + strDefaultServerIP + ConfigManager.Read("ServerIPCUrl"), "RemotingClient", typeof(IServerObject));
            client.SendToServer(clientObj, null);

            int itmpInterval = Int32.Parse(ConfigManager.Read("IPCInterval")) * 3;

            Int32.TryParse(ConfigManager.Read("RemoteServerConnectionCheck"), out iSiteLicensingCheck);
            if (iSiteLicensingCheck <= 0)
            {
                iSiteLicensingCheck = 600;
            }
            if (itmpInterval > 15)
            {
                iInteraval = itmpInterval;
            }

#if !FLOORVIEW_REFRESH_NEW
            siteLicensingClientObj = new ClientObject();
            siteLicensingClient    = new Client("tcp://" + strDefaultServerIP + ConfigManager.Read("SiteLicensingServerIPCUrl"), "SiteLicensingClient", typeof(ISiteLicenseServerObject));
            siteLicensingClient.SendToServer(siteLicensingClientObj, null);
#endif
            BMC.PlayerGateway.GatewaySettings.ConnectionString = DatabaseHelper.GetConnectionString();
            AppStartUp();
        }
        /// <summary>
        /// This method must have the implementation of the work that is going to perform by this job.
        /// </summary>
        public void DoWork()
        {
            //Dictionary<string, string> dictServiceentries = null;
            RegistrySetting oRegistrySetting = null;

            try
            {
                DBConnect oDbConnect = new DBConnect();
                // Fix for Read run twice for a day - Begin
                if (HourlyDailyEntity.HasReadRunWithHourly)
                {
                    LogManager.WriteLog("Read has been run with Hourly, so skip the daily Read process", LogManager.enumLogLevel.Info);
                    return;
                }
                // Fix for Read run twice for a day - End

                if (oDbConnect.RunDailyReadService())
                {
                    //dictServiceentries = new Dictionary<string, string>();
                    oRegistrySetting = new RegistrySetting();
                    //dictServiceentries.Add(HourlyDailyEntity.sRegistryPath + "\\\\LastAutoRead", DateTime.Now.ToString("dd MMM yyyy"));
                    //oRegistrySetting.SetRegistryEntries(dictServiceentries, HourlyDailyEntity.sRegistryPath);
                    BMCRegistryHelper.SetRegKeyValue(HourlyDailyEntity.sRegistryPath, "LastAutoRead", Microsoft.Win32.RegistryValueKind.String, DateTime.Now.ToString("dd MMM yyyy"));
                }
                //HourlyDailyEventLog.WriteToEventLog(HourlyDailyEntity.EventLogName, "DailyService DoWork: ", "Daily Read has been executed successfully.", EventLogEntryType.SuccessAudit);
            }
            catch (Exception ex)
            {
                // HourlyDailyEventLog.WriteToEventLog(HourlyDailyEntity.EventLogName, "DailyService DoWork: ", "Message: " + ex.Message + "Source: " + ex.Source, EventLogEntryType.Error);
                ExceptionManager.Publish(ex);
            }
        }
Exemplo n.º 4
0
        public void ReadRegistrySettings(string Registrypath)
        {
            string ReadDate = string.Empty;

            try
            {
                String readHour = BMCRegistryHelper.GetRegKeyValue(Registrypath, "HourlyReadHour");
                ReadDate = BMCRegistryHelper.GetRegKeyValue(Registrypath, "LastAutoRead");
                HourlyDailyEntity.HourlyReadHour = Convert.ToInt32(readHour);
                DateTime dtRead;
                if (!string.IsNullOrWhiteSpace(ReadDate))
                {
                    dtRead = Convert.ToDateTime(ReadDate, CultureInfo.CurrentCulture);
                    dtRead.Date.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
                    HourlyDailyEntity.LastAutoRead = dtRead.Date;
                }
                else
                {
                    dtRead = Convert.ToDateTime(DateTime.Now.AddDays(-1).ToString(), CultureInfo.CurrentCulture);
                    dtRead.Date.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
                    HourlyDailyEntity.LastAutoRead = dtRead;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("Please check the regional setting date format and LastAutoRead!! Date format from Registry: " + ReadDate.ToString() + " Regional setting date format: " + CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern.ToString(), LogManager.enumLogLevel.Error);
                //HourlyDailyEventLog.WriteToEventLog(HourlyDailyEntity.EventLogName, "ReadRegistrySettings: ", "Message: " + ex.Message + "Source: " + ex.Source, EventLogEntryType.Error);
                ExceptionManager.Publish(ex);
            }
        }
Exemplo n.º 5
0
 private static string GetServerName()
 {
     // var key = BMCRegistryHelper.GetRegLocalMachine().OpenSubKey(@"Cashmaster\Exchange", true);
     //if (key != null) return key.GetValue("Default_Server_Ip").ToString();
     //throw new InvalidDataException("Registry key not Set.  Default_Server_IP not configured");
     return(BMCRegistryHelper.GetRegKeyValue(@"Cashmaster\Exchange", "Default_Server_Ip"));
 }
Exemplo n.º 6
0
        private int CheckAuthorizationCodeFromServer(string iAuthCode, int iSiteCode, string TransactionType)
        {
            string sReturnValue = "";
            string sVerifyURL   = string.Empty;
            int    iResult      = -1;

            try
            {
                if (oWebService == null)
                {
                    ConfigManager.SetConfigurationMode(ConfigManager.ConfigurationMode.AppConfig);
                    sVerifyURL = BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("RegistryPath"), "BGSWebService");

                    if (sVerifyURL.Length > 0)
                    {
                        oWebService = new Proxy(sVerifyURL, true);
                    }
                }
                sReturnValue = oWebService.CheckTransactionKey(iSiteCode.ToString(), iAuthCode.ToString(), TransactionType);
                if (!string.IsNullOrEmpty(sReturnValue))
                {
                    iResult = Convert.ToInt32(sReturnValue.Substring(0, 1));
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                iResult = -1;
            }
            return(iResult);
        }
Exemplo n.º 7
0
        private void CheckforBindIP()
        {
            string strBindIP = string.Empty;

            try
            {
                strBindIP = BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("RegistryPath") + "\\Exchange", "BindIPAddress");
                string[] strarrBindIP = GetAllLocalIP();
                if (string.IsNullOrEmpty(strBindIP))
                {
                    SetListviewItemStyle("BindIP", 1);
                }
                if (strarrBindIP.Length > 0)
                {
                    foreach (string strIP in strarrBindIP)
                    {
                        if (strIP == strBindIP)
                        {
                            lvGoLive.Items["BindIP"].SubItems.Add(strIP);
                            SetListviewItemStyle("BindIP", 0);
                            break;
                        }
                        else
                        {
                            SetListviewItemStyle("BindIP", 1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                SetListviewItemStyle("BindIP", 1);
            }
        }
Exemplo n.º 8
0
        private void CheckForSlotLANIP()
        {
            string strSlotIP = string.Empty;

            try
            {
                strSlotIP = BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("RegistryPath") + "\\BMCDHCP", "ServerIP");
                if (string.IsNullOrEmpty(strSlotIP))
                {
                    SetListviewItemStyle("SlotLANIP", 1);
                    return;
                }
                string[] strarrBindIP = GetAllLocalIP();
                if (strarrBindIP.Length > 0)
                {
                    foreach (string strIP in strarrBindIP)
                    {
                        if (strIP.ToUpper().CompareTo(strSlotIP.ToUpper()) == 0)
                        {
                            lvGoLive.Items["SlotLANIP"].SubItems.Add(strIP);
                            SetListviewItemStyle("SlotLANIP", 0);
                            return;
                        }
                    }
                    SetListviewItemStyle("SlotLANIP", 1);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                SetListviewItemStyle("SlotLANIP", 1);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Reads Connection String details from Configuration
        /// </summary>
        /// <param name="strKey">Key to get the value from Config</param>
        /// <returns>Returns the Connection String as string </returns>
        string IConfigurationAdapter.ReadConnectionString(string strKey)
        {
            RegistryKey key = BMCRegistryHelper.GetRegLocalMachine().OpenSubKey(ConfigManager.Read(Constants.CONSTANT_REGISTRYPATH), true);
            string      connectionString = key.GetValue(strKey).ToString();

            key.Close();
            return(connectionString);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Write a Com Config file
        /// #Sample#
        /// <?xml version="1.0" encoding="utf-8"?>
        /// <configuration>
        ///     <client>
        ///         <AppSetting>
        ///             <ConfigLocation type="CSTRING">C:\Program Files\Bally Technologies\Exchange Client\CommClient.config</ConfigLocation>
        ///             <BindIPAddress type="CSTRING">10.2.108.10</BindIPAddress>
        ///             <Default_Server_Ip type="CSTRING">10.2.108.10</Default_Server_Ip>
        ///         </AppSetting>
        ///     <common>
        ///         <ServerIPPort type="DWORD">6810</ServerIPPort>
        ///         <BlockingCallTimeOut type="DWORD">10000</BlockingCallTimeOut>
        ///      </common>
        ///     <Log>
        ///         <ClientLog type="DWORD">1</ClientLog>
        ///         <ExchangeDir type="CSTRING">C:\CashmasterExchange</ExchangeDir>
        ///     </Log>
        ///     </client>
        /// </configuration>
        /// </summary>
        /// <param name="FileName"></param>
        /// <param name="sFullPath"></param>
        /// <param name="DefaultServerIP"></param>
        /// <param name="BindServerIP"></param>
        public static bool SaveClientConfig(string RootDirectory, string CommConfigFileName, string DefaultServerIP, string BindServerIP, List <string> ReplicateLocations)
        {
            string PROC    = "SaveConfig";
            bool   bStatus = true;
            string _sCashmasterExchange   = "";
            string CommConfigFileLocation = RootDirectory + Path.DirectorySeparatorChar + CommConfigFileName;
            bool   _bCashmasterConfig     = Convert.ToBoolean(ConfigurationManager.AppSettings["CreateCashmasterFolderInsideLogs"].ToString() ?? "false");

            if (_bCashmasterConfig)
            {
                _sCashmasterExchange = BMCRegistryHelper.GetRegKeyValue(string.Empty, "DefaultLogDir", "C:\\Logs") + Path.DirectorySeparatorChar + "CashmasterExchange";
            }
            else
            {
                _sCashmasterExchange = (ConfigurationManager.AppSettings["CashmasterExchangeLogDrive"] ?? "c:") + Path.DirectorySeparatorChar + "CashmasterExchange";
            }
            try
            {
                //Frames xml elements with default values
                XElement xConfig = new XElement("configuration",
                                                new XElement("client",
                                                             new XElement("AppSetting",
                                                                          new XElement("ConfigLocation", new XAttribute("type", "CSTRING"), CommConfigFileLocation),
                                                                          new XElement("BindIPAddress", new XAttribute("type", "CSTRING"), BindServerIP),
                                                                          new XElement("Default_Server_Ip", new XAttribute("type", "CSTRING"), DefaultServerIP)
                                                                          ),
                                                             new XElement("common",
                                                                          new XElement("ServerIPPort", new XAttribute("type", "DWORD"), 6810),
                                                                          new XElement("BlockingCallTimeOut", new XAttribute("type", "DWORD"), 10000)
                                                                          ),
                                                             new XElement("Log",
                                                                          new XElement("ClientLog", new XAttribute("type", "DWORD"), 1),
                                                                          new XElement("ExchangeDir", new XAttribute("type", "CSTRING"), _sCashmasterExchange),
                                                                          new XElement("SocketLog", new XAttribute("type", "DWORD"), 1)
                                                                          )
                                                             )
                                                );

                //Writes to a new file
                if (!WriteConfig(xConfig, CommConfigFileLocation, CommConfigFileName, RootDirectory, ReplicateLocations))
                {
                    bStatus = false;
                }
                //xConfig.Save(CommConfigFileLocation);
                //if (ReplicateLocations != null)
                //{
                //    CopyConfigFiles(CommConfigFileName, CommConfigFileLocation, RootDirectory, ReplicateLocations);
                //}
            }
            catch (Exception ex)
            {
                bStatus = false;
                LogManager.WriteLog(PROC + ": " + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }

            return(bStatus);
        }
Exemplo n.º 11
0
        public bool CheckForPrefixSuffixSetting()
        {
            string bHasSuffix = "";
            string bHasPrefix = "";
            bool   bResult    = false;

            /*RegistryKey regKeyConnectionString = null;
             * try
             * {
             *
             *  regKeyConnectionString = Registry.LocalMachine.OpenSubKey("Software\\Honeyframe\\Cashmaster\\Exchange");
             *  if (regKeyConnectionString != null)
             *  {
             *      bHasSuffix = regKeyConnectionString.GetValue("HasSuffix").ToString();
             *
             *      regKeyConnectionString = Registry.LocalMachine.OpenSubKey("Software\\Honeyframe\\Cashmaster\\Exchange");
             *      if (regKeyConnectionString != null)
             *      {
             *          bHasPrefix = regKeyConnectionString.GetValue("HasPrefix").ToString();
             *
             *          regKeyConnectionString.Close();
             *
             *          if (bHasPrefix == "1" && bHasSuffix == "1")
             *          {
             *              bResult = true;
             *          }
             *          else
             *          {
             *              bResult = false;
             *          }
             *      }
             *      bResult = false;
             *  }
             *  return bResult;
             * }
             * catch (Exception ex)
             * {
             *  ExceptionManager.Publish(ex);
             *  return false;
             * }*/

            try
            {
                bHasSuffix = BMCRegistryHelper.GetRegKeyValue("Cashmaster\\Exchange", "HasSuffix");
                bHasPrefix = BMCRegistryHelper.GetRegKeyValue("Cashmaster\\Exchange", "HasPrefix");
                return((bHasPrefix == "1") && (bHasSuffix == "1"));
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return(false);
            }
        }
Exemplo n.º 12
0
 private string GetReadDate()
 {
     try
     {
         //string value = "";
         return(BMCRegistryHelper.GetRegKeyValue("Cashmaster", "LastAutoRead"));
         //if (ReadFromRegistry("Cashmaster", "LastAutoRead", ref value))
         //    return value;
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
     return(null);
 }
        public bool SetRegSetting(string subkey)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(subkey))
                {
                    return(false);
                }
                BMCRegistryHelper.SetRegKeyValue("Cashmaster", "SQLConnectCDO", RegistryValueKind.String, subkey);
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

            return(true);
        }
        public static IDictionary <string, string> GetGloryServerDetails()
        {
            try
            {
                string[] Separator = new string[1] {
                    ";"
                };
                Dictionary <string, string> dicGloryCDDetailsInt = new Dictionary <string, string>();

                if (dicGloryCDDetails != null && dicGloryCDDetails.Count > 0)
                {
                    return(dicGloryCDDetails);
                }
                string[] strVal = { "ServerName", "PortNo", "UserName", "DeviceName", "SSL" };
                foreach (string sKey in strVal)
                {
                    dicGloryCDDetailsInt.Add(sKey, string.Empty);
                }

                string strGloryConnectionString = BMCRegistryHelper.GetRegKeyValue("Cashmaster", "CDServerInfo");
                strGloryConnectionString = BMC.Common.Security.CryptEncode.Decrypt(strGloryConnectionString);

                string[] sValue = strGloryConnectionString.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
                if (sValue.Count <string>() == 5)
                {
                    dicGloryCDDetailsInt["ServerName"] = sValue[0];
                    dicGloryCDDetailsInt["PortNo"]     = sValue[1];
                    dicGloryCDDetailsInt["UserName"]   = sValue[2];
                    dicGloryCDDetailsInt["DeviceName"] = sValue[3];
                    dicGloryCDDetailsInt["SSL"]        = sValue[4];
                    dicGloryCDDetails = dicGloryCDDetailsInt;
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return(null);
            }
            return(dicGloryCDDetails);
        }
Exemplo n.º 15
0
        private string GetEnterpriseURL()
        {
            //string RegistryPath = ConfigManager.Read("RegistryPath");
            string URL = string.Empty;

            //RegistryKey regKeyConnectionString;
            try
            {
                URL = BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("RegistryPath"), "BGSWebService");


                if (string.IsNullOrEmpty(URL))
                {
                    LogManager.WriteLog("Enterprise URL not Found.", BMC.Common.LogManagement.LogManager.enumLogLevel.Error);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return(URL);
        }
Exemplo n.º 16
0
        public static string PCConnectionString()
        {
            string sKey = string.Empty;
            //bool bUseHex = true;
            //RegistryKey RegKey1;
            string SQLConnect = "";

            ConfigManager.SetConfigurationMode(ConfigManager.ConfigurationMode.AppConfig);
            try
            {
                //Registry path  for exchange.
                //RegKey1 = Registry.LocalMachine.OpenSubKey(ConfigManager.Read("RegistryPath"));

                //BMC.Transport.ExchangeConfig.ExchangeConfigRegistryEntities.RegistryKeyValue = ConfigManager.Read("RegistryPath");
                SQLConnect = BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("RegistryPath"), "PCConnect");         //RegKey1.GetValue("PCConnect").ToString();

                //When the connection string is already there before changes (without encryption), then DO NOT decrypt
                if (!SQLConnect.ToUpper().Contains("SERVER"))
                {
                    //BGSGeneral.cConstants objBGSConstants = new BGSGeneral.cConstants();
                    //BGSEncryptDecrypt.clsBlowFish objDecrypt = new BGSEncryptDecrypt.clsBlowFish();
                    //sKey = objBGSConstants.ENCRYPTIONKEY;
                    //SQLConnect = objDecrypt.DecryptString(ref SQLConnect, ref sKey, ref bUseHex);
                    SQLConnect = BMC.Common.Security.CryptEncode.Decrypt(SQLConnect);
                    LogManager.WriteLog("DB Registry Value " + SQLConnect.Length.ToString(), LogManager.enumLogLevel.Debug);
                }
                // RegKey1.Close();
            }

            catch (Exception ex)
            {
                LogManager.WriteLog("ExchangeConnectionString" + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }


            return(SQLConnect);
        }
Exemplo n.º 17
0
        private  string  GetConnectionString()
        {
            try
            {
                
                if (!string.IsNullOrEmpty(_ExchangeConnectionString))
                {
                    return _ExchangeConnectionString;
                }

                string strConnectionString=string.Empty;
                if (BMCRegistryHelper.IsExchange())
                {
                    Logger.Debug("DataAdapter", "GetConnectionString", "Reading Exchange connection string ");
                    strConnectionString = DatabaseHelper.GetExchangeConnectionString();
                }
                else
                {
                    Logger.Debug("DataAdapter", "GetConnectionString", "Reading Enterprise connection string ");
                    strConnectionString = DatabaseHelper.GetEnterpriseConnectionString();

                }

                if (strConnectionString.ToUpper().Contains("SERVER"))
                    _ExchangeConnectionString = strConnectionString;
                else
                    throw new Exception("Error Decrypting Registry");

            }
            catch (Exception ex)
            {
                if (ex.Message == "Connectionstring Not Found.")
                    throw ex;
                else
                    ExceptionManager.Publish(ex);
            }
            return _ExchangeConnectionString;
        }
        //public static string SetCurrentExchangeConnectionString()
        //{
        //    try
        //    {
        //        bool bUseHex = true;
        //        RegistryKey regKeyConnectionString = Registry.LocalMachine.OpenSubKey("Software\\Honeyframe\\Cashmaster");
        //        string strConnectionString = regKeyConnectionString.GetValue("SQLConnect").ToString();
        //        regKeyConnectionString.Close();

        //        if (!strConnectionString.ToUpper().Contains("SERVER"))
        //        {
        //            BGSGeneral.cConstants objBGSConstants = new BGSGeneral.cConstants();
        //            BGSEncryptDecrypt.clsBlowFish objDecrypt = new BGSEncryptDecrypt.clsBlowFish();
        //            string strKey = objBGSConstants.ENCRYPTIONKEY;
        //            strConnectionString = objDecrypt.DecryptString(ref strConnectionString, ref strKey, ref bUseHex);
        //        }

        //        if (strConnectionString.ToUpper().Contains("SERVER"))
        //            exchangeConnectionString = strConnectionString;
        //        else
        //            throw new Exception("Error Decrypting Registry");

        //    }
        //    catch (Exception ex)
        //    {
        //        if (ex.Message == "Connectionstring Not Found.")
        //            throw ex;
        //        else
        //            ExceptionManager.Publish(ex);
        //    }
        //    return exchangeConnectionString;
        //}

        //public static string SetCurrentTicketConnectionString()
        //{
        //    try
        //    {
        //        RegistryKey regKeyConnectionString = Registry.LocalMachine.OpenSubKey("Software\\Honeyframe\\Cashmaster");
        //        string strConnectionString = regKeyConnectionString.GetValue("TicketingSQLConnect").ToString();
        //        regKeyConnectionString.Close();

        //        if (!strConnectionString.ToUpper().Contains("SERVER"))
        //        {
        //            strConnectionString = BMC.Common.Security.CryptEncode.Decrypt(strConnectionString);
        //        }

        //        if (strConnectionString.ToUpper().Contains("SERVER"))
        //            ticketingConnectionString = strConnectionString;
        //        else
        //            throw new Exception("Error Decrypting Registry");

        //    }
        //    catch (Exception ex)
        //    {
        //        if (ex.Message == "Connectionstring Not Found.")
        //            throw ex;
        //        else
        //            ExceptionManager.Publish(ex);
        //    }
        //    return ticketingConnectionString;
        //}
        //
        private static string GetExchangeConnectionString()
        {
            try
            {
                if (!string.IsNullOrEmpty(exchangeConnectionString))
                {
                    return(exchangeConnectionString);
                }

                string strConnectionString = BMCRegistryHelper.GetRegKeyValue("Cashmaster", "SQLConnect");
                if (!strConnectionString.ToUpper().Contains("SERVER"))
                {
                    strConnectionString = BMC.Common.Security.CryptEncode.Decrypt(strConnectionString);
                }

                if (strConnectionString.ToUpper().Contains("SERVER"))
                {
                    exchangeConnectionString = strConnectionString;
                }
                else
                {
                    throw new Exception("Error Decrypting Registry");
                }
            }
            catch (Exception ex)
            {
                exchangeConnectionString = null;
                if (ex.Message == "Connectionstring Not Found.")
                {
                    throw ex;
                }
                else
                {
                    ExceptionManager.Publish(ex);
                }
            }
            return(exchangeConnectionString);
        }//
Exemplo n.º 19
0
        public void CheckEntepriseConnectivity()
        {
            string strWebServiceURL = string.Empty;

            try
            {
                strWebServiceURL = BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("RegistryPath"), "BGSWebService");
                if (!string.IsNullOrEmpty(strWebServiceURL))
                {
                    EnterpriseWebService.EnterpriseWebService objBGSWebProxy = new EnterpriseWebService.EnterpriseWebService(strWebServiceURL);
                    if (objBGSWebProxy.HelloWebService(10) == 10)
                    {
                        SetListviewItemStyle("EnterpriseConnectivity", 0);
                    }
                    else
                    {
                        SetListviewItemStyle("EnterpriseConnectivity", 1);
                    }
                }
                else
                {
                    SetListviewItemStyle("EnterpriseConnectivity", 1);
                    if (lvGoLive.Items["EnterpriseConnectivity"].SubItems.Count > 2)
                    {
                        lvGoLive.Items["EnterpriseConnectivity"].SubItems[2].Text = "BGSWebServiceURL Registry Key is Empty";
                    }
                    else
                    {
                        lvGoLive.Items["EnterpriseConnectivity"].SubItems.Add("BGSWebServiceURL Registry Key is Empty");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                SetListviewItemStyle("EnterpriseConnectivity", 1);
            }
        }
        public static string GetGloryServerPassword()
        {
            try
            {
                string strLocalGloryPassword = "";

                if (!String.IsNullOrEmpty(strGloryPassword))
                {
                    return(strGloryPassword);
                }

                strLocalGloryPassword = BMCRegistryHelper.GetRegKeyValue("Cashmaster", "CDServerPwd");
                strLocalGloryPassword = BMC.Common.Security.CryptEncode.Decrypt(strLocalGloryPassword);
                strGloryPassword      = strLocalGloryPassword;
            }
            catch (Exception ex)
            {
                BMC.Common.LogManagement.LogManager.WriteLog("Unable to find Glory Server Password from Registry", BMC.Common.LogManagement.LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
                return(null);
            }
            return(strGloryPassword);
        }
Exemplo n.º 21
0
        private void CheckDHCPSetting()
        {
            RegistryKey objDHCPSetting      = null;
            string      strDHCPSettingValue = string.Empty;

            try
            {
                objDHCPSetting      = BMCRegistryHelper.GetRegLocalMachine().OpenSubKey(ConfigManager.Read("RegistryPath") + "\\Exchange");
                strDHCPSettingValue = objDHCPSetting.GetValue("EnableDhcp").ToString();
                if (strDHCPSettingValue.Trim() == "1")
                {
                    SetListviewItemStyle("DHCP", 0);
                }
                else
                {
                    SetListviewItemStyle("DHCP", 1);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                SetListviewItemStyle("DHCP", 1);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Method to check all the prerequisite conditions.
        /// </summary>
        private void UpdateStatus()
        {
            try
            {
                txtStatus.Text = "Connecting to Database.";
                if (_oCommonutilities.SQLConnectionExists())
                {
                    txtStatus.Text = "Verifying Site Details.";
                    if (_oCommonutilities.GetSiteDetails() != null)
                    {
                        if (!new ReportsBusinessObject().IsResetOccuredAndCompleted())
                        {
                            MessageBox.ShowBox("MessageID549", BMC_Icon.Error);
                            App.Current.Shutdown();
                        }

                        if (_oCommonutilities.GetSiteDetails().Tables[0].Rows.Count > 0)
                        {
                            if (
                                _oCommonutilities.GetSiteDetails().Tables[0].Rows[0]["SiteStatus"].ToString().ToUpper() ==
                                "PARTIALLYCONFIGURED")
                            {
                                if (
                                    _oCommonutilities.GetSiteDetails().Tables[0].Rows[0]["SiteEvent"].ToString().ToUpper() ==
                                    "RECOVERY")
                                {
                                    txtStatus.Text = "Starting Site - Recovery Process.";
                                    new SiteCheckPoints("RECOVERY",
                                                        int.Parse(
                                                            _oCommonutilities.GetSiteDetails().Tables[0].Rows[0]["Code"].
                                                            ToString())).Show();
                                }
                                else
                                {
                                    txtStatus.Text = "Starting Site - New Configuration Process.";
                                    new SiteCheckPoints("NEW",
                                                        int.Parse(
                                                            _oCommonutilities.GetSiteDetails().Tables[0].Rows[0]["Code"].
                                                            ToString())).Show();
                                }
                            }
                            else
                            {
                                txtStatus.Text = "Site Verification Complete.";
                                new Login().Show();
                            }
                        }
                        else
                        {
                            try
                            {
                                BMC.Common.ConfigurationManagement.ConfigManager.SetConfigurationMode(BMC.Common.ConfigurationManagement.ConfigManager.ConfigurationMode.AppConfig);
                                if (BMCRegistryHelper.IsExchangeClient())
                                {
                                    txtStatus.Text = "Site Verification Complete.";
                                    new ClientMessage().Show();
                                }
                                else if (BMCRegistryHelper.IsExchangeServer())
                                {
                                    txtStatus.Text = "Site Verification Complete.";
                                    new SiteSetup().Show();
                                }

                                else
                                {
                                    txtStatus.Text = "Site Verification Complete.";
                                    new Login().Show();
                                }
                            }
                            catch (Exception ex)
                            {
                                ExceptionManager.Publish(ex);
                                MessageBox.ShowBox("MessageID1", BMC_Icon.Error);
                                App.Current.Shutdown();
                            }
                        }
                    }
                    else
                    {
                        txtStatus.Text = "Site Verification Complete.";
                        new Login().Show();
                    }
                }
                else
                {
                    txtStatus.Text = "Database Connection - Failed.";
                    MessageBox.ShowBox("MessageID201");
                    Application.Current.Shutdown();
                }
            }
            catch (System.Data.SqlClient.SqlException sqEx)
            {
                ExceptionManager.Publish(sqEx);
                MessageBox.ShowBox("MessageID1", BMC_Icon.Error);
                App.Current.Shutdown();
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                MessageBox.ShowBox("MessageID1", BMC_Icon.Error);
                App.Current.Shutdown();
            }

            this.Close();
        }
Exemplo n.º 23
0
 /// <summary>
 /// Reads from Configuration setting
 /// </summary>
 /// <param name="strKey">Key to get the value from Config</param>
 /// <param name="defaultValue"></param>
 public static string Read(string strKey, string defaultValue)
 {
     return(BMCRegistryHelper.GetRegKeyValueByInstallationType(strKey, defaultValue));
 }
Exemplo n.º 24
0
 /// <summary>
 /// Reads from Configuration setting
 /// </summary>
 /// <param name="strKey">Key to get the value from Config</param>
 public string Read(string strKey)
 {
     return(BMCRegistryHelper.GetRegKeyValueByInstallationType(strKey, string.Empty));
 }
Exemplo n.º 25
0
        public void GetInitialSettings()
        {
            DataSet objDsSetting;
            var     objCdo = oCommonUtilities.CreateInstance();
            DataRow settingsRow;

            try
            {
                objDsSetting = objCdo.GetInitialSettings();
                if (objDsSetting != null && objDsSetting.Tables.Count > 0 && objDsSetting.Tables[0].Rows.Count > 0)
                {
                    settingsRow = objDsSetting.Tables[0].Rows[0];
                    Settings.Gaming_Day_Start_Hour = (settingsRow["GAMING_DAY_START_HOUR"].ToString() != string.Empty) ? int.Parse(settingsRow["GAMING_DAY_START_HOUR"].ToString()) : 0;
                    Settings.Ticket_Expire         = (settingsRow["TICKET_EXPIRE"].ToString() != string.Empty) ? int.Parse(settingsRow["TICKET_EXPIRE"].ToString()) : 0;
                    Settings.Region                   = settingsRow["REGION"].ToString();
                    Settings.Connection               = settingsRow["Connection"].ToString();
                    Settings.HeadCashierSig           = settingsRow["TICKETVALIDATE_REQUIRES_HEADCASHIER_SIG"].ToString();
                    Settings.ManagerSig               = settingsRow["TICKETVALIDATE_REQUIRES_MANAGER_SIG"].ToString();
                    Settings.AllowOffLineRedeem       = (settingsRow["Allow_Offline_Redeem"].ToString() != string.Empty) ? bool.Parse(settingsRow["Allow_Offline_Redeem"].ToString()) : false;
                    Settings.SGVI_Enabled             = (settingsRow["SGVI_ENABLED"].ToString() != string.Empty) ? bool.Parse(settingsRow["SGVI_ENABLED"].ToString()) : false;
                    Settings.VoidTransaction          = (settingsRow["VoidTransactions"].ToString() != string.Empty) ? bool.Parse(settingsRow["VoidTransactions"].ToString()) : false;
                    Settings.OnScreenKeyboard         = (settingsRow["USE_ON_SCREEN_KEYBOARD"].ToString() != string.Empty) ? bool.Parse(settingsRow["USE_ON_SCREEN_KEYBOARD"].ToString()) : false;
                    Settings.EnableTicketRedeemRecipt = (settingsRow["EnableRedeemPrintCDO"].ToString() != string.Empty) ? bool.Parse(settingsRow["EnableRedeemPrintCDO"].ToString()) : false;
                    //Settings.ReceiptPrinter = bool.Parse(SettingsRow["ReceiptPrinter"].ToString());
                    Settings.EnableVoucher         = (settingsRow["TicketValidate_EnableVoucher"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidate_EnableVoucher"].ToString()) : false;
                    Settings.HandpayManual         = (settingsRow["HandpayManualEntry"].ToString() != string.Empty) ? bool.Parse(settingsRow["HandpayManualEntry"].ToString()) : false;
                    Settings.Not_Issue_Ticket      = (settingsRow["CD_NOT_ISSUE_VOUCHER"].ToString() != string.Empty) ? bool.Parse(settingsRow["CD_NOT_ISSUE_VOUCHER"].ToString()) : false;
                    Settings.TicketDeclaration     = settingsRow["TicketDeclarationMethod"].ToString();
                    Settings.TITO_Not_In_Use       = (settingsRow["CD_TITO_NOT_IN_USE"].ToString() != string.Empty) ? bool.Parse(settingsRow["CD_TITO_NOT_IN_USE"].ToString()) : false;
                    Settings.TV_FillScreen         = (settingsRow["TicketValidation_FillScreen"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidation_FillScreen"].ToString()) : false;
                    Settings.EnableLaundering      = (settingsRow["EnableLaundering"].ToString() != string.Empty) ? bool.Parse(settingsRow["EnableLaundering"].ToString()) : false;
                    Settings.CD_Not_Use_Hoppers    = (settingsRow["CD_NOT_USE_HOPPERS"].ToString() != string.Empty) ? bool.Parse(settingsRow["CD_NOT_USE_HOPPERS"].ToString()) : false;
                    Settings.EnableHandpayReceipt  = (settingsRow["TicketValidate_EnableHandpayReceipt"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidate_EnableHandpayReceipt"].ToString()) : false;
                    Settings.EnableIssueReceipt    = (settingsRow["TicketValidate_EnableIssueReceipt"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidate_EnableIssueReceipt"].ToString()) : false;
                    Settings.EnableProgReceipt     = (settingsRow["TicketValidate_EnableProgressivePayoutReceipt"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidate_EnableProgressivePayoutReceipt"].ToString()) : false;
                    Settings.EnableRefillReceipt   = (settingsRow["TicketValidate_EnableRefillReceipt"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidate_EnableRefillReceipt"].ToString()) : false;
                    Settings.EnableRefundReceipt   = (settingsRow["TicketValidate_EnableRefundReceipt"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidate_EnableRefundReceipt"].ToString()) : false;
                    Settings.EnableShortPayReceipt = (settingsRow["TicketValidate_EnableShortpayReceipt"].ToString() != string.Empty) ? bool.Parse(settingsRow["TicketValidate_EnableShortpayReceipt"].ToString()) : false;
                    Settings.RedeemConfirm         = (settingsRow["Confirm_Redeem_Message"].ToString() != string.Empty) ? bool.Parse(settingsRow["Confirm_Redeem_Message"].ToString()) : true;
                    Settings.RegulatoryEnabled     = (settingsRow["RegulatoryEnabled"].ToString() != string.Empty ? bool.Parse(settingsRow["RegulatoryEnabled"].ToString()) : false);
                    Settings.RegulatoryType        = settingsRow["RegulatoryType"].ToString();
                    Settings.SiteCode = settingsRow["TICKET_LOCATION_CODE"].ToString();
                    Settings.HandpayPayoutCustomer_Min       = Convert.ToDouble(settingsRow["HandpayPayoutCustomer_Min"].ToString());
                    Settings.HandpayPayoutCustomer_Max       = Convert.ToDouble(settingsRow["HandpayPayoutCustomer_Max"].ToString());
                    Settings.HandpayPayoutCustomer_BankAccNo = Convert.ToDouble(settingsRow["HandpayPayoutCustomer_BankAccNo"].ToString());

                    Settings.printTicket = (settingsRow["Ithaca950"].ToString() != string.Empty) ? bool.Parse(settingsRow["Ithaca950"].ToString()) : false;
                    Settings.PrinterPort = (settingsRow["PrinterPort"] != null) ? settingsRow["PrinterPort"].ToString() : string.Empty;

                    Settings.WebURL = Convert.ToString(BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read(Constants.CONSTANT_REGISTRYPATH), "BGSWebService"));

                    Settings.IssueTicketMaxValue       = (!settingsRow.IsNull("IssueTicketMaxValue")) ? settingsRow["IssueTicketMaxValue"].ToString() : string.Empty;
                    Settings.PrintTicket_EncryptDigits = (!settingsRow.IsNull("Issue_Ticket_Encrypt_BarCode")) ? bool.Parse(settingsRow["Issue_Ticket_Encrypt_BarCode"].ToString()) : false;
                    Settings.Client = (settingsRow["Client"] != null) ? settingsRow["Client"].ToString() : string.Empty;
                    Settings.MaxHandPayAuthRequired      = (settingsRow["MaxHandPayAuthRequired"].ToString() != string.Empty ? bool.Parse(settingsRow["MaxHandPayAuthRequired"].ToString()) : false);
                    Settings.ManualEntryTicketValidation = (settingsRow["ManualEntryTicketValidation"].ToString() != string.Empty ? bool.Parse(settingsRow["ManualEntryTicketValidation"].ToString()) : false);

                    Settings.RedeemTicketCustomer_Min        = Convert.ToInt32(settingsRow["RedeemTicketCustomer_Min"].ToString());
                    Settings.RedeemTicketCustomer_Max        = Convert.ToInt32(settingsRow["RedeemTicketCustomer_Max"].ToString());
                    Settings.RedeemTicketCustomer_BankAcctNo = Convert.ToInt32(settingsRow["RedeemTicketCustomer_BankAcctNo"].ToString());

                    Settings.RedeemExpiredTicket           = (settingsRow["RedeemExpiredTicket"].ToString() != string.Empty ? bool.Parse(settingsRow["RedeemExpiredTicket"].ToString()) : false);
                    Settings.IsAFTEnabledForSite           = (settingsRow["IsAFTEnabledForSite"].ToString() != string.Empty) ? bool.Parse(settingsRow["IsAFTEnabledForSite"].ToString()) : false;
                    Settings.IsAFTIncludedInCalculation    = (settingsRow["IsAFTIncludedInCalculation"].ToString() != string.Empty) ? bool.Parse(settingsRow["IsAFTIncludedInCalculation"].ToString()) : false;
                    Settings.Auto_Declare_Monies           = (settingsRow["Auto_Declare_Monies"].ToString() != string.Empty) ? bool.Parse(settingsRow["Auto_Declare_Monies"].ToString()) : false;
                    Settings.Disable_Machine_On_Drop       = (settingsRow["DISABLE_MACHINE_ON_DROP"].ToString() != string.Empty) ? bool.Parse(settingsRow["DISABLE_MACHINE_ON_DROP"].ToString()) : false;
                    Settings.NoWaitForDisableMachine       = (settingsRow["NoWaitForDisableMachine"].ToString() != string.Empty) ? bool.Parse(settingsRow["NoWaitForDisableMachine"].ToString()) : false;
                    Settings.AUTOLOGOFF_TIMEOUT            = (settingsRow["AUTOLOGOFF_TIMEOUT"].ToString() != string.Empty) ? Int32.Parse(settingsRow["AUTOLOGOFF_TIMEOUT"].ToString()) : 0;
                    Settings.SHOWHANDPAYCODE               = (settingsRow.Table.Columns.Contains("SHOWHANDPAYCODE")) ? Convert.ToString(settingsRow["SHOWHANDPAYCODE"]).ToUpper() : "TRUE";
                    Settings.IsEmployeeCardTrackingEnabled = (!settingsRow.IsNull("IsEmployeeCardTrackingEnabled")) ? bool.Parse(settingsRow["IsEmployeeCardTrackingEnabled"].ToString()) : false;
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("GetInitialSettings::Error in loading Intial settings from setting table", LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }

            ExtensionMethods.CurrentSiteCulture = ConfigManager.Read("GetDefaultCultureForRegion");
        }
Exemplo n.º 26
0
 private static string GetServerName()
 {
     return(BMCRegistryHelper.GetRegKeyValue(@"Cashmaster\Exchange", "Default_Server_Ip"));
 }
Exemplo n.º 27
0
        /// <summary>
        /// Launch BMC.ExchangeConfig.Client.exe if Config Parameters option is enabled in Enterprise
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSystemConfigParameters_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnSystemConfigParameters.IsEnabled = false;
                string installationPath = "";
                //string installationType = "";
                string ExchangeConfigFileName = "";
                string processName            = "";

                ConfigManager.SetConfigurationMode(ConfigManager.ConfigurationMode.AppConfig);
                //RegistryKey installationPathkey = BMCRegistryHelper.GetRegLocalMachine().OpenSubKey();
                //installationPath = BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("ExchangeClientInstallationPath"), "InstallationPath").ToString();
                installationPath = Extensions.GetStartupDirectory();
                //installationType = installationPathkey.GetValue("InstallationType").ToString();
                bool isExecutableFound = false;


                if (BMCRegistryHelper.IsExchangeClient())
                {
                    ExchangeConfigFileName = "BMC.ExchangeConfig.Client.exe";
                }
                else if (BMCRegistryHelper.IsExchangeServer())
                {
                    ExchangeConfigFileName = "BMC.ExchangeConfig.exe";
                }
                //Removing "exe" string from ExchangeConfigFileName
                processName = ExchangeConfigFileName.Substring(0, ExchangeConfigFileName.Length - 4);
                Process[] bmcClientConfigProcesses = Process.GetProcessesByName(processName);
                if (bmcClientConfigProcesses != null && bmcClientConfigProcesses.Length > 0)
                {
                    return;
                }

                try
                {
                    DirectoryInfo dirInfor = new DirectoryInfo(installationPath);
                    // Get all files whose names starts with FileName Passed
                    FileInfo[] filesInfo = dirInfor.GetFiles(ExchangeConfigFileName +
                                                             "*", SearchOption.TopDirectoryOnly);
                    foreach (FileInfo fi in filesInfo)
                    {
                        if (fi.Name.Equals(ExchangeConfigFileName))
                        {
                            LogManager.WriteLog("Path.Combine(installationPath.Trim() , ExchangeConfigFileName): " + Path.Combine(installationPath.Trim(), ExchangeConfigFileName), LogManager.enumLogLevel.Info);
                            isExecutableFound = true;
                            System.Diagnostics.Process.Start(Path.Combine(installationPath.Trim(), ExchangeConfigFileName));
                            break;
                        }
                    }
                    if (!isExecutableFound)
                    {
                        MessageBox.ShowBox("MessageID327", BMC_Icon.Error, BMC_Button.OK, ExchangeConfigFileName, installationPath);
                        LogManager.WriteLog(string.Format("{0} is not available in {1}", ExchangeConfigFileName, installationPath), LogManager.enumLogLevel.Info);
                    }
                    LogManager.WriteLog(string.Format("Launched {0}", ExchangeConfigFileName), LogManager.enumLogLevel.Info);
                }
                catch (Exception SystemConfigLaunchException)
                {
                    ExceptionManager.Publish(SystemConfigLaunchException);
                }
            }
            finally
            {
                btnSystemConfigParameters.IsEnabled = true;
            }
        }
Exemplo n.º 28
0
        public static bool SaveServerConfig(string RootDirectory, string CommConfigFileName, string DefaultServerIP, string BindServerIP, string dhcpServerIP, int EnableDhcp, string multicastip, string interfaceip, int EncryptEnable, int RSAEnable, int DisMachineWhenRemove, List <string> ReplicateLocations)
        {
            string PROC    = "SaveConfig";
            bool   bStatus = true;
            string _sCashmasterExchange   = "";
            string CommConfigFileLocation = RootDirectory + Path.DirectorySeparatorChar + CommConfigFileName;
            bool   _bCashmasterConfig     = Convert.ToBoolean(ConfigurationManager.AppSettings["CreateCashmasterFolderInsideLogs"].ToString() ?? "false");

            if (_bCashmasterConfig)
            {
                _sCashmasterExchange = BMCRegistryHelper.GetRegKeyValue(string.Empty, "DefaultLogDir", "C:\\Logs") + Path.DirectorySeparatorChar + "CashmasterExchange";
            }
            else
            {
                _sCashmasterExchange = (ConfigurationManager.AppSettings["CashmasterExchangeLogDrive"] ?? "c:") + Path.DirectorySeparatorChar + "CashmasterExchange";
            }

            try
            {
                //Frames xml elements with default values
                XElement xConfig = new XElement("configuration",
                                                new XElement("client",
                                                             new XElement("AppSetting",
                                                                          new XElement("ConfigLocation", new XAttribute("type", "CSTRING"), CommConfigFileLocation),
                                                                          new XElement("BindIPAddress", new XAttribute("type", "CSTRING"), BindServerIP),
                                                                          new XElement("Default_Server_Ip", new XAttribute("type", "CSTRING"), DefaultServerIP)
                                                                          ),
                                                             new XElement("common",
                                                                          new XElement("ServerIPPort", new XAttribute("type", "DWORD"), 6810),
                                                                          new XElement("BlockingCallTimeOut", new XAttribute("type", "DWORD"), 10000)
                                                                          ),
                                                             new XElement("Log",
                                                                          new XElement("ClientLog", new XAttribute("type", "DWORD"), 1),
                                                                          new XElement("ExchangeDir", new XAttribute("type", "CSTRING"), _sCashmasterExchange),
                                                                          new XElement("SocketLog", new XAttribute("type", "DWORD"), 1)
                                                                          )),
                                                new XElement("server",
                                                             new XElement("AppSetting",
                                                                          new XElement("dhcp",
                                                                                       new XElement("ServerIP", new XAttribute("type", "CSTRING"), dhcpServerIP),
                                                                                       new XElement("NetMask", new XAttribute("type", "CSTRING"), "255.255.0.0"),
                                                                                       new XElement("GatewayIP", new XAttribute("type", "CSTRING"), "10.0.0.1"),
                                                                                       new XElement("DNSIP", new XAttribute("type", "CSTRING"), "10.0.0.1"),
                                                                                       new XElement("LeaseTime", new XAttribute("type", "DWORD"), 6850)
                                                                                       ),
                                                                          new XElement("exchange",
                                                                                       new XElement("EnableDhcp", new XAttribute("type", "DWORD"), EnableDhcp),
                                                                                       new XElement("multicastip", new XAttribute("type", "CSTRING"), multicastip),
                                                                                       new XElement("interface", new XAttribute("type", "CSTRING"), interfaceip),
                                                                                       new XElement("DisMachineWhenRemove", new XAttribute("type", "DWORD"), DisMachineWhenRemove),
                                                                                       new XElement("EncryptEnable", new XAttribute("type", "DWORD"), EncryptEnable),
                                                                                       new XElement("RSAEnable", new XAttribute("type", "DWORD"), RSAEnable)
                                                                                       )
                                                                          )
                                                             ));

                //Writes to a new file
                if (!WriteConfig(xConfig, CommConfigFileLocation, CommConfigFileName, RootDirectory, ReplicateLocations))
                {
                    bStatus = false;
                }
            }
            catch (Exception ex)
            {
                bStatus = false;
                LogManager.WriteLog(PROC + ": " + ex.Message.ToString() + ex.Source.ToString(), LogManager.enumLogLevel.Error);
                ExceptionManager.Publish(ex);
            }

            return(bStatus);
        }
        public double EnableDisableVLTBasedonVerfication()
        {
            DataTable AAMSTable;
            bool      IsVerified;

            LogManager.WriteLog("EnableDisableVLTBasedonVerfication - Started.", LogManager.enumLogLevel.Info);

            if (!Convert.ToBoolean(ConfigManager.Read("EnableDisableVLTBasedonVerfication")))
            {
                return(60 * 1000);
            }

            double dTimerDelay   = 60 * 1000;
            double dBlockTimeOut = 10;

            AAMSTable = DBBuilder.GetAAMSDetails(3);

            try
            {
                if (AAMSTable.Rows.Count > 0)
                {
                    ConfigManager.Read("CommsRegistryPath");
                    // var key = BMCRegistryHelper.GetRegLocalMachine().OpenSubKey(ConfigManager.Read("CommsRegistryPath"));
                    //if (key != null)
                    // dBlockTimeOut = Convert.ToDouble(key.GetValue("BlockingCallTimeOut"));
                    dBlockTimeOut = Convert.ToDouble(BMCRegistryHelper.GetRegKeyValue(ConfigManager.Read("CommsRegistryPath"), "BlockingCallTimeOut"));
                    int nMaxThreads = 0;
                    nMaxThreads = Convert.ToInt32(ConfigManager.Read("MaxThreadPoolSize"));

                    LogManager.WriteLog("[EnableDisableVLTBasedonVerfication]- MaxThreads: " + nMaxThreads.ToString(), LogManager.enumLogLevel.Info);
                    LogManager.WriteLog("[EnableDisableVLTBasedonVerfication]- BlockingCallTimeOutValue: " + dBlockTimeOut.ToString(), LogManager.enumLogLevel.Info);
                    dTimerDelay = ((AAMSTable.Rows.Count / nMaxThreads) * dBlockTimeOut) + 10000;
                    LogManager.WriteLog("[EnableDisableVLTBasedonVerfication]: RowCount: " + AAMSTable.Rows.Count.ToString(), LogManager.enumLogLevel.Info);

                    foreach (DataRow row in AAMSTable.Rows)
                    {
                        try
                        {
                            MachineEnableDisable _autoEnableDisable;
                            string EntityCommand    = string.Empty;
                            int    iCurrentStatus   = 0;
                            int    iInstallationNo  = 0;
                            string strSerialno      = string.Empty;
                            string strComment       = string.Empty;
                            bool   enterpriseStatus = false;
                            int    Installation_Float_Status;

                            iCurrentStatus   = row["BAD_Entity_Current_Status"] != DBNull.Value ? Convert.ToInt32(row["BAD_Entity_Current_Status"].ToString()) : 0;
                            strSerialno      = row["BAD_Asset_Serial_No"] == DBNull.Value ? string.Empty : row["BAD_Asset_Serial_No"].ToString();
                            enterpriseStatus = row["BMC_Enterprise_Status"] != DBNull.Value
                                                   ? Convert.ToBoolean(row["BMC_Enterprise_Status"].ToString())
                                                   : true;

                            Installation_Float_Status = row["Installation_Float_Status"] != DBNull.Value ? Convert.ToInt32(row["Installation_Float_Status"]) : 0;
                            iInstallationNo           = row["BAD_Reference_ID"] != DBNull.Value ? Convert.ToInt32(row["BAD_Reference_ID"].ToString()) : 0;

                            LogManager.WriteLog("-- Enable Disable Status for AssetSerialNumber - " + strSerialno + ", " + "- Enterprise Status :" + enterpriseStatus.ToString() + "Inside EnableDisableVLTBasedonVerfication - ", LogManager.enumLogLevel.Info);

                            _autoEnableDisable = new MachineEnableDisable()
                            {
                                Installation_No     = iInstallationNo,
                                Enable              = false,
                                badId               = Convert.ToInt32(row["BAD_ID"]),
                                datapakCurrentState = 0,
                                entityType          = 3,
                                updateDate          = Convert.ToDateTime(row["BAD_Updated_Date"])
                            };

                            if (Installation_Float_Status == 1 && DBBuilder.GetSettingFromDB("DISABLE_MACHINE_ON_DROP", "FALSE").ToUpper() == "TRUE")
                            {
                                LogManager.WriteLog("Disabling the machine - " + strSerialno, LogManager.enumLogLevel.Info);
                                _autoEnableDisable.Enable = false; _autoEnableDisable.datapakCurrentState = 0;
                                ThreadPool.QueueUserWorkItem(new WaitCallback(EnableDisableMachine), _autoEnableDisable);
                                strComment = "Machine Floated and Setting DISABLE_MACHINE_ON_DROP {True} hence disabling.";
                                LogManager.WriteLog(strComment, LogManager.enumLogLevel.Info);
                                DBBuilder.UpdateCommentsForAAMS(row["BAD_ID"].ToString(), strComment, 3, 0);
                            }
                            else
                            {
                                if (enterpriseStatus)
                                {
                                    _autoEnableDisable.Enable = true; _autoEnableDisable.datapakCurrentState = 1;
                                    ThreadPool.QueueUserWorkItem(new WaitCallback(EnableDisableMachine), _autoEnableDisable);
                                    LogManager.WriteLog("Enabling the machine - " + strSerialno, LogManager.enumLogLevel.Info);
                                }
                                else
                                {
                                    _autoEnableDisable.Enable = false; _autoEnableDisable.datapakCurrentState = 0;
                                    ThreadPool.QueueUserWorkItem(new WaitCallback(EnableDisableMachine), _autoEnableDisable);
                                    strComment = "Disabling the machine  - " + strSerialno;
                                    LogManager.WriteLog(strComment, LogManager.enumLogLevel.Info);
                                    DBBuilder.UpdateCommentsForAAMS(row["BAD_ID"].ToString(), strComment, 2, 0);
                                }
                            }

                            LogManager.WriteLog("EnableDisableVLTBasedonVerfication - Completed.", LogManager.enumLogLevel.Info);
                        }
                        catch (Exception ex)
                        {
                            ExceptionManager.Publish(ex);
                        }
                    }
                }
                else
                {
                    LogManager.WriteLog("No Machine to be enabled or disabled.", LogManager.enumLogLevel.Info);
                }

                return(dTimerDelay);
            }
            catch (Exception Ex)
            {
                ExceptionManager.Publish(Ex);
                return(60 * 1000);
            }
        }
        public void RunService()
        {
            //Dictionary<string, string> dictServiceentries = new Dictionary<string, string>();
            RegistrySetting oRegistrySetting = new RegistrySetting();

            try
            {
#if (DEBUG)
                {
                    if (IsRunning == false)
                    {
                        IsRunning            = true;
                        servicetimer.Enabled = true;
                        TimerCount           = TimerCount + 1;
                        oRegistrySetting.ReadRegistrySettings(HourlyDailyEntity.sRegistryPath);
                        if (DateTime.Now.Hour != HourlyDailyEntity.HourlyReadHour)
                        {
                            //LogManager.WriteLog("The Hour: " + HourlyDailyEntity.HourlyReadHour.ToString(), LogManager.enumLogLevel.Debug);
                            if (DBConnect.CheckSqlConnectionExists())
                            {
                                DBConnect.InitialSettings();
                                oHourlyServiceHandle.DoWork();
                                HourlyDailyEntity.HourlyReadHour = DateTime.Now.Hour;
                                dictServiceentries.Add(HourlyDailyEntity.sRegistryPath + "\\\\HourlyReadHour", HourlyDailyEntity.HourlyReadHour.ToString());
                                oRegistrySetting.SetRegistryEntries(dictServiceentries, HourlyDailyEntity.sRegistryPath);
                            }
                        }
                        if (TimerCount == 10)
                        {
                            oRegistrySetting.ReadRegistrySettings(HourlyDailyEntity.sRegistryPath);
                            oDailyReadServiceHandle.DoWork();
                            TimerCount = 0;
                        }
                        IsRunning = false;
                    }
                }
#else
                {
                    if (IsRunning == false)
                    {
                        IsRunning            = true;
                        servicetimer.Enabled = true;
                        TimerCount           = TimerCount + 1;
                        oRegistrySetting.ReadRegistrySettings(HourlyDailyEntity.sRegistryPath);
                        if (DateTime.Now.Hour != HourlyDailyEntity.HourlyReadHour)
                        {
                            //LogManager.WriteLog("The Hour: " + HourlyDailyEntity.HourlyReadHour.ToString(), LogManager.enumLogLevel.Debug);
                            if (DBConnect.CheckSqlConnectionExists())
                            {
                                DBConnect.InitialSettings();
                                oHourlyServiceHandle.DoWork();
                                HourlyDailyEntity.HourlyReadHour = DateTime.Now.Hour;
                                BMCRegistryHelper.SetRegKeyValue(HourlyDailyEntity.sRegistryPath, "HourlyReadHour", Microsoft.Win32.RegistryValueKind.String, HourlyDailyEntity.HourlyReadHour.ToString());
                            }
                        }
                        if (TimerCount == 10)
                        {
                            oRegistrySetting.ReadRegistrySettings(HourlyDailyEntity.sRegistryPath);
                            oDailyReadServiceHandle.DoWork();
                            TimerCount = 0;
                        }
                        IsRunning = false;
                    }
                }
#endif
            }

            catch (Exception ex)
            {
                IsRunning = false;
                //HourlyDailyEventLog.WriteToEventLog(HourlyDailyEntity.EventLogName, "RunService: ", "Message: " + ex.Message + "Source: " + ex.Source, EventLogEntryType.Error);
                ExceptionManager.Publish(ex);
            }
        }