Beispiel #1
0
        public static void TakeSnapShot_Daily(Object state)
        {
            long startTicks = VNC.AppLog.Info("Start", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);

            ExpandMask.DatabaseExpandSetting  databaseExpandSetting  = new ExpandMask.DatabaseExpandSetting(Data.Config.ExpandSetting_Daily_Database);
            ExpandMask.InstanceExpandSetting  instanceExpandSetting  = new ExpandMask.InstanceExpandSetting(Data.Config.ExpandSetting_Daily_Instance);
            ExpandMask.JobServerExpandSetting jobServerExpandSetting = new ExpandMask.JobServerExpandSetting(Data.Config.ExpandSetting_Daily_JobServer);

            TakeSnapShot(instanceExpandSetting, jobServerExpandSetting, databaseExpandSetting);

            VNC.AppLog.Info("End", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10, startTicks);
        }
Beispiel #2
0
        public static void TakeSnapShot_Weekly(Object state)
        {
            long startTicks = VNC.AppLog.Info("Start", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);

            ExpandMask.DatabaseExpandSetting  databaseExpandSetting  = new ExpandMask.DatabaseExpandSetting(Data.Config.ExpandSetting_Weekly_Database);
            ExpandMask.InstanceExpandSetting  instanceExpandSetting  = new ExpandMask.InstanceExpandSetting(Data.Config.ExpandSetting_Weekly_Instance);
            ExpandMask.JobServerExpandSetting jobServerExpandSetting = new ExpandMask.JobServerExpandSetting(Data.Config.ExpandSetting_Weekly_JobServer);

            // TODO(crhodes): Get concurrency or day of week scheduling to work right before allowing this.
            //TakeSnapShot(instanceExpandSetting, jobServerExpandSetting, databaseExpandSetting);

            VNC.AppLog.Info("End", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10, startTicks);
        }
Beispiel #3
0
        /// <summary>
        /// Process work each time the timer "Awakens" the SQLInformation DataLoadService
        /// </summary>
        public static void TakeSnapShot_Weekly(Object state)
        {
#if TRACE
            long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);
#endif
            System.Diagnostics.Debug.WriteLine("TakeSnapShot_Weekly");

            // TODO(crhodes): Figure out what we want to do here.   For now just grab something out of Config.

            ExpandMask.DatabaseExpandSetting databaseExpandSetting = new ExpandMask.DatabaseExpandSetting(Data.Config.ExpandSetting_Weekly_Database);
            ExpandMask.InstanceExpandSetting instanceExpandSetting = new ExpandMask.InstanceExpandSetting(Data.Config.ExpandSetting_Weekly_Instance);

            PLLog.Debug(
                string.Format("Start instanceExpandSetting:{0} databaseExpandSetting:{1}", instanceExpandSetting.ExpandMask, databaseExpandSetting.ExpandMask),
                PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);

            SMO.Helper.Load_Instances_FromSMO(Common.ApplicationDataSet.Instances, instanceExpandSetting, databaseExpandSetting);

            //// Only do work if a business day, otherwise wait till tomorrow.

            //Predictor predictor = new Predictor(Config.MCRRequestsDBConnection, true, false, true);

            ////Don't run on non-business days

            //if(predictor.IsBusinessDay(Config.CurrentDate))
            //{
            //    PLLog.Info("Business Day", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 7);

            //    try
            //    {
            //        Data.DB.UpdateOffices();
            //        GetUnprocessedRequestsFromDB();
            //    }
            //    catch(Exception ex)
            //    {
            //        // TODO(crhodes): Determine what should happen here.  Seems like we should not continue.
            //        PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8);
            //    }
            //}
            //else
            //{
            //    PLLog.Info("Not a Business Day", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 9);
            //}
#if TRACE
            PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10, startTicks);
#endif
        }
Beispiel #4
0
        public static void TakeSnapShot(
            ExpandMask.InstanceExpandSetting instanceExpandSetting,
            ExpandMask.JobServerExpandSetting jobServerExpandSetting,
            ExpandMask.DatabaseExpandSetting databaseExpandSetting)
        {
#if TRACE
            long startTicks = VNC.AppLog.Trace("Start", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);
#endif
            System.Diagnostics.Debug.WriteLine("TakeSnapShot");

            VNC.AppLog.Debug(
                string.Format("Start instanceExpandSetting:{0} jobServerExpandSetting:{2} databaseExpandSetting:{2}",
                              instanceExpandSetting.ExpandMask, jobServerExpandSetting, databaseExpandSetting.ExpandMask),
                LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);

            // Need to load the data here as it may change from snapshot to snapshot.

            //var dataRow = Common.ApplicationDataSet.ApplicationUsage.NewApplicationUsageRow();
            var        currentTime = DateTime.Now;
            IPrincipal currentUser = new WindowsPrincipal(WindowsIdentity.GetCurrent());

            var eventMessage = string.Format("Start TakeSnapShot(IES:{0}  JES:{1}  DES:{2})",
                                             instanceExpandSetting.ExpandMask, jobServerExpandSetting.ExpandMask, databaseExpandSetting.ExpandMask);

            IndicateApplicationUsage(LOG_APPNAME, currentTime, currentUser.Identity.Name, eventMessage);

            SQLInformation.Common.ApplicationDataSet.LoadApplicationDataSetFromDB(SQLInformation.Common.ApplicationDataSet);

            SMO.Instance.LoadFromSMO(Common.ApplicationDataSet.Instances, instanceExpandSetting, jobServerExpandSetting, databaseExpandSetting);

            long duration = (Stopwatch.GetTimestamp() - startTicks) / Stopwatch.Frequency;

            eventMessage = string.Format("End TakeSnapShot(IES:{0}  JES:{1}  DES:{2}) - {3}",
                                         instanceExpandSetting.ExpandMask, jobServerExpandSetting.ExpandMask, databaseExpandSetting.ExpandMask, duration);

            IndicateApplicationUsage(LOG_APPNAME, currentTime, currentUser.Identity.Name, eventMessage);

            //SMO.Helper.Load_Instances_FromSMO(Common.ApplicationDataSet.Instances, instanceExpandSetting, jobServerExpandSetting, databaseExpandSetting);

            //// Only do work if a business day, otherwise wait till tomorrow.

            //Predictor predictor = new Predictor(Config.MCRRequestsDBConnection, true, false, true);

            ////Don't run on non-business days

            //if(predictor.IsBusinessDay(Config.CurrentDate))
            //{
            //    VNC.AppLog.Info("Business Day", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 7);

            //    try
            //    {
            //        Data.DB.UpdateOffices();
            //        GetUnprocessedRequestsFromDB();
            //    }
            //    catch(Exception ex)
            //    {
            //        // TODO(crhodes): Determine what should happen here.  Seems like we should not continue.
            //        VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8);
            //    }
            //}
            //else
            //{
            //    VNC.AppLog.Info("Not a Business Day", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 9);
            //}
#if TRACE
            VNC.AppLog.Trace("End", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10, startTicks);
#endif
        }