Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.activity_order_status);

            ISharedPreferences pref     = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
            string             userName = pref.GetString("Usermail", String.Empty);

            try
            {
                var query  = db.selectallUser();
                var query1 = query.Where(x => x.Email == userName).FirstOrDefault();
                int usrID  = query1.Uid;
                mOrderObject = new OrderObject(usrID);
            }

            catch (Exception ex)
            {
                Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
            }


            mRecycleView = FindViewById <RecyclerView>(Resource.Id.listOrders);
            mRecycleView.HasFixedSize = true;
            mLayoutManager            = new LinearLayoutManager(this);
            mRecycleView.SetLayoutManager(mLayoutManager);
            mAdapter            = new OrderObjectAdapter(mOrderObject);
            mAdapter.ItemClick += MAdapter_ItemClick;
            mRecycleView.SetAdapter(mAdapter);
        }
Example #2
0
        private void BtnSignUp_Click(object sender, System.EventArgs e)
        {
            btnSignUp.Enabled      = false;
            progressBar.Visibility = ViewStates.Visible;
            if (!Validate())
            {
            }
            else
            {
                try
                {
                    db.createDatabase();                   //Create Database

                    var    data      = db.selectallUser(); //Call Table
                    string fName     = iName.Text.Trim();
                    string fEmail    = iEmail.Text.Trim();
                    string fPassword = iPassword.Text.Trim();
                    var    data1     = data.Where(x => x.Email == fEmail).FirstOrDefault(); //Linq Query
                    if (data1 != null)
                    {
                        Toast.MakeText(Application.Context, "Phone number already registered !", ToastLength.Short).Show();
                    }
                    else
                    {
                        User person = new User()
                        {
                            Name     = fName,
                            Password = fPassword,
                            Email    = fEmail
                        };
                        db.insertUser(person);

                        Toast.MakeText(Application.Context, "Sign Up Successfully !", ToastLength.Short).Show();

                        ISharedPreferences       pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
                        ISharedPreferencesEditor edit = pref.Edit();
                        edit.PutString("Usernam", fName);
                        edit.PutString("Usermail", fEmail);
                        edit.Apply();

                        Intent signin = new Intent(Application.Context, typeof(LoginActivity));
                        this.StartActivity(signin);
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
                }
            }

            progressBar.Visibility = ViewStates.Invisible;
            btnSignUp.Enabled      = true;
        }
Example #3
0
        private void BtnSignIn_Click(object sender, System.EventArgs e)
        {
            btnSignIn.Enabled      = false;
            progressBar.Visibility = ViewStates.Visible;
            if (!Validate())
            {
                Toast.MakeText(Application.Context, "Login Failed", ToastLength.Short).Show();
            }
            else
            {
                try
                {
                    db.createDatabase();                   //Create Database

                    var    data      = db.selectallUser(); //Call Table
                    string fEmail    = iEmail.Text.Trim();
                    string fPassword = iPassword.Text.Trim();
                    var    data1     = data.Where(x => x.Email == fEmail && x.Password == fPassword).FirstOrDefault(); //Linq Query
                    if (data1 != null)
                    {
                        Toast.MakeText(Application.Context, "Login Success", ToastLength.Short).Show();
                        ISharedPreferences       pref = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
                        ISharedPreferencesEditor edit = pref.Edit();
                        edit.PutString("Usernam", data1.Name.Trim());
                        edit.PutString("Usermail", data1.Email.Trim());
                        edit.Apply();

                        Intent home = new Intent(Application.Context, typeof(Home));
                        this.StartActivity(home);
                    }
                    else
                    {
                        Toast.MakeText(Application.Context, "Username or Password invalid", ToastLength.Short).Show();
                    }
                }
                catch (Exception ex)
                {
                    Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
                }
            }

            progressBar.Visibility = ViewStates.Invisible;
            btnSignIn.Enabled      = true;
        }
Example #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            ISharedPreferences pref     = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
            string             userName = pref.GetString("Usermail", String.Empty);

            try
            {
                //string user = Intent.GetStringExtra("usrID").Trim();

                //bool res = int.TryParse(user, out uid);

                //if (string.IsNullOrEmpty(user))
                //{
                var query  = db.selectallUser();
                var query1 = query.Where(x => x.Email == userName).FirstOrDefault();

                uid = query1.Uid;

                //}
            }

            catch (Exception ex)
            {
                Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
            }



            mUserCartObject = new UserCartObject(uid);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_cart);

            mResultReceiver = new AddressResultReceiver(new Handler())
            {
                Activity = this
            };

            mLocationAddressTextView = FindViewById <EditText>(Resource.Id.mLocationAddressTextView);
            mProgressBar             = FindViewById <ProgressBar>(Resource.Id.mProgressBar);
            crtAmt = FindViewById <TextView>(Resource.Id.cAmount);
            odrBtn = FindViewById <Button>(Resource.Id.btnPlaceOrder);
            mFetchAddressButton        = FindViewById <ImageButton>(Resource.Id.mFetchAddressButton);
            mFetchAddressButton.Click += FetchAddressButtonHandler;

            mAddressRequested = false;
            mAddressOutput    = string.Empty;
            UpdateValuesFromBundle(savedInstanceState);

            mFusedLocationClient = LocationServices.GetFusedLocationProviderClient(this);

            UpdateUiWidgets();

            tcost          = FindViewById <TextView>(Resource.Id.total);
            mRecycleView   = FindViewById <RecyclerView>(Resource.Id.listCart);
            mLayoutManager = new LinearLayoutManager(this);
            mRecycleView.SetLayoutManager(mLayoutManager);
            mAdapter = new UserCartObjectAdapter(mUserCartObject);

            int tot = 0;

            for (int i = 0; i < mUserCartObject.numPhoto; i++)
            {
                tot += mUserCartObject[i].mPrice;
            }
            crtAmt.Text         = tot.ToString();
            totAmt              = (tot * 113 / 100);
            tcost.Text          = totAmt.ToString();
            totAmt              = (float)(System.Math.Truncate((double)totAmt * 100.0) / 100.0);
            mAdapter.ItemClick += MAdapter_ItemClick;
            mRecycleView.SetAdapter(mAdapter);

            odrBtn.Click += PlaceOrder_Click;

            CreateNotificationChannel();
        }
Example #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_food_detail);
            food_name               = FindViewById <TextView>(Resource.Id.food_name);
            food_price              = FindViewById <TextView>(Resource.Id.food_price);
            food_description        = FindViewById <TextView>(Resource.Id.food_description);
            food_image              = FindViewById <ImageView>(Resource.Id.img_food);
            collapsingToolbarLayout = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing);
            btnCart      = FindViewById <FloatingActionButton>(Resource.Id.btnCart);
            numberButton = FindViewById <Button>(Resource.Id.number_button);
            Food_name    = Intent.GetStringExtra("foodName").Trim();
            collapsingToolbarLayout.SetExpandedTitleTextAppearance(Resource.Style.ExpandedAppbar);
            collapsingToolbarLayout.SetExpandedTitleTextAppearance(Resource.Style.CollapsedAppbar);


            int  foodid;
            bool res   = int.TryParse(Food_name, out foodid);
            var  data  = db.selectallFood();                                 //Call Table
            var  data1 = data.Where(x => x.mFid == foodid).FirstOrDefault(); //Linq Query

            food_name.Text        = data1.mCaption;
            food_price.Text       = data1.mPrice.ToString();
            food_description.Text = data1.mDescription;
            food_image.SetImageResource(data1.mPhotoID);

            //Cart button
            btnCart.Click += delegate
            {
                ISharedPreferences pref     = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
                string             userName = pref.GetString("Usermail", String.Empty);
                try
                {
                    var    query      = db.selectallUser();
                    var    query1     = query.Where(x => x.Email == userName).FirstOrDefault();
                    Intent cartIntent = new Intent(this, typeof(Cart));
                    cartIntent.PutExtra("usrID", query1.Uid.ToString());
                    this.StartActivity(cartIntent);
                }

                catch (Exception ex)
                {
                    Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
                }
            };

            // Add item button
            numberButton.Click += delegate
            {
                ISharedPreferences pref     = Application.Context.GetSharedPreferences("UserInfo", FileCreationMode.Private);
                string             userName = pref.GetString("Usermail", String.Empty);
                try
                {
                    var query  = db.selectallUser();
                    var query1 = query.Where(x => x.Email == userName).FirstOrDefault();

                    UserCart cart = new UserCart()
                    {
                        fdID  = foodid,
                        usrID = query1.Uid
                    };
                    db.insertUserCart(cart);
                    Toast.MakeText(Application.Context, data1.mCaption + " added to cart!", ToastLength.Short).Show();
                }
                catch (Exception ex)
                {
                    Toast.MakeText(Application.Context, ex.ToString(), ToastLength.Short).Show();
                }
            };
        }