Example #1
0
 /**
  *  Returns a TDataSet created by the information contained in the JSONObject
  * @param value a JSONObject that contains the parameters for create the TDataSet
  * @return return the TDataSet object created
  */
 public static new TDataSet createFrom(TJSONObject value)
 {
     TParams parameters = TParams.CreateParametersFromMetadata(value
             .getJSONArray("table"));
     TDataSet dst = new TDataSet(parameters, value);
     return dst;
 }
Example #2
0
        /**
         *  Returns a TDataSet created by the information contained in the JSONObject
         * @param value a JSONObject that contains the parameters for create the TDataSet
         * @return return the TDataSet object created
         */

        public static new TDataSet createFrom(TJSONObject value)
        {
            TParams parameters = TParams.CreateParametersFromMetadata(value
                                                                      .getJSONArray("table"));
            TDataSet dst = new TDataSet(parameters, value);

            return(dst);
        }
Example #3
0
            /// <summary>
            /// Loads DataSet
            /// </summary>
            /// <param name="arguments">The arguments for the update event.</param>
            /// <returns>Loaded DataSet</returns>
            private TDataSet LoadDataSet(ResourceUpdatedEventArgs arguments)
            {
                ULSLogging.LogTraceTag(0x2382100c /* tag_967am */, Categories.ConfigurationDataSet, Levels.Verbose,
                                       "Loading data set for '{0}'.", typeof(TDataSet).Name);

                TDataSet dataSet = m_dataSetDefault ?? new TDataSet();

                try
                {
                    dataSet.Load(arguments.Details);
                }
                catch (Exception exception)
                {
                    ULSLogging.ReportExceptionTag(0x2382100d /* tag_967an */, Categories.ConfigurationDataSet, exception,
                                                  "Exception encountered while loading '{0}'", typeof(TDataSet).Name);
                }

                return(dataSet);
            }
Example #4
0
            /// <summary>
            /// Attempts to load a new dataset and replaces the old one if load was successful
            /// </summary>
            /// <param name="arguments">The arguments for the update event.</param>
            public void UpdateLoadedDataSet(ResourceUpdatedEventArgs arguments)
            {
                if (!Code.ValidateArgument(arguments, nameof(arguments), TaggingUtilities.ReserveTag(0x23821007 /* tag_967ah */)))
                {
                    return;
                }

                TDataSet dataSet = LoadDataSet(arguments);

                if (dataSet != null && dataSet.IsHealthy)
                {
                    ULSLogging.LogTraceTag(0x23821008 /* tag_967ai */, Categories.ConfigurationDataSet, Levels.Verbose,
                                           "Successfully loaded {0} with status 'Healthy'", typeof(TDataSet).Name);
                }
                else
                {
                    ULSLogging.LogTraceTag(0x23821009 /* tag_967aj */, Categories.ConfigurationDataSet, Levels.Error,
                                           "Loaded {0} with status '{1}'", typeof(TDataSet).Name,
                                           dataSet != null ? dataSet.IsHealthy ? "Healthy" : "Not healthy" : "DataSet is null");
                }

                if (LoadedDataSet == null)
                {
                    LoadedDataSet = dataSet;
                }
                else if ((!LoadedDataSet.IsHealthy && dataSet != null) || (dataSet != null && dataSet.IsHealthy))
                {
                    ULSLogging.LogTraceTag(0x2382100a /* tag_967ak */, Categories.ConfigurationDataSet, Levels.Verbose,
                                           "Replacing old {0} loaded at {1} with data loaded with status '{2}'", typeof(TDataSet).Name, LoadedDataSet.LastReload,
                                           dataSet.IsHealthy ? "Healthy" : "Not healthy");
                    LoadedDataSet = dataSet;
                }
                else
                {
                    ULSLogging.LogTraceTag(0x2382100b /* tag_967al */, Categories.ConfigurationDataSet, Levels.Error,
                                           "Not replacing old {0} with data loaded with status '{1}'", typeof(TDataSet).Name,
                                           dataSet != null ? dataSet.IsHealthy ? "Healthy" : "Not healthy" : "DataSet is null");
                    FailedToLoadDataSet = dataSet;
                }

                LoadDetails = dataSet?.LoadDetails;
            }