Пример #1
0
        public void EditPopup(object sender, EventArgs e)
        {
            try
            {
                Dialog editDialog = new Dialog(Parent);
                int    screenid   = 18;
                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);
                Comments.Text     = _editObj.RatingText;
                custRating.Rating = _editObj.RatingStars;
                LoggingClass.LogInfo("Entered into EditPopup", screenid);
                close.SetScaleType(ImageView.ScaleType.CenterCrop);
                editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));
                editDialog.Show();
                editDialog.SetCanceledOnTouchOutside(false);

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

                        LoggingClass.LogInfo("Edited Review-----> " + review.RatingText + "-----> " + review.RatingStars + "----->" + review.Barcode + "----->" + review.PlantFinal + "submitted", screenid);
                    }

                    catch (Exception exe)
                    {
                        LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                    }
                    ((IPopupParent)Parent).RefreshParent();
                    AndHUD.Shared.Dismiss();
                    AndHUD.Shared.ShowSuccess(Parent, "Sucessfully Saved", MaskType.Clear, TimeSpan.FromSeconds(2));
                    editDialog.Dismiss();
                };
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, ParentScreenId, exe.StackTrace.ToString());
            }
        }
Пример #2
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();
            };
        }
Пример #3
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());
        }
Пример #4
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());
                }
            }
        }
Пример #5
0
        public void EditPopup(object sender, EventArgs e)
        {
            Dialog editDialog = new Dialog(Parent);

            //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);


            Comments.Text     = _editObj.RatingText;
            custRating.Rating = _editObj.RatingStars;

            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.RatingText   = Comments.Text;
                review.RatingStars  = Convert.ToInt32(custRating.Rating);
                review.IsActive     = true;
                review.WineId       = WineId;
                try
                {
                    await sw.InsertUpdateReview(review);
                }
                catch (Exception exe)
                {
                    //string msg=exe.Message.ToString();
                    //if (msg == "An error occurred while sending the request")
                    //{
                    //    Android.Content.Context x;
                    //    AlertDialog.Builder alert = new AlertDialog.Builder(x);
                    //    alert.SetTitle("Sorry");
                    //    alert.SetMessage("We're under maintainence");
                    //    alert.SetNegativeButton("Ok", delegate { });
                    //    Dialog dialog = alert.Create();
                    //    dialog.Show();
                    //}
                }
                ((IPopupParent)Parent).RefreshParent();
                editDialog.Dismiss();
            };
        }