Esempio n. 1
0
        /// <summary>
        /// Writes the JSON representation of the <see cref="JqGridSearchingFilters"/>.
        /// </summary>
        /// <param name="writer">The <see cref="IJqGridJsonWriter"/>.</param>
        /// <param name="jqGridSearchingFilters">The <see cref="JqGridSearchingFilters"/>.</param>
        public static void WriteJqGridSearchingFilters(IJqGridJsonWriter writer, JqGridSearchingFilters jqGridSearchingFilters)
        {
            writer.WriteStartObject();

            writer.WriteProperty(GROUPING_OPERATOR_FIELD_NAME, jqGridSearchingFilters.GroupingOperator.ToString().ToUpperInvariant());

            if ((jqGridSearchingFilters.Filters != null) && (jqGridSearchingFilters.Filters.Count > 0))
            {
                writer.WriteStartArray(FILTERS_FIELD_NAME);
                foreach (JqGridSearchingFilter jqGridRequestSearchingFilter in jqGridSearchingFilters.Filters)
                {
                    WriteJqGridSearchingFilter(writer, jqGridRequestSearchingFilter);
                }
                writer.WriteEndArray();
            }

            if ((jqGridSearchingFilters.Groups != null) && (jqGridSearchingFilters.Groups.Count > 0))
            {
                writer.WriteStartArray(GROUP_FIELD_NAME);
                foreach (JqGridSearchingFilters innerSearchingFilters in jqGridSearchingFilters.Groups)
                {
                    WriteJqGridSearchingFilters(writer, innerSearchingFilters);
                }
                writer.WriteEndArray();
            }

            writer.WriteEndObject();
        }
Esempio n. 2
0
        private static void WriteJqGridSearchingFilter(IJqGridJsonWriter writer, JqGridSearchingFilter jqGridSearchingFilter)
        {
            writer.WriteStartObject();

            writer.WriteProperty(SEARCHING_NAME_FIELD_NAME, jqGridSearchingFilter.SearchingName);

            writer.WriteProperty(SEARCHING_OPERATOR_FIELD_NAME, jqGridSearchingFilter.SearchingOperator.ToString().ToLowerInvariant());

            writer.WriteProperty(SEARCHING_VALUE_FIELD_NAME, jqGridSearchingFilter.SearchingValue);

            writer.WriteEndObject();
        }
Esempio n. 3
0
        /// <summary>
        /// Writes the JSON representation of the <see cref="JqGridResponse"/>.
        /// </summary>
        /// <param name="writer">The <see cref="IJqGridJsonWriter"/>.</param>
        /// <param name="response">The <see cref="JqGridResponse"/>.</param>
        public static void WriteJqGridResponse(IJqGridJsonWriter writer, JqGridResponse response)
        {
            JqGridJsonReader jsonReader = (response.Reader == null) ? JqGridResponse.JsonReader : response.Reader;

            writer.WriteStartObject();

            if (!response.IsSubgridResponse)
            {
                WritePagingProperties(writer, jsonReader, response);
                WrtieUserData(writer, jsonReader, response);
            }

            WriteJqGridRecords(writer, response.IsSubgridResponse, jsonReader, response.Records);

            writer.WriteEndObject();
        }