Пример #1
0
        async void add(Object sender, EventArgs e)
        {
            DatabaseGET conn  = new DatabaseGET();
            List <Food> foods = await conn.getFoods();

            var imageUrl = "https://firebasestorage.googleapis.com/v0/b/livewell-78cf1.appspot.com/o/question.jpg?alt=media&token=7ac00a49-b7a1-4ce1-b447-31eba31406ea";

            for (int i = 0; i < foods.Count; i++)
            {
                if (foods[i].name.Equals(item.Text.ToLower()))
                {
                    imageUrl = foods[i].imageUrl;
                }
            }

            DatabasePOST conn2 = new DatabasePOST();

            if (newList == 0)
            {
                Debug.WriteLine(listID + " " + item.Text + " " + imageUrl);
                await conn2.postItem(listID, item.Text, imageUrl);

                //MessagingCenter.Send(this, "newList", await conn.getLists(1));
                await Navigation.PushModalAsync(new ListDetails(listID, name, user));
            }
            else
            {
                Debug.WriteLine(listID + " " + item.Text + " " + imageUrl);
                await conn2.postItem(listID, item.Text, imageUrl);

                //MessagingCenter.Send(this, "newList", await conn.getLists(1));
                await Navigation.PopModalAsync();
            }
        }
Пример #2
0
        async void schedule(Object o, EventArgs e)
        {
            DatabasePOST conn = new DatabasePOST();
            await conn.postMaintenance((scheduledDate.Date).ToString(), CurrentUser.ID, ID);

            await Navigation.PushModalAsync(new EmployeeMain());
        }
Пример #3
0
        async void CreateButtonClicked(object sender, EventArgs args)
        {
            DatabasePOST conn = new DatabasePOST();
            await conn.postUserInfo(userType.Text, firstName.Text, lastName.Text, email.Text, password.Text);

            Navigation.PushModalAsync(new LoginPage(userType.Text));
        }
Пример #4
0
        async void submitClick(object sender, EventArgs e)
        {
            DatabasePOST conn = new DatabasePOST();
            await conn.postMaintenance(CurrentUser.ID, summary.Text, explanation.Text);

            summary.Text     = "";
            explanation.Text = "";
            await DisplayAlert("Success", "Maintenance request submitted", "OK");
        }
Пример #5
0
        async void onTap(object sender, ItemTappedEventArgs e)
        {
            DatabasePOST conn2 = new DatabasePOST();

            var index = (quickview.ItemsSource as List <QuickViewImage>).IndexOf(((ListView)sender).SelectedItem as QuickViewImage);

            System.Diagnostics.Debug.WriteLine(index);

            await conn2.postFavoriteAccommodation(list[index].buildingID, 1);

            ((ListView)sender).SelectedItem = null;
        }
Пример #6
0
        async void boughtClick(object sender, EventArgs e)
        {
            if (bought.Text.Equals(""))
            {
                await DisplayAlert("Error", "Please specify amount you bought for", "Okay");
            }
            else
            {
                //gets residents on the list
                //adds split balance to amount of roommate who clicks button
                //adds notification for user letting them know list is bought
                //deleted list from database, keeps items for suggestion purposes
                DatabaseGET            conn = new DatabaseGET();
                List <ListInformation> list = await conn.getLists(listID);

                List <String> roommateIDs = new List <string>();
                if (list[0].residentID1 != null && !list[0].residentID1.Equals(CurrentUser.ID + ""))
                {
                    roommateIDs.Add(list[0].residentID1);
                }
                if (list[0].residentID2 != null && !list[0].residentID2.Equals(CurrentUser.ID + ""))
                {
                    roommateIDs.Add(list[0].residentID2);
                }
                if (list[0].residentID3 != null && !list[0].residentID3.Equals(CurrentUser.ID + ""))
                {
                    roommateIDs.Add(list[0].residentID3);
                }
                if (list[0].residentID4 != null && !list[0].residentID4.Equals(CurrentUser.ID + ""))
                {
                    roommateIDs.Add(list[0].residentID4);
                }
                String       purchaseAmount = (Convert.ToDouble(amount.Text) / (roommateIDs.Count + 1)).ToString();
                DatabasePOST conn2          = new DatabasePOST();

                await conn2.chargeAllAndNotify(purchaseAmount, CurrentUser.ID + "", roommateIDs, listID, listName.Text);

                //NotificationHandler notifications = new NotificationHandler();
                //notifications.send(amount, "1", roommateIDs, listID, listName.Text);
                await DisplayAlert("Success", "Purchase recorded and roommate(s) notified", "OK");

                await Navigation.PushModalAsync(new Resident());
            }
        }