Example #1
0
 public static void UpdateDataSet(this MSMOA.JobSchedule jobSchedule, Data.ApplicationDataSet.JSJobSchedulesRow dataRow)
 {
     try
     {
         dataRow.ActiveEndDate              = jobSchedule.ActiveEndDate;
         dataRow.ActiveEndTimeOfDay         = jobSchedule.ActiveEndTimeOfDay;
         dataRow.ActiveStartDate            = jobSchedule.ActiveStartDate;
         dataRow.ActiveStartTimeOfDay       = jobSchedule.ActiveStartTimeOfDay;
         dataRow.DateCreated                = jobSchedule.DateCreated;
         dataRow.FrequencyInterval          = jobSchedule.FrequencyInterval.ToString();
         dataRow.FrequencyRecurrenceFactor  = jobSchedule.FrequencyRecurrenceFactor.ToString();
         dataRow.FrequencyRelativeIntervals = jobSchedule.FrequencyRelativeIntervals.ToString();
         dataRow.FrequencySubDayInterval    = jobSchedule.FrequencySubDayInterval.ToString();
         dataRow.FrequencySubDayTypes       = jobSchedule.FrequencySubDayTypes.ToString();
         dataRow.FrequencyTypes             = jobSchedule.FrequencyTypes.ToString();
         dataRow.ID_JobSchedule             = jobSchedule.ID;
         dataRow.IsEnabled = jobSchedule.IsEnabled;
         dataRow.JobCount  = jobSchedule.JobCount;
     }
     catch (Exception ex)
     {
         VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 7);
         // TODO(crhodes):
         // Wrap anything above that throws an exception that we want to ignore,
         // e.g. property not available because of SQL Edition.
     }
 }
Example #2
0
 private static void UpdateDataSet(this MSMOA.JobSchedule jobSchedule, Data.ApplicationDataSet.JSJobSchedulesRow dataRow)
 {
     try
     {
         //dataRow.X = jobSchedule.X;
     }
     catch (Exception ex)
     {
         // TODO(crhodes):
         // Wrap anything above that throws an exception that we want to ignore,
         // e.g. property not available because of SQL Edition.
         VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10);
     }
 }
Example #3
0
        private static void Update(MSMOA.JobSchedule jobSchedule, SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow dataRow)
        {
            try
            {
                jobSchedule.UpdateDataSet(dataRow);

                UpdateDatabaseWithSnapShot(dataRow, "");
            }
            catch (Exception ex)
            {
                VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6);

                UpdateDatabaseWithSnapShot(dataRow, ex.ToString().Substring(0, 256));
            }
        }
Example #4
0
        private static SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow Add(MSMOA.JobSchedule jobSchedule)
        {
            SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow dataRow = null;

            try
            {
                dataRow    = Common.ApplicationDataSet.JSJobSchedules.NewJSJobSchedulesRow();
                dataRow.ID = Guid.NewGuid();

                dataRow.Name_JSJobSchedule = jobSchedule.Name;
                //jobScheduleRow.JSJob_ID = jobID;

                dataRow.ActiveEndDate              = jobSchedule.ActiveEndDate;
                dataRow.ActiveEndTimeOfDay         = jobSchedule.ActiveEndTimeOfDay;
                dataRow.ActiveStartDate            = jobSchedule.ActiveStartDate;
                dataRow.ActiveStartTimeOfDay       = jobSchedule.ActiveStartTimeOfDay;
                dataRow.DateCreated                = jobSchedule.DateCreated;
                dataRow.FrequencyInterval          = jobSchedule.FrequencyInterval.ToString();
                dataRow.FrequencyRecurrenceFactor  = jobSchedule.FrequencyRecurrenceFactor.ToString();
                dataRow.FrequencyRelativeIntervals = jobSchedule.FrequencyRelativeIntervals.ToString();
                dataRow.FrequencySubDayInterval    = jobSchedule.FrequencySubDayInterval.ToString();
                dataRow.FrequencySubDayTypes       = jobSchedule.FrequencySubDayTypes.ToString();
                dataRow.FrequencyTypes             = jobSchedule.FrequencyTypes.ToString();
                dataRow.ID_JobSchedule             = jobSchedule.ID;
                dataRow.IsEnabled = jobSchedule.IsEnabled;
                dataRow.JobCount  = jobSchedule.JobCount;

                dataRow.SnapShotDate  = DateTime.Now;
                dataRow.SnapShotError = "";

                Common.ApplicationDataSet.JSJobSchedules.AddJSJobSchedulesRow(dataRow);
                Common.ApplicationDataSet.JSJobSchedulesTA.Update(Common.ApplicationDataSet.JSJobSchedules);
            }
            catch (Exception ex)
            {
                VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 5);
                // TODO(crhodes):
                // Wrap anything above that throws an exception that we want to ignore,
                // e.g. property not available because of SQL Edition.

                UpdateDatabaseWithSnapShot(dataRow, ex.ToString().Substring(0, 256));
            }

            return(dataRow);
        }
Example #5
0
        private static void Update(MSMOA.JobSchedule jobSchedule, SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow dataRow)
        {
            //try
            //{
            //    if (dataRow.IsMonitored)
            //    {
            //        jobSchedule.UpdateDataSet(dataRow);

            //        UpdateDatabaseWithSnapShot(dataRow, "");
            //    }
            //}
            //catch (Exception ex)
            //{
            //    UpdateDatabaseWithSnapShot(dataRow, ex.ToString().Substring(0, 256));

            //    VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 9);
            //}
        }
Example #6
0
        private static SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow GetInfoFromSMO(MSMOA.JobSchedule jobSchedule, SQLInformation.Data.ApplicationDataSet.JobServersRow jobServerRow)
        {
#if TRACE
            long startTicks = VNC.AppLog.Trace4(string.Format("Enter ({0})", jobSchedule.Name), LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2);
#endif

            SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow dataRow = null;

            //// TODO(crhodes) Needs work.  See TBTrigger for hints
            //var dbs = from db in Common.ApplicationDataSet.JSJobSchedules
            //          where db. == jobServerRow.ID
            //          select db;

            //var dbs2 = from db2 in dbs
            //           where db2.Name_JSJobSchedule == jobSchedule.Name
            //           select db2;

            //if (dbs2.Count() > 0)
            //{
            //    // We have found a JobServer with a matching name.
            //    // TODO(crhodes): There should only be one.

            //    try
            //    {
            //        foreach (var item in dbs2)
            //        {
            //            jobScheduleRow = item;

            //            //if (targetServerRow.IsMonitored)
            //            //{
            //            //    // Update the main entry

            //            jobSchedule.UpdateDataSet(item);
            //            jobScheduleRow.SnapShotDate = DateTime.Now;
            //            jobScheduleRow.SnapShotError = "";
            //            Common.ApplicationDataSet.JSJobSchedulesTA.Update(Common.ApplicationDataSet.JSJobSchedules);

            //            //    // Add add the Snapshot

            //            //    //TakeJobServerSnapShot(jobServerRow);
            //            //}
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        jobScheduleRow.SnapShotDate = DateTime.Now;
            //        jobScheduleRow.SnapShotError = ex.ToString().Substring(0, 256);
            //        Common.ApplicationDataSet.JSJobSchedulesTA.Update(Common.ApplicationDataSet.JSJobSchedules);
            //        VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 41);
            //    }
            //}
            //else
            //{
            //    // Add new one
            //    try
            //    {
            //        jobScheduleRow = Common.ApplicationDataSet.JSJobSchedules.NewJSJobSchedulesRow();
            //        jobScheduleRow.ID = Guid.NewGuid();

            //        jobScheduleRow.Name_JSJobSchedule = jobSchedule.Name;
            //        jobScheduleRow.JSJob_ID = jobID;

            //        jobScheduleRow.ActiveEndDate = jobSchedule.ActiveEndDate;
            //        jobScheduleRow.ActiveEndTimeOfDay = jobSchedule.ActiveEndTimeOfDay;
            //        jobScheduleRow.ActiveStartDate = jobSchedule.ActiveStartDate;
            //        jobScheduleRow.ActiveStartTimeOfDay = jobSchedule.ActiveStartTimeOfDay;
            //        jobScheduleRow.DateCreated = jobSchedule.DateCreated;
            //        jobScheduleRow.FrequencyInterval = jobSchedule.FrequencyInterval.ToString();
            //        jobScheduleRow.FrequencyRecurrenceFactor = jobSchedule.FrequencyRecurrenceFactor.ToString();
            //        jobScheduleRow.FrequencyRelativeIntervals = jobSchedule.FrequencyRelativeIntervals.ToString();
            //        jobScheduleRow.FrequencySubDayInterval = jobSchedule.FrequencySubDayInterval.ToString();
            //        jobScheduleRow.FrequencySubDayTypes = jobSchedule.FrequencySubDayTypes.ToString();
            //        jobScheduleRow.FrequencyTypes = jobSchedule.FrequencyTypes.ToString();
            //        jobScheduleRow.ID_JobSchedule = jobSchedule.ID;
            //        jobScheduleRow.IsEnabled = jobSchedule.IsEnabled;
            //        jobScheduleRow.JobCount = jobSchedule.JobCount;

            //        jobScheduleRow.SnapShotDate = DateTime.Now;
            //dataRow.SnapShotError = "";


            //        Common.ApplicationDataSet.JSJobSchedules.AddJSJobSchedulesRow(jobScheduleRow);
            //        Common.ApplicationDataSet.JSJobSchedulesTA.Update(Common.ApplicationDataSet.JSJobSchedules);
            //    }
            //    catch (Exception ex)
            //    {
            //        jobScheduleRow.SnapShotDate = DateTime.Now;
            //        jobScheduleRow.SnapShotError = ex.ToString().Substring(0, 256);
            //        Common.ApplicationDataSet.JSJobSchedulesTA.Update(Common.ApplicationDataSet.JSJobSchedules);
            //        VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 47);
            //    }
            //}

#if TRACE
            VNC.AppLog.Trace4("Exit", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10, startTicks);
#endif
            return(dataRow);
        }
Example #7
0
        private static SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow GetInfoFromSMO(MSMOA.JobSchedule jobSchedule, SQLInformation.Data.ApplicationDataSet.JobServersRow jobServerRow)
        {
#if TRACE
            long startTicks = VNC.AppLog.Trace4(string.Format("Enter ({0})", jobSchedule.Name), LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2);
#endif
            SQLInformation.Data.ApplicationDataSet.JSJobSchedulesRow dataRow = null;

            try
            {
                // TODO(crhodes) Needs work.  See TBTrigger for hints
                // JSJob_ID may be null.
                var jbs = from js in Common.ApplicationDataSet.JSJobSchedules
                          where js.JSJob_ID == jobServerRow.ID
                          select js;

                var dbs2 = from db2 in jbs
                           where db2.Name_JSJobSchedule == jobSchedule.Name
                           select db2;

                if (dbs2.Count() > 0)
                {
                    dataRow = dbs2.First();
                    Update(jobSchedule, dataRow);
                }
                else
                {
                    dataRow = Add(jobSchedule);
                }
            }
            catch (Exception ex)
            {
                VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3);
            }
#if TRACE
            VNC.AppLog.Trace4("Exit", LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 4, startTicks);
#endif
            return(dataRow);
        }