Ejemplo n.º 1
0
        //getNotes(apartmentID)
        async public static Task <List <ListItemObject> > getList(GlobalData gd, int listid)
        {
            Other.UserObject u = gd.CurrentUser;
            int    ApartmentID = u.ApartmentID;
            string get         = baseuri + "getNotes.php?apartmentID=" + ApartmentID;

            string text = await(RestService.GetCall(get));
            List <ListItemObject> ret = new List <ListItemObject>();

            string[] result = Regex.Split(text, "\r\n|\r|\n");
            foreach (string s in result)
            {
                if (s.Equals(""))
                {
                    continue;
                }

                ListItemObject deserializedProduct = JsonConvert.DeserializeObject <ListItemObject>(s);
                if (deserializedProduct.listType != listid)
                {
                    continue;
                }
                ret.Add(deserializedProduct);
            }
            //  ListItemObject deserializedProduct = JsonConvert.DeserializeObject<ListItemObject>(output);
            return(ret);
        }
Ejemplo n.º 2
0
        async void OnAddItem(object sender, EventArgs e)
        {
            ListItemObject it = new ListItemObject();

            it.noteName = itemNameTextField.Text;
            it.listType = type;

            it.data = itemDetailTextField.Text;
            await(ServerHandeler.sendList(it, _gd));
            Application.Current.MainPage = new NavigationPage(new groupProject01.ListsPage(_gd));            //if lists button is pressed
        }
Ejemplo n.º 3
0
        //LIST
        //createList(username, userID, apartmentID, noteName, listType, data, )
        public async static Task <string> sendList(ListItemObject ldata, GlobalData gd)
        {
            //createList(username, userID, apartmentID, noteName, listType, data)
            string  jsonString = JsonConvert.SerializeObject(ldata);
            JObject ob         = JObject.Parse(jsonString);

            ob["username"]    = gd.CurrentUser.username;
            ob["apartmentID"] = gd.CurrentUser.ApartmentID;
            ob["userID"]      = gd.CurrentUser.UserID;
            string result = await(RestService.PostCall(ob.ToString(), baseuri + "createNote.php"));

            return(result);
        }