예제 #1
0
        public void CreatePopup(object sender, RatingBar.RatingBarChangeEventArgs e)
        {
            //e.Rating

            Dialog editDialog = new Dialog(Parent);
            var    rat        = e.Rating;

            //editDialog.Window.RequestFeature(WindowFeatures.NoTitle);
            //editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.White));// (Android.Graphics.Color.Transparent));
            editDialog.SetContentView(Resource.Layout.EditReviewPopup);
            //editDialog.SetTitle();
            ServiceWrapper sw              = new ServiceWrapper();
            Review         review          = new Review();
            ImageButton    ibs             = editDialog.FindViewById <ImageButton>(Resource.Id.ratingimage);
            ImageButton    close           = editDialog.FindViewById <ImageButton>(Resource.Id.close);
            Button         btnSubmitReview = editDialog.FindViewById <Button>(Resource.Id.btnSubmitReview);
            TextView       Comments        = editDialog.FindViewById <TextView>(Resource.Id.txtReviewComments);
            RatingBar      custRating      = editDialog.FindViewById <RatingBar>(Resource.Id.rating);

            custRating.Rating = rat;


            ibs.SetImageResource(Resource.Drawable.wine_review);
            ibs.SetScaleType(ImageView.ScaleType.CenterCrop);
            //close.SetImageResource(Resource.Drawable.Close);
            close.SetScaleType(ImageView.ScaleType.CenterCrop);
            editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));
            editDialog.Show();
            close.Click += delegate
            {
                editDialog.Dismiss();
            };
            btnSubmitReview.Click += async delegate
            {
                review.ReviewDate   = DateTime.Now;
                review.ReviewUserId = Convert.ToInt32(CurrentUser.getUserId());
                review.Username     = CurrentUser.getUserName();
                review.RatingText   = Comments.Text;
                review.RatingStars  = Convert.ToInt32(custRating.Rating);
                review.IsActive     = true;

                review.WineId = WineId;
                await sw.InsertUpdateReview(review);

                ((IPopupParent)Parent).RefreshParent();
                editDialog.Dismiss();
            };
        }
예제 #2
0
        public void CreatePopup(object sender, RatingBar.RatingBarChangeEventArgs e)
        {
            try
            {
                Dialog editDialog = new Dialog(Parent);
                var    rat        = e.Rating;
                //editDialog.Window.RequestFeature(WindowFeatures.NoTitle);
                //editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.White));// (Android.Graphics.Color.Transparent));
                editDialog.SetContentView(Resource.Layout.EditReviewPopup);
                //editDialog.SetTitle();
                ServiceWrapper sw              = new ServiceWrapper();
                Review         review          = new Review();
                ImageButton    close           = editDialog.FindViewById <ImageButton>(Resource.Id.close);
                Button         btnSubmitReview = editDialog.FindViewById <Button>(Resource.Id.btnSubmitReview);
                TextView       Comments        = editDialog.FindViewById <TextView>(Resource.Id.txtReviewComments);
                RatingBar      custRating      = editDialog.FindViewById <RatingBar>(Resource.Id.rating);
                custRating.Rating = rat;
                Comments.Text     = _editObj.RatingText;
                int screenid = 9;
                //ImageButton ibs = editDialog.FindViewById<ImageButton>(Resource.Id.ratingimage);
                //ItemReviewResponse SkuRating = new ItemReviewResponse();
                //SkuRating = sw.GetItemReviewsByWineID(WineId).Result;
                //ReviewArray = SkuRating.Reviews.ToList();
                //for (int i = 0; i < ReviewArray.Count(); i++)
                //{
                //    if (Convert.ToInt32(CurrentUser.getUserId()) == ReviewArray[i].ReviewUserId)
                //    {
                //        ItemReviewResponse uidreviews = new ItemReviewResponse();
                //        uidreviews = sw.GetItemReviewUID(Convert.ToInt32(CurrentUser.getUserId())).Result;
                //        List<Review> myArr1;
                //        myArr1 = uidreviews.Reviews.ToList();
                //        for (int j = 0; j < myArr1.Count; j++)
                //        {
                //            if (ReviewArray[i].Name == myArr1[i].Name)
                //                Comments.Text = myArr1[i].RatingText.ToString();
                //        }
                //    }
                //    else
                //    {
                //        CreatePopup(sender, e);
                //    }
                //}



                //ibs.SetImageResource(Resource.Drawable.wine_review);
                //ibs.SetScaleType(ImageView.ScaleType.CenterCrop);
                //close.SetImageResource(Resource.Drawable.Close);
                close.SetScaleType(ImageView.ScaleType.CenterCrop);
                editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));
                editDialog.Show();
                LoggingClass.LogInfo("Entered into CreatePopup", screenid);
                close.Click += delegate
                {
                    LoggingClass.LogInfo("Closed PoPup", screenid);
                    editDialog.Dismiss();
                };
                btnSubmitReview.Click += async delegate
                {
                    AndHUD.Shared.Show(Parent, "Saving Review...", Convert.ToInt32(MaskType.Clear));
                    if (CurrentUser.getUserId() == null)
                    {
                        AlertDialog.Builder aler = new AlertDialog.Builder(Parent, Resource.Style.MyDialogTheme);
                        aler.SetTitle("Sorry");
                        aler.SetMessage("This Feature is available for VIP Users only");
                        aler.SetNegativeButton("Ok", delegate {
                            LoggingClass.LogInfo("Closed PoPup", screenid);
                            editDialog.Dismiss();
                        });
                        Dialog dialog1 = aler.Create();
                        dialog1.Show();
                    }
                    else
                    {
                        //ProgressIndicator.Show(Parent);
                        review.ReviewDate   = DateTime.Now;
                        review.ReviewUserId = Convert.ToInt32(CurrentUser.getUserId());
                        review.Username     = CurrentUser.getUserName();
                        review.RatingText   = Comments.Text;
                        review.RatingStars  = Convert.ToInt32(custRating.Rating);
                        review.IsActive     = true;
                        review.Barcode      = WineBarcode;
                        review.PlantFinal   = storeid;
                        LoggingClass.LogInfo("Submitted review---->" + review.RatingStars + " ---->" + review.RatingText + "---->" + review.PlantFinal + "---->" + review.Barcode, screenid);
                        await sw.InsertUpdateReview(review);

                        ((IPopupParent)Parent).RefreshParent();
                        //ProgressIndicator.Hide();
                        editDialog.Dismiss();
                    }
                    AndHUD.Shared.Dismiss();
                    AndHUD.Shared.ShowSuccess(Parent, "Sucessfully Saved", MaskType.Clear, TimeSpan.FromSeconds(2));
                };
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, ParentScreenId, exe.StackTrace.ToString());
            }

            //LoggingClass.LogTime("create popup",st.Elapsed.TotalSeconds.ToString());
        }
예제 #3
0
        public void CreatePopup(object sender, RatingBar.RatingBarChangeEventArgs e)
        {
            if (CurrentUser.getUserId() == null || CurrentUser.getUserId() == "0")
            {
                AlertDialog.Builder aler = new AlertDialog.Builder(Parent, Resource.Style.MyDialogTheme);
                aler.SetTitle("Sorry");
                aler.SetMessage("This Feature is available for VIP Users only");
                aler.SetNegativeButton("Ok", delegate {
                });
                Dialog dialog1 = aler.Create();
                dialog1.Show();
            }
            else
            {
                try
                {
                    Dialog editDialog = new Dialog(Parent);
                    var    rat        = e.Rating;
                    editDialog.SetContentView(Resource.Layout.EditReviewPopup);
                    ServiceWrapper sw              = new ServiceWrapper();
                    Review         review          = new Review();
                    ImageButton    close           = editDialog.FindViewById <ImageButton>(Resource.Id.close);
                    Button         btnSubmitReview = editDialog.FindViewById <Button>(Resource.Id.btnSubmitReview);
                    TextView       Comments        = editDialog.FindViewById <TextView>(Resource.Id.txtReviewComments);
                    RatingBar      custRating      = editDialog.FindViewById <RatingBar>(Resource.Id.rating);
                    custRating.Rating = rat;
                    Comments.Text     = _editObj.RatingText;
                    int screenid = 9;
                    close.SetScaleType(ImageView.ScaleType.CenterCrop);
                    editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));
                    editDialog.Show();
                    editDialog.SetCanceledOnTouchOutside(false);
                    LoggingClass.LogInfo("Entered into CreatePopup", screenid);

                    close.Click += delegate
                    {
                        LoggingClass.LogInfo("Closed PoPup", screenid);
                        editDialog.Dismiss();
                    };
                    btnSubmitReview.Click += async delegate
                    {
                        AndHUD.Shared.Show(Parent, "Saving Review...", Convert.ToInt32(MaskType.Clear));
                        //  ProgressIndicator.Show(Parent);
                        review.ReviewDate   = DateTime.Now;
                        review.ReviewUserId = Convert.ToInt32(CurrentUser.getUserId());
                        review.Username     = CurrentUser.getUserName();
                        review.RatingText   = Comments.Text;
                        review.RatingStars  = Convert.ToInt32(custRating.Rating);
                        review.IsActive     = true;
                        review.Barcode      = WineBarcode;
                        review.PlantFinal   = storeid;
                        LoggingClass.LogInfo("Submitted review---->" + review.RatingStars + " ---->" + review.RatingText + "---->" + review.PlantFinal + "---->" + review.Barcode, screenid);
                        await sw.InsertUpdateReview(review);

                        ((IPopupParent)Parent).RefreshParent();
                        ProgressIndicator.Hide();
                        editDialog.Dismiss();
                        AndHUD.Shared.Dismiss();
                        AndHUD.Shared.ShowSuccess(Parent, "Sucessfully Saved", MaskType.Clear, TimeSpan.FromSeconds(2));
                    };
                }
                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, ParentScreenId, exe.StackTrace.ToString());
                }
            }
        }
예제 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.login);
            MobileCenter.Start("{Analytics,Crashes,Distribute}", typeof(Analytics), typeof(Crashes), typeof(Distribute));

            Button login = FindViewById <Button>(Resource.Id.btnLoginLL);

            EditText username      = FindViewById <EditText>(Resource.Id.txtUsername);
            EditText txtUserNumber = FindViewById <EditText>(Resource.Id.MobileNumber);

            ServiceWrapper svc = new ServiceWrapper();
            //new Thread(new ThreadStart(delegate
            //{
            //    RunOnUiThread(() => bvb.DownloadImages(Convert.ToInt32(CurrentUser.getUserId())));
            //})).Start();

            //bvb.DownloadImages(Convert.ToInt32(CurrentUser.getUserId()));
            var TaskA = new Task(() => {
                BlobWrapper.DownloadImages(Convert.ToInt32(CurrentUser.getUserId()));
            });

            TaskA.Start();


            if (CurrentUser.getUserName() == null ||
                CurrentUser.getUserName() == "")
            {
                // Do nothing
            }
            else
            {
                Intent intent = new Intent(this, typeof(TabActivity));
                StartActivity(intent);
            }



            login.Click += delegate
            {
                //1. Call Auth service and check for this user, it returns one.
                //2. If it returns 1 save Username and go to Tab Activity.
                //3. Else Show message, incorrect username.
                //
                if (username.Text == "") //|| txtUserNumber.Text == "")
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this);
                    aler.SetTitle("Sorry");
                    aler.SetMessage("Enter proper details");
                    aler.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = aler.Create();
                    dialog.Show();
                    return;
                }
                else
                {
                    CustomerResponse authen = new CustomerResponse();
                    try
                    {
                        authen = svc.AuthencateUser(username.Text).Result;
                        if (authen.customer != null && authen.customer.CustomerID != 0)
                        {
                            CurrentUser.SaveUserName(username.Text, authen.customer.CustomerID.ToString());
                            Intent intent = new Intent(this, typeof(TabActivity));
                            StartActivity(intent);
                        }
                        else
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("You entered wrong ");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog1 = aler.Create();
                            dialog1.Show();
                        };
                    }
                    catch (Exception exception)
                    {
                        if (exception.Message.ToString() == "One or more errors occurred.")
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("Please check your internet connection");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog2 = aler.Create();
                            dialog2.Show();
                        }
                        else
                        {
                            AlertDialog.Builder aler = new AlertDialog.Builder(this);
                            aler.SetTitle("Sorry");
                            aler.SetMessage("We're under maintanence");
                            aler.SetNegativeButton("Ok", delegate { });
                            Dialog dialog3 = aler.Create();
                            dialog3.Show();
                        }
                    }
                    MobileCenter.Start("4403e7d2-95d8-414e-9390-6c1dbd241c21",
                                       typeof(Analytics), typeof(Crashes));

                    //SendSmsgs(txtUserNumber.Text);
                    //var intent = new Intent(this, typeof(VerificationActivity));
                    ////var intent = new Intent(this, typeof(TabActivity));
                    //intent.PutExtra("otp", otp);
                    //intent.PutExtra("username", username.Text);
                    //StartActivity(intent);
                }
                //CustomerResponse authen = new CustomerResponse();
                //try
                //{
                //    authen = svc.AuthencateUser(username.Text).Result;
                //    if (authen.customer != null && authen.customer.CustomerID != 0)
                //    {
                //        CurrentUser.SaveUserName(username.Text, authen.customer.CustomerID.ToString());
                //        Intent intent = new Intent(this, typeof(TabActivity));
                //        StartActivity(intent);

                //    }
                //    else
                //    {
                //        AlertDialog.Builder aler = new AlertDialog.Builder(this);
                //        aler.SetTitle("Sorry");
                //        aler.SetMessage("Incorrect Details");
                //        aler.SetNegativeButton("Ok", delegate { });
                //        Dialog dialog = aler.Create();
                //        dialog.Show();
                //    };
                //}
                //catch(Exception exception)
                //{
                //    if (exception.Message.ToString() == "One or more errors occurred.")
                //    {
                //        AlertDialog.Builder aler = new AlertDialog.Builder(this);
                //        aler.SetTitle("Sorry");
                //        aler.SetMessage("Please check your internet connection");
                //        aler.SetNegativeButton("Ok", delegate { });
                //        Dialog dialog = aler.Create();
                //        dialog.Show();
                //    }
                //    else {
                //        AlertDialog.Builder aler = new AlertDialog.Builder(this);
                //        aler.SetTitle("Sorry");
                //        aler.SetMessage("We're under maintanence");
                //        aler.SetNegativeButton("Ok", delegate { });
                //        Dialog dialog = aler.Create();
                //        dialog.Show();

                //    }

                //}
            };
        }
예제 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CheckInternetConnection();
            Stopwatch st = new Stopwatch();

            st.Start();
            //for direct login
            //CurrentUser.SaveUserName("Mohana Android","48732");
            //Preinfo("8902519310330");
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.login);
            var TaskA = new System.Threading.Tasks.Task(() =>
            {
                BlobWrapper.DownloadImages(Convert.ToInt32(CurrentUser.getUserId()));
            });

            TaskA.Start();
            ImageButton BtnScanner    = FindViewById <ImageButton>(Resource.Id.btnScanner);
            Button      BtnGuestLogin = FindViewById <Button>(Resource.Id.btnGuestLogin);

            LoggingClass.LogInfo("Opened the app", screenid);

            BtnScanner.Click += async delegate
            {
                try
                {
                    MobileBarcodeScanner.Initialize(Application);
                    var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                    scanner.UseCustomOverlay = false;
                    var result = await scanner.Scan();//"8902519310330";//await scanner.Scan();

                    if (result.Text != null)
                    {
                        LoggingClass.LogInfo("User Tried to login with " + result, screenid);
                        Preinfo(result.Text);
                        CurrentUser.SaveCardNumber(result.Text);
                    }
                }
                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                }
                BtnScanner.Click -= null;
            };

            BtnGuestLogin.Click += async delegate
            {
                //await svc.InsertUpdateGuest(CurrentUser.getAuthToken());
                CurrentUser.SaveUserName("Guest", "0");


                Intent intent = new Intent(this, typeof(TabActivity));
                ProgressIndicator.Show(this);
                LoggingClass.LogInfo("User Tried to login with Guest Login ", screenid);
                StartActivity(intent);
                await svc.InsertUpdateGuest("Didn't get the token");
            };
            TxtScanresult             = FindViewById <TextView>(Resource.Id.txtScanresult);
            BtnLogin                  = FindViewById <Button>(Resource.Id.btnLogin);
            BtnResend                 = FindViewById <Button>(Resource.Id.btnResend);
            BtnContinue               = FindViewById <Button>(Resource.Id.btnContinue);
            BtnUpdateEmail            = FindViewById <Button>(Resource.Id.btnUpdateEmail);
            BtnResend.Visibility      = ViewStates.Invisible;
            BtnLogin.Visibility       = ViewStates.Invisible;
            BtnContinue.Visibility    = ViewStates.Invisible;
            BtnUpdateEmail.Visibility = ViewStates.Invisible;
            if (IsPlayServicesAvailable())
            {
                var TaskB = new System.Threading.Tasks.Task(() =>
                {
                    var intent = new Intent(this, typeof(RegistrationIntentService));
                    StartService(intent);
                });
                TaskB.Start();
            }
            if (CurrentUser.getUserName() == null ||
                CurrentUser.getUserName() == "")
            {
                SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                if (CurrentUser.GetCardNumber() != null)
                {
                    Preinfo(CurrentUser.GetCardNumber());
                }
            }
            else if (CurrentUser.GetGuestId() != null || CurrentUser.getUserId() == "0")
            {
                Intent intent = new Intent(this, typeof(TabActivity));
                ProgressIndicator.Show(this);
                LoggingClass.LogInfo("User Tried to login with Guest Login ", screenid);
                StartActivity(intent);
            }
            else
            {
                int storename = Convert.ToInt32(CurrentUser.GetPrefered());
                if (storename == 1)
                {
                    Intent intent = new Intent(this, typeof(GridViewActivity));
                    intent.PutExtra("MyData", "Wall Store");
                    ProgressIndicator.Show(this);
                    StartActivity(intent);
                }
                else if (storename == 2)
                {
                    Intent intent = new Intent(this, typeof(GridViewActivity));
                    intent.PutExtra("MyData", "Point Pleasant Store");
                    ProgressIndicator.Show(this);
                    StartActivity(intent);
                }
                else
                {
                    Intent intent = new Intent(this, typeof(TabActivity));
                    ProgressIndicator.Show(this);
                    StartActivity(intent);
                }
            }
            var telephonyDeviceID             = string.Empty;
            var telephonySIMSerialNumber      = string.Empty;
            TelephonyManager telephonyManager = (TelephonyManager)this.ApplicationContext.GetSystemService(Context.TelephonyService);

            if (telephonyManager != null)
            {
                if (!string.IsNullOrEmpty(telephonyManager.DeviceId))
                {
                    telephonyDeviceID = telephonyManager.DeviceId;
                }
                if (!string.IsNullOrEmpty(telephonyManager.SimSerialNumber))
                {
                    telephonySIMSerialNumber = telephonyManager.SimSerialNumber;
                }
            }
            var androidID  = Android.Provider.Settings.Secure.GetString(this.ApplicationContext.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
            var deviceUuid = new UUID(androidID.GetHashCode(), ((long)telephonyDeviceID.GetHashCode() << 32) | telephonySIMSerialNumber.GetHashCode());
            var DeviceID   = deviceUuid.ToString();

            CurrentUser.SaveDeviceID(DeviceID);
        }