Example #1
0
 private static void UpdateDataSet(this MSMOA.AlertCategory alertCategory, Data.ApplicationDataSet.JSAlertCategoriesRow dataRow)
 {
     try
     {
         //dataRow.X = alertCategory.X;
     }
     catch (Exception ex)
     {
         VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8);
         // 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 Update(MSMOA.AlertCategory alertCategory, SQLInformation.Data.ApplicationDataSet.JSAlertCategoriesRow dataRow)
        {
            try
            {
                alertCategory.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 #3
0
        private static SQLInformation.Data.ApplicationDataSet.JSAlertCategoriesRow Add(MSMOA.AlertCategory alertCategory, SQLInformation.Data.ApplicationDataSet.JobServersRow jobServerRow)
        {
            SQLInformation.Data.ApplicationDataSet.JSAlertCategoriesRow dataRow = null;

            try
            {
                dataRow    = Common.ApplicationDataSet.JSAlertCategories.NewJSAlertCategoriesRow();
                dataRow.ID = Guid.NewGuid();

                dataRow.Name_JSAlertCategory = alertCategory.Name;
                dataRow.JobServer_ID         = jobServerRow.ID;

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

                Common.ApplicationDataSet.JSAlertCategories.AddJSAlertCategoriesRow(dataRow);
                Common.ApplicationDataSet.JSAlertCategoriesTA.Update(Common.ApplicationDataSet.JSAlertCategories);
            }
            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 #4
0
        private static SQLInformation.Data.ApplicationDataSet.JSAlertCategoriesRow GetInfoFromSMO(MSMOA.AlertCategory alertCategory, SQLInformation.Data.ApplicationDataSet.JobServersRow jobServerRow)
        {
#if TRACE
            long startTicks = VNC.AppLog.Trace4(string.Format("Enter ({0})", alertCategory.Name), LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2);
#endif

            SQLInformation.Data.ApplicationDataSet.JSAlertCategoriesRow dataRow = null;

            try
            {
                var dbs = from db in Common.ApplicationDataSet.JSAlertCategories
                          where db.JobServer_ID == jobServerRow.ID
                          select db;

                var dbs2 = from db2 in dbs
                           where db2.Name_JSAlertCategory == alertCategory.Name
                           select db2;

                if (dbs2.Count() > 0)
                {
                    dataRow = dbs2.First();
                    Update(alertCategory, dataRow);
                }
                else
                {
                    dataRow = Add(alertCategory, jobServerRow);
                }
            }
            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);
        }