async void Submit_Clicked(object sender, System.EventArgs e) { //string totalCount = Int32.Parse(TextBoxD1.Text); QuantityEntry.Text try { if (AssetEntry.Text == null && AddQuantity.Text == null) { await DisplayAlert("Error", "Please fill in missing fields.", "OK"); } else if (AssetEntry.Text == null) { await DisplayAlert("Error", "Please Fill in asset ID/barcode.", "OK"); } else if (AddQuantity.Text == null) { await DisplayAlert("Error", "Please fill in quantity.", "OK"); //LocationEntry.IsVisible = false; //statusFrameEntry.IsVisible = true; } else { DateTime now = DateTime.Now.ToLocalTime(); Dictionary <string, string> dict = new Dictionary <string, string>(); dict["asset"] = AssetEntry.Text; dict["amount"] = AddQuantity.Text; dict["time"] = now.ToString(); var isSuccess = false; if (addOrsub.Text == "+") { isSuccess = await cloudStore.AddAsset(dict); if (isSuccess) { await DisplayAlert("Success", "Asset added successfully.", "Ok"); App.Current.MainPage = new MainViewAssetPage(); //AssetEntry.Text = string.Empty; //LocationEntry.Text = string.Empty; } else { await DisplayAlert("Error", "Add failed. Please try again.", "Ok"); } } else { isSuccess = await cloudStore.SubtractAsset(dict); if (isSuccess) { await DisplayAlert("Success", "Asset subtracted successfully.", "Ok"); App.Current.MainPage = new MainViewAssetPage(); //AssetEntry.Text = string.Empty; //LocationEntry.Text = string.Empty; } else { await DisplayAlert("Error", "Subtract failed. Please try again.", "Ok"); } } } } catch (Exception ex) { } }