Esempio n. 1
0
            public static string getJsonString(projectResults ProjectResults)
            {
                StringWriter   sw   = new StringWriter();
                JsonTextWriter json = new JsonTextWriter(sw);

                json.WriteStartObject();
                json.WritePropertyName("results");
                json.WriteStartArray();


                //TODO context projResults needs to update for multiple query operation
                foreach (results rslts in ProjectResults.results)
                {
                    json.WriteStartObject();
                    // ProjectID and QueryID
                    json.WritePropertyName("ProjectID");

                    // get projectid, for subjhow
                    json.WriteValue((rslts.schema.Count > 0) ? rslts.schema[0].project : ProjectResults.results[0].schema[0].project);
                    json.WritePropertyName("QueryID");
                    json.WriteValue((rslts.schema.Count > 0) ? rslts.schema[0].name : String.Format("{0}.subquery", ProjectResults.results[0].schema[0].name));

                    if (rslts.schema.Count > 0)
                    {
                        // parameters
                        json.WritePropertyName("parameters");
                        getParameterJsonStringArray(json, rslts.schema[0].parameters);

                        // paging
                        json.WritePropertyName("paging");

                        string pagingstring = JsonConvert.SerializeObject(rslts.schema[0].paging);
                        json.WriteRawValue(pagingstring);
                    }

                    // fields
                    json.WritePropertyName("fields");
                    getFieldJsonStringArray(json, (rslts.schema.Count > 0) ? rslts.schema[0].fields : ProjectResults.results[0].schema[0].fields);

                    // results
                    json.WritePropertyName("result");
                    getRowJsonStringArray(json, rslts.result, (rslts.schema.Count > 0) ? rslts.schema[0].fields : ProjectResults.results[0].schema[0].fields);
                    json.WriteEndObject();
                }
                json.WriteEndArray();
                json.WriteEndObject();

                json.Flush();
                sw.Flush();

                return(sw.ToString());
            }
Esempio n. 2
0
            public static void getProjectGrouped(projectResults ProjectResults, XmlWriter XWriter, params string[] Grouped)
            {
                try
                {
                    if (Timing != null)
                    {
                        Timing.Start("getResultGrouped");
                    }

                    foreach (var results in ProjectResults.results)
                    {
                        getResultGrouped(results, XWriter, Grouped);
                    }
                }
                finally
                {
                    Timing.End("getResultGrouped");
                }
            }
Esempio n. 3
0
 public static void getProjectGrouped(projectResults ProjectResults, XmlWriter XWriter, params string[] Grouped)
 {
     foreach (var results in ProjectResults.results)
     {
         getResultGrouped(results, XWriter, Grouped);
     }
 }
Esempio n. 4
0
            public static string getJsonString(projectResults ProjectResults)
            {
                StringWriter sw = new StringWriter();
                JsonTextWriter json = new JsonTextWriter(sw);

                json.WriteStartObject();
                json.WritePropertyName("results");
                json.WriteStartArray();

                //TODO context projResults needs to update for multiple query operation
                foreach (results rslts in ProjectResults.results)
                {
                    json.WriteStartObject();
                    // ProjectID and QueryID
                    json.WritePropertyName("ProjectID");

                    // get projectid, for subjhow
                    json.WriteValue((rslts.schema.Count > 0 ) ? rslts.schema[0].project : ProjectResults.results[0].schema[0].project);
                    json.WritePropertyName("QueryID");
                    json.WriteValue((rslts.schema.Count > 0 ) ? rslts.schema[0].name : String.Format("{0}.subquery",  ProjectResults.results[0].schema[0].name));

                    if (rslts.schema.Count > 0)
                    {
                        // parameters
                        json.WritePropertyName("parameters");
                        getParameterJsonStringArray(json, rslts.schema[0].parameters);

                        // paging
                        json.WritePropertyName("paging");

                        string pagingstring = JsonConvert.SerializeObject(rslts.schema[0].paging);
                        json.WriteRawValue(pagingstring);
                    }

                    // fields
                    json.WritePropertyName("fields");
                    getFieldJsonStringArray(json, (rslts.schema.Count > 0) ? rslts.schema[0].fields : ProjectResults.results[0].schema[0].fields);

                    // results
                    json.WritePropertyName("result");
                    getRowJsonStringArray(json, rslts.result, (rslts.schema.Count > 0) ? rslts.schema[0].fields : ProjectResults.results[0].schema[0].fields);
                    json.WriteEndObject();

                }
                json.WriteEndArray();
                json.WriteEndObject();

                json.Flush();
                sw.Flush();

                return sw.ToString();
            }
Esempio n. 5
0
 public static bool LoadFromFile(string fileName, out projectResults obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
Esempio n. 6
0
 /// <summary>
 /// Deserializes xml markup from file into an projectResults object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output projectResults object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out projectResults obj, out System.Exception exception)
 {
     exception = null;
     obj = default(projectResults);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
Esempio n. 7
0
 public static bool Deserialize(string xml, out projectResults obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
Esempio n. 8
0
 /// <summary>
 /// Deserializes workflow markup into an projectResults object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output projectResults object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out projectResults obj, out System.Exception exception)
 {
     exception = null;
     obj = default(projectResults);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
Esempio n. 9
0
 public DatabaseQuery(DatabaseConnection Connection, ProjectFlx.Schema.projectResults ProjectResults)
 {
     _database    = Connection;
     _Projresults = ProjectResults;
 }