Exemplo n.º 1
0
        private void PlaceOrder_Click(object sender, System.EventArgs e)
        {
            mProgressBar.Visibility = ViewStates.Visible;
            if (string.IsNullOrEmpty(mLocationAddressTextView.Text))
            {
                Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                Android.Support.V7.App.AlertDialog         alert  = dialog.Create();
                alert.SetTitle("No Address");
                alert.SetMessage("Address Not Entered");
                alert.SetButton(1, "OK", (c, ev) =>
                {
                    // Ok button click task
                });
            }
            else
            {
                try
                {
                    Order odr = new Order()
                    {
                        Amount  = totAmt,
                        Address = mLocationAddressTextView.Text,
                        Status  = "Confirmed",
                        Uid     = uid
                    };
                    Order ordr  = odr;
                    var   query = db.insertOrder(odr);
                }

                catch (Exception ex)
                {
                    Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
                }
                mProgressBar.Visibility = ViewStates.Invisible;
            }

            Snackbar snackBar = Snackbar.Make(odrBtn, "Your Order is Placed !", Snackbar.LengthIndefinite).SetAction("Ok", (v) =>
            {
                NotifyNotification();
            });

            snackBar.Show();
        }