Пример #1
0
        private void OnRetrieveAllDataFromJSONStore()
        {
            WorklightJSONStoreCollection collection = App.WorklightClient.client.JSONStoreService.JSONStore.GetCollectionByName("people");

            if (collection != null)
            {
                JsonArray outArr = collection.FindAllDocuments();
                DisplayAlert("All JSONStore Data",
                             String.Format("JSONStore Person data is:{0}",
                                           outArr.ToString()), "OK");
            }
            else
            {
                DisplayAlert("JSONStore RetrieveData", "Open JSONstore collection before attempting to retrieve data", "OK");
            }
        }
Пример #2
0
        private void OnJSONStoreOpenCollection()
        {
            List <WorklightJSONStoreCollection> collectionList = new List <WorklightJSONStoreCollection>();
            WorklightJSONStoreCollection        collection     = App.WorklightClient.client.JSONStoreService.JSONStoreCollection("people");
            Dictionary <string, WorklightJSONStoreSearchFieldType> searchFieldDict = new Dictionary <string, WorklightJSONStoreSearchFieldType> ();

            //WorklightJSONStoreSearchFieldType searchFied = App.WorklightClient.client.JSONStoreService.JSONStore.se
            searchFieldDict.Add("name", WorklightJSONStoreSearchFieldType.String);
            collection.SearchFields = searchFieldDict;
            searchFieldDict         = collection.SearchFields;
            collectionList.Add(collection);

            DisplayAlert("JSONStore Open Collection Status",
                         String.Format("JSONStore Person Collection was {0} opened",
                                       (App.WorklightClient.client.JSONStoreService.JSONStore.OpenCollections(collectionList)) ? "successfully" : "not"), "OK");
        }
Пример #3
0
        private void OnRetrieveFilteredDataFromJSONStore()
        {
//			JsonObject outArr = App.WorklightClient.client.JSONStoreService.JSONStoreCollection("people").FindDocumentByID(1);
            WorklightJSONStoreQueryPart[] queryParts = new WorklightJSONStoreQueryPart[1];
            queryParts [0] = App.WorklightClient.client.JSONStoreService.JSONStoreQueryPart();
            queryParts [0].AddLike("name", "Chethan");
            WorklightJSONStoreCollection collection = App.WorklightClient.client.JSONStoreService.JSONStore.GetCollectionByName("people");

            if (collection != null)
            {
                JsonArray outArr = collection.
                                   FindDocumentsWithQueryParts(queryParts);
                DisplayAlert("Filtered JSONStore Data",
                             String.Format("JSONStore Person data is {0}",
                                           outArr != null ? outArr.ToString() : "not available"), "OK");
            }
            else
            {
                DisplayAlert("JSONStore RetrieveData", "Open JSONstore collection before attempting to retrieve data", "OK");
            }
        }
Пример #4
0
        private void OnAddDataToJSONStore()
        {
            JsonArray data = new JsonArray();
            JsonValue val  = JsonValue.Parse(" {\"name\" : \"Chethan\", \"laptop\" : \"macbook pro\" } ");
            JsonValue val2 = JsonValue.Parse(" {\"name\" : \"Ajay\", \"laptop\" : \"blackbox\" } ");
            JsonValue val3 = JsonValue.Parse(" {\"name\" : \"Srihari\", \"laptop\" : \"blackbox\" } ");

            data.Add(val);
            data.Add(val2);
            data.Add(val3);
            WorklightJSONStoreCollection collection = App.WorklightClient.client.JSONStoreService.JSONStore.GetCollectionByName("people");

            if (collection != null)
            {
                collection.AddData(data);
            }
            else
            {
                DisplayAlert("JSONStore addData", "Open JSONstore collection before attempting to add data", "OK");
            }
        }
Пример #5
0
        private void OnAddDataToJSONStore()
        {
            JArray  data = new JArray();
            JObject val  = JObject.Parse(" {\"name\" : \"Chethan\", \"laptop\" : 23.546} ");
            JObject val2 = JObject.Parse(" {\"name\" : \"Ajay\", \"laptop\" : [ \"hellow\", 234.23, true] } ");
            JObject val3 = JObject.Parse(" {\"name\" : \"Srihari\", \"laptop\" : true} ");

            data.Add(val);
            data.Add(val2);
            data.Add(val3);
            WorklightJSONStoreCollection collection = App.WorklightClient.client.JSONStoreService.JSONStore.GetCollectionByName("people");

            if (collection != null)
            {
                collection.AddData(data);
            }
            else
            {
                DisplayAlert("JSONStore addData", "Open JSONstore collection before attempting to add data", "OK");
            }
        }