Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
 /// <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);
     }
 }
        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 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);
            }
        }