Esempio n. 1
0
        private void FurAdd_Click(object sender, EventArgs e)
        {
            Furniture furniture = new Furniture()
            {
                id           = nfcText.Text,
                warentyImage = ImageViewToBase64String(warentyImage),
                warentyText  = warentyText.Text,
                specImage    = ImageViewToBase64String(specImage),
                specText     = specText.Text,
                name         = name.Text,
                madeBy       = madeBy.Text
            };

            if (furniture.Correct() && warentyImage.Drawable != warentyDefault && specImage.Drawable != specDefault)
            {
                FireBaseConnector connection = new FireBaseConnector();
                if (connection.checkFurniturePossibility(furniture) == 0)
                {
                    Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                    alertDialog.SetTitle(GetString(Resource.String.furnitureExists));
                    alertDialog.SetIcon(Resource.Drawable.ic4b_192x192);
                    alertDialog.SetMessage(GetString(Resource.String.overwrite));
                    alertDialog.SetPositiveButton(GetString(Resource.String.yes), delegate
                    {
                        if (connection.dataInsert(furniture) == -1)
                        {
                            Toast.MakeText(this, GetString(Resource.String.noInternetConnection), ToastLength.Long).Show();
                        }
                        Toast.MakeText(this, GetString(Resource.String.added), ToastLength.Long).Show();
                    });
                    alertDialog.SetNeutralButton(GetString(Resource.String.no), delegate
                    {
                        alertDialog.Dispose();
                    });
                    alertDialog.Show();
                }
                if (connection.checkFurniturePossibility(furniture) == 1)
                {
                    if (connection.dataInsert(furniture) == -1)
                    {
                        Toast.MakeText(this, GetString(Resource.String.noInternetConnection), ToastLength.Long).Show();
                    }
                    Toast.MakeText(this, GetString(Resource.String.added), ToastLength.Long).Show();
                }
                if (connection.checkFurniturePossibility(furniture) == 1)
                {
                    Toast.MakeText(this, GetString(Resource.String.noInternetConnection), ToastLength.Long).Show();
                }
            }
            else
            {
                Toast.MakeText(this, GetString(Resource.String.addCorrectData), ToastLength.Long).Show();
            }
        }
Esempio n. 2
0
        private async void refresh()
        {
            progressBar.Visibility = ViewStates.Visible;
            await Task.Run(() =>
            {
                FireBaseConnector connector = new FireBaseConnector();
                whishList = connector.GetWhishList(GlobalVars.login);
                if (whishList != null)
                {
                    PromotionListViewAdapter adapter     = new PromotionListViewAdapter(this, whishList);
                    RunOnUiThread(() => listView.Adapter = adapter);
                }
            });

            progressBar.Visibility = ViewStates.Invisible;
        }
Esempio n. 3
0
        private async Task LoginCheck()
        {
            await Task.Run(() => this.RunOnUiThread(() =>
            {
                progressBar.Visibility = ViewStates.Visible;
            }));

            UserLogins login = new UserLogins()
            {
                login        = userLogin.Text,
                userPassword = userPassword.Text
            };
            FireBaseConnector connection = new FireBaseConnector();

            if (login.login.Length > 0 && login.userPassword.Length > 0)
            {
                var res = connection.checkLogin(login);
                await Task.Run(() => this.RunOnUiThread(() =>
                {
                    progressBar.Visibility = ViewStates.Invisible;
                }));

                if (res == 2)
                {
                    Finish();
                    StartActivity(typeof(Admin));
                }
                if (res == 1)
                {
                    GlobalVars.login = userLogin.Text;
                    Intent intent = new Intent(this, typeof(MainActivity));
                    intent.PutExtra("Login", "1");
                    Finish();
                    this.StartActivity(intent);
                }
                if (!connection.connection)
                {
                    Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                    alertDialog.SetTitle(GetString(Resource.String.noInternetConnection));
                    alertDialog.SetIcon(Resource.Drawable.ic5c_192x192);
                    alertDialog.SetMessage(GetString(Resource.String.checkConnection));
                    alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate
                    {
                        alertDialog.Dispose();
                    });
                    alertDialog.Show();
                }
                if (res == 0)
                {
                    Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                    alertDialog.SetTitle(GetString(Resource.String.loginError));
                    alertDialog.SetIcon(Resource.Drawable.ic4c_192x192);
                    alertDialog.SetMessage(GetString(Resource.String.correctLogin));
                    alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate
                    {
                        alertDialog.Dispose();
                    });
                    alertDialog.Show();
                }
            }
            else
            {
                Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(this);
                alertDialog.SetTitle(GetString(Resource.String.loginError));
                alertDialog.SetIcon(Resource.Drawable.ic4c_192x192);
                alertDialog.SetMessage(GetString(Resource.String.emptyLogin));
                alertDialog.SetNeutralButton(GetString(Resource.String.OKbutton), delegate
                {
                    alertDialog.Dispose();
                });
                alertDialog.Show();
            }
            await Task.Run(() => this.RunOnUiThread(() =>
            {
                progressBar.Visibility = ViewStates.Invisible;
            }));
        }