public void RefreshParent()
        {
            ServiceWrapper svc    = new ServiceWrapper();
            int            userId = Convert.ToInt32(CurrentUser.RetreiveUserId());
            var            myData = svc.GetItemReviewUID(userId).Result;

            if (myData.Reviews.Count == 0)
            {
                TableView.SeparatorColor = UIColor.Clear;
                View.AddSubview(Noreviews);
                View.AddSubview(ImgIns);
            }
            TableView.Source = new MyReviewTableSource(myData.Reviews.ToList(), NavigationController, this);
            TableView.ReloadData();
        }
		public async void updatetoken(CustomerResponse cr)
		{
			try
			{
				if (CurrentUser.GetDeviceToken() != null)
				{
					ServiceWrapper svc = new ServiceWrapper();
					await svc.InsertUpdateToken(CurrentUser.GetDeviceToken(), cr.customer.CustomerID.ToString());
				}
			}
			catch (Exception ex)
			{
				LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
			}
		}
        //Registering for remote notifications
        public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            try
            {
                CurrentUser.app = application;
                CurrentUser.dt  = deviceToken;
                var DeviceToken = deviceToken.Description;
                if (!string.IsNullOrWhiteSpace(DeviceToken))
                {
                    DeviceToken = DeviceToken.Trim('<').Trim('>');
                    CurrentUser.PutDeviceToken(DeviceToken);
                }
                ServiceWrapper svc = new ServiceWrapper();
                await svc.InsertUpdateToken(DeviceToken, CurrentUser.RetreiveUserId().ToString());

                LoggingClass.LogInfo("Device Token " + DeviceToken, screen);

                //CurrentUser.PutDeviceToken(DeviceToken);
                //UIAlertView alert1 = new UIAlertView()
                //{
                //Title = DeviceToken,
                //};
                //alert1.AddButton("OK");
                //alert1.Show();
                var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");

                // Has the token changed?
                if (string.IsNullOrEmpty(oldDeviceToken) || !oldDeviceToken.Equals(DeviceToken))
                {
                    await svc.InsertUpdateToken(DeviceToken, CurrentUser.RetreiveUserId().ToString());

                    //UIAlertView alert = new UIAlertView()
                    //{
                    //	Title = DeviceToken,
                    //};
                    //alert.AddButton("OK");
                    //alert.Show();
                }

                // Save new device token
                NSUserDefaults.StandardUserDefaults.SetString(DeviceToken, "PushDeviceToken");
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message + " User not allowed to send notifications.", screen, ex.StackTrace);
            }
        }
Example #4
0
        public static void DownloadAllImages()
        {
            Task.Factory.StartNew(() =>
            {
                ServiceWrapper svc      = new ServiceWrapper();
                ItemListResponse myData = svc.GetItemLists(1, CurrentUser.RetreiveUserId()).Result;
                foreach (var wine in myData.ItemList)
                {
                    GetImageBitmapFromWineId(wine.Barcode);
                }

                myData = svc.GetItemLists(2, CurrentUser.RetreiveUserId()).Result;

                foreach (var wine in myData.ItemList)
                {
                    GetImageBitmapFromWineId(wine.Barcode);
                }
            });
        }
Example #5
0
 public override void ViewDidLoad()
 {
     try
     {
         LoggingClass.LogInfo("Entered into detail view of " + WineBarcode, screenid);
         BTProgressHUD.Show();
         nfloat              width  = View.Frame.Width;
         ServiceWrapper      svc    = new ServiceWrapper();
         ItemDetailsResponse myData = svc.GetItemDetailsBarcode(WineBarcode, _storeId).Result;
         ItemReviewResponse  rv     = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result;
         TableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
         TableView.AllowsSelection = false;
         TableView.RowHeight       = UITableView.AutomaticDimension;
         TableView.Source          = new SKUDetailTableSource(width, this, NavigationController, myData.ItemDetails, _storeId);
         BTProgressHUD.Dismiss();
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
     }
 }
Example #6
0
        public SKUDetailTableSource(nfloat wid, UIViewController parent, UINavigationController navCtrl, ItemDetails Data, int storeid)
        {
            try
            {
                _store = storeid;
                Width  = wid;
                Parent = parent;
                NavigationController = navCtrl;
                data = Data;

                data.Producer       = Data.Producer;
                data.AverageRating  = Data.AverageRating;               // 4.25m;
                data.WineProperties = new Dictionary <string, string>();
                ServiceWrapper     sw      = new ServiceWrapper();
                ItemReviewResponse ratings = sw.GetItemReviewsByWineID(data.Barcode).Result;
                data.Reviews = ratings.Reviews.ToList();
                //temp = new UITableViewCell[17];
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
        public override void ViewDidLoad()
        {
            //AboutController1.ViewDidLoad(base);

            ServiceWrapper svc = new ServiceWrapper();

            if (FaviouriteView)
            {
                myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
            }
            else
            {
                myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
            }

            //View.BackgroundColor = UIColor.White;
            this.View.BackgroundColor = new UIColor(256, 256, 256, 0.8f);
            //this.View
            //this.CollectionView.BackgroundColor = UIColor.White;
            //this.CollectionView.InsertSubview(new UIImageView(UIImage.FromFile("placeholder.jpeg")), 0);
            //CollectionView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("eno.jpg"));
            CollectionView.RegisterClassForCell(typeof(BottleCell), "BottleCell");
        }
        public APLCollectionViewCell(CGRect frame) : base(frame)
        {
            try
            {
                //BTProgressHUD.Show("Please wait...");
                CGRect box = new CGRect(Bounds.Location, Bounds.Size);
                box.X           = 0;
                box.Y           = 0;
                box.Height      = box.Height - 140;
                BackgroundColor = UIColor.White;

                btnBack = new UIButton();
                btnBack.BackgroundColor        = UIColor.Black;
                btnBack.Frame                  = new CGRect(2, 2, Bounds.Width + 1, box.Height - 139);
                btnBack.UserInteractionEnabled = false;

                ImageView = new UIButton(box);
                ImageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                ImageView.ContentMode      = UIViewContentMode.ScaleAspectFill;
                //ImageView.Layer.BorderWidth = 3.0f;
                ImageView.ClipsToBounds              = true;
                ImageView.Layer.BorderColor          = UIColor.White.CGColor;
                ImageView.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;

                box.Y    = 3;
                btlImage = new UIButton(box);
                btlImage.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                //btlImage.ContentMode = UIViewContentMode.ScaleAspectFill;
                btlImage.ClipsToBounds              = true;
                btlImage.Layer.BorderColor          = UIColor.White.CGColor;
                btlImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;

                //btlImage.TouchDown += (sender, e) =>
                //{
                //		BTProgressHUD.Show("Loading..."); //show spinner + text
                //};

                btlImage.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();
                    NavigationController.PushViewController(new DetailViewController(WineBarcode, storeId, false, false), false);
                    LoggingClass.LogInfo("Clicked on " + WineBarcode + " to enter into Details", screen);
                };

                box.Height = 25;
                box.Width  = 25;
                box.X      = (Bounds.Width - 30);
                box.Y      = 5;
                heartImage = new UIButton(box);
                heartImage.ClipsToBounds              = true;
                heartImage.Layer.BorderColor          = UIColor.White.CGColor;
                heartImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                heartImage.Tag            = 0;
                heartImage.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    //Do some actionn
                    if (CurrentUser.RetreiveUserId() != 0)
                    {
                        UIButton temp = (UIButton)sender;
                        if (temp.Tag == 0)
                        {
                            heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                            temp.Tag      = 1;
                            myItem.IsLike = true;
                            LoggingClass.LogInfo("Liked Wine " + WineBarcode, screen);
                        }
                        else
                        {
                            heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                            temp.Tag      = 0;
                            myItem.IsLike = false;
                            LoggingClass.LogInfo("Unliked Wine " + WineBarcode, screen);
                        }
                        //NavigationController.PushViewController(new DetailViewController(), false);
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.RetreiveUserId());
                        like.BarCode = WineBarcode;
                        like.Liked   = Convert.ToBoolean(temp.Tag);
                        ServiceWrapper sw = new ServiceWrapper();
                        await sw.InsertUpdateLike(like);
                    }
                    else
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        //alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;

                        alert.Show();
                    }
                };

                //for buy button
                box.Height                        = 35;
                box.Width                         = 35;
                box.X                             = (Bounds.Width - 40);
                box.Y                             = 40;
                btnBuy                            = new UIButton(box);
                btnBuy.ClipsToBounds              = true;
                btnBuy.Layer.BorderColor          = UIColor.White.CGColor;
                btnBuy.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                btnBuy.SetImage(UIImage.FromFile("buy.png"), UIControlState.Normal);
                btnBuy.TouchUpInside += delegate {
                    NavigationController.PushViewController(new ExploreViewController("http://www.wineoutlet.com/sku" + Sku + ".html"), false);
                    //UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku"+Sku+".html"));
                };

                CGRect lower = new CGRect(Bounds.Location, Bounds.Size);
                lower.Y     = 50;             //lower.Y + (ratio)*(Bounds.Height);
                btnItemname = new UIButton(lower);
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.Purple, UIControlState.Normal);
                btnItemname.Font           = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode  = UILineBreakMode.WordWrap;
                btnItemname.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();
                    NavigationController.PushViewController(new DetailViewController(WineBarcode, storeId, false, false), false);
                    LoggingClass.LogInfo("Clicked on " + WineBarcode + " to enter into Details", screen);
                };
                lblName               = new UILabel(lower);
                lblName.Font          = UIFont.FromName("Verdana-Bold", 13f);
                lblName.TextColor     = UIColor.Purple;
                lblName.Text          = WineName;
                lblName.TextAlignment = UITextAlignment.Center;
                lblName.LineBreakMode = UILineBreakMode.WordWrap;
                lblName.Lines         = 0;


                lower.Y      = 245;
                lower.Height = 1;
                lower.Width  = lower.Width - 20;
                lower.X      = lower.X + 10;

                Separator = new UIImageView(lower);
                Separator.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                Separator.Image             = UIImage.FromFile("separator.png");
                Separator.ContentMode       = UIViewContentMode.ScaleAspectFill;
                Separator.ClipsToBounds     = true;
                Separator.Layer.BorderColor = UIColor.White.CGColor;
                Separator.BackgroundColor   = UIColor.LightGray;

                CGRect year = new CGRect(Bounds.Location, Bounds.Size);
                year.Y                  = lower.Y - 15;
                year.X                  = year.Width / 2 - 25;
                year.Height             = 30;
                year.Width              = 50;
                lblYear                 = new UILabel(year);
                lblYear.Font            = UIFont.FromName("Verdana", 12f);
                lblYear.Text            = Vintage;
                lblYear.TextAlignment   = UITextAlignment.Center;
                lblYear.BackgroundColor = UIColor.White;


                lblRegPrice      = new UILabel(new CGRect(0, Bounds.Height - 60, Bounds.Width, 12f));
                lblRegPrice.Text = RegPrice;

                lblRegPrice.Font = UIFont.FromName("Verdana", 13f);

                lblRegPrice.TextAlignment = UITextAlignment.Center;

                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));
                //decimal averageRating = 3.25m;

                ratingView = new PDRatingView(new CGRect(Bounds.Width * 1 / 4, Bounds.Height - 40, Bounds.Width / 2, 14f), ratingConfig, averageRating);
                ratingView.UserInteractionEnabled = false;
                //ratingView.BackgroundColor = UIColor.White;
                //Console.WriteLine(Sku);
                //if (Sku != null)
                //{
                //ContentView.AddSubview(btnBuy);
                //}

                AmountLeft = new UITextView(new CGRect(0, Bounds.Height - 30, Bounds.Width, 20));
                AmountLeft.TextAlignment = UITextAlignment.Center;
                AmountLeft.Editable      = false;
                //AmountLeft.ProgressTintColor = UIColor.Blue;
                //AmountLeft.SetProgress(1, true);
                //AmountLeft.Progress = 30f;
                //ContentView.AddSubview(btnBack);
                ContentView.AddSubview(ImageView);
                ContentView.InsertSubviewAbove(btlImage, ImageView);
                ContentView.AddSubview(AmountLeft);
                ContentView.AddSubview(heartImage);
                //ContentView.AddSubview(lblName);
                ContentView.AddSubview(btnItemname);
                ContentView.AddSubview(Separator);
                ContentView.AddSubview(lblYear);
                ContentView.AddSubview(lblRegPrice);
                ContentView.AddSubview(ratingView);
                ContentView.AddSubview(btnBuy);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
Example #9
0
        public MyTastingCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                SelectionStyle = UITableViewCellSelectionStyle.Gray;
                LoggingClass.LogInfo("Entered Into Tasting View", screen);
                imageView = new UIButton();
                imageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                imageView.ContentMode      = UIViewContentMode.Center;
                imageView.ClipsToBounds    = true;

                imageView.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                separator   = new UIImageView();
                btnItemname = new UIButton();
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.FromRGB(127, 51, 0), UIControlState.Normal);
                btnItemname.Font           = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode  = UILineBreakMode.WordWrap;
                btnItemname.TouchUpInside += delegate
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                WineName = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 14f),
                    TextColor       = UIColor.FromRGB(127, 51, 0),
                    BackgroundColor = UIColor.Clear,
                };
                ReviewDate = new UILabel()
                {
                    Font      = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor = UIColor.FromRGB(38, 127, 200),
                    //TextAlignment = UITextAlignment.Center,
                    BackgroundColor = UIColor.Clear
                };
                Vintage = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                location = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                heartImage = new UIButton();
                heartImage.ClipsToBounds              = true;
                heartImage.Layer.BorderColor          = UIColor.White.CGColor;
                heartImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                heartImage.Tag = 0;
                myItem         = new Item();
                bool count = Convert.ToBoolean(myItem.IsLike);
                if (count == true)
                {
                    heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                }
                else
                {
                    heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                }
                heartImage.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    try
                    {
                        //Do some actionn
                        if (CurrentUser.RetreiveUserId() != 0)
                        {
                            UIButton temp = (UIButton)sender;
                            if (temp.Tag == 0)
                            {
                                heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                                temp.Tag      = 1;
                                myItem.IsLike = true;
                                taste.IsLike  = true;
                                LoggingClass.LogInfo("Liked Wine " + WineIdLabel.Text, screen);
                            }
                            else
                            {
                                heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                                temp.Tag      = 0;
                                myItem.IsLike = false;
                                taste.IsLike  = false;
                                LoggingClass.LogInfo("Unliked Wine " + WineIdLabel.Text, screen);
                            }
                            //NavigationController.PushViewController(new DetailViewController(), false);
                            SKULike like = new SKULike();
                            like.UserID   = Convert.ToInt32(CurrentUser.RetreiveUserId());
                            like.BarCode  = WineIdLabel.Text;
                            like.Liked    = Convert.ToBoolean(temp.Tag);
                            myItem.IsLike = Convert.ToBoolean(temp.Tag);
                            ServiceWrapper sw = new ServiceWrapper();
                            await sw.InsertUpdateLike(like);
                        }
                    }
                    catch (Exception ex)
                    {
                        LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
                    }
                };
                WineIdLabel = new UILabel();
                ContentView.AddSubviews(new UIView[] { btnItemname, ReviewDate, imageView, Vintage, separator, heartImage, location });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
Example #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.View.BackgroundColor = new UIColor(0, 0, 0, 0.8f);

            var lblProducer = new UILabel();

            lblProducer.Frame           = new CGRect(4, 180, View.Frame.Width - 8, 30);
            lblProducer.Text            = "My Tasting";
            lblProducer.BackgroundColor = UIColor.Purple;
            lblProducer.TextAlignment   = UITextAlignment.Center;
            this.View.AddSubview(lblProducer);

            //this.View.Alpha = 0.5f;
            UIButton btnClose = new UIButton(new CGRect(9, 185, 20, 20));

            btnClose.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
            this.View.AddSubview(btnClose);

            btnClose.TouchUpInside += (sender, e) =>
            {
                //var viewCtrl = NavController.PopViewController(false);
                //viewCtrl.Dispose();
                //NavController.PopToViewController(parent,false);
                NavController.DismissViewController(true, null);
            };

            UIImageView imgBtl = new UIImageView(new CGRect(View.Frame.Width - 64, 149, 60, 60));

            imgBtl.Image = UIImage.FromFile("wine_review.png");
            //imgBtl.BackgroundColor = UIColor.White;
            this.View.AddSubview(imgBtl);

            var lblWhite = new UILabel();

            lblWhite.Frame           = new CGRect(4, 210, View.Frame.Width - 8, 200);
            lblWhite.BackgroundColor = UIColor.White;
            lblWhite.TextAlignment   = UITextAlignment.Center;
            this.View.AddSubview(lblWhite);

            UIButton btnYes    = new UIButton(new CGRect(14, 340, View.Frame.Width - 28, 20));
            UIButton btnCancel = new UIButton(new CGRect(14, 340, View.Frame.Width - 30, 20));

            //btnSave.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
            btnCancel.SetTitle("Cancel", UIControlState.Normal);
            btnCancel.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            btnCancel.SetTitleColor(UIColor.Purple, UIControlState.Normal);

            btnYes.SetTitle("Delete", UIControlState.Normal);
            btnYes.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            btnYes.SetTitleColor(UIColor.Purple, UIControlState.Normal);

            this.View.AddSubview(btnYes);
            this.View.AddSubview(btnCancel);
            btnCancel.TouchUpInside += (sender, e) =>
            {
                NavController.DismissViewController(true, null);
            };

            btnYes.TouchUpInside += async delegate
            {
                ServiceWrapper sw     = new ServiceWrapper();
                Review         review = new Review();
                review.WineId       = WineId;
                review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                ((IPopupParent)parent).RefreshParent();
                await sw.DeleteReview(review);

                //myDialog.Dismiss();
            };
            //btnDelete.TouchDown += async delegate
            //{

            //	review.WineId = WineId;
            //	review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
            //	await sw.DeleteReview(review);

            //	((IPopupParent)parent).RefreshParent();

            //	NavController.DismissViewController(true, null);
            //Save Service Call.
            //txtComments
            //	BTProgressHUD.ShowSuccessWithStatus("Thank you!!!");
            //};
        }
        public void BindData(APLCollectionViewCell cell, NSIndexPath indexPath, Boolean fav)
        {
            try
            {
                cell.NavigationController = NavigationController;
                //cell.btlImage.SetBackgroundImage(UIImage.FromFile("Wines/wine" + indexPath.Item % 8 + ".png"), UIControlState.Normal);
                cell.parent = this.View;
                //NavigationController.NavigationBar.TopItem.Title = "Locations";

                int index = (int)indexPath.Item;

                //Data from Model
                //cell.WineName = myData.ItemList[index].Name;
                //cell.AmountLeft.SetProgress(Convert.ToSingle(myData.ItemList[index].AvailableVolume),true);
                double l = Math.Floor(Math.Log10(myData.ItemList[index].Vintage) + 1);
                if (l > 4)
                {
                    cell.Vintage = "";
                }
                else
                {
                    cell.Vintage = myData.ItemList[index].Vintage.ToString();
                }
                cell.AmountLeft.Text = "Wine left in bottle: " + myData.ItemList[index].AvailableVolume.ToString() + ".ml";
                cell.RegPrice        = myData.ItemList[index].SalePrice.ToString();
                cell.averageRating   = (decimal)myData.ItemList[index].AverageRating;
                cell.WineBarcode     = myData.ItemList[index].Barcode;
                //cell.btnBuy.TouchUpInside+= delegate {
                //	UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku"+myData.ItemList[index].SKU+".html"));
                //};
                cell.Sku = myData.ItemList[index].SKU;
                if (fav == true)
                {
                    cell.storeId           = myData.ItemList[index].PlantFinal.ToString();
                    cell.AmountLeft.Hidden = true;
                }
                else
                {
                    cell.storeId = storeId.ToString();
                }
                cell.lblName.Text = myData.ItemList[index].Name;
                if (myData.ItemList[index].Vintage.ToString().Length < 4)
                {
                    cell.lblYear.Text = " ";
                }
                else
                {
                    cell.lblYear.Text = myData.ItemList[index].Vintage.ToString();
                }
                cell.lblRegPrice.Text         = myData.ItemList[index].RegPrice.ToString("C", Cultures.UnitedState);
                cell.ratingView.AverageRating = (decimal)myData.ItemList[index].AverageRating;
                cell.myItem = myData.ItemList[index];
                //Boolean temp;
                SKULike        like = new SKULike();
                ServiceWrapper sw   = new ServiceWrapper();
                cell.btnItemname.SetTitle(myData.ItemList[index].Name, UIControlState.Normal);
                if (myData.ItemList[index].IsLike == true)
                {
                    cell.heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                    cell.heartImage.Tag = 1;
                    //cell.heartImage.TouchUpInside +=async delegate
                    //{
                    //	if (CurrentUser.RetreiveUserId() != 0)
                    //	{
                    //		cell.heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    //		like.UserID = Convert.ToInt32(CurrentUser.RetreiveUserId());
                    //		like.BarCode = cell.WineBarcode;
                    //		like.Liked = false;
                    //		await sw.InsertUpdateLike(like);
                    //	}
                    //	else
                    //	{
                    //		UIAlertView alert = new UIAlertView()
                    //		{
                    //			Title = "This feature is allowed only for VIP Card holders",
                    //			//Message = "Coming Soon..."
                    //		};
                    //		alert.AddButton("OK");
                    //		alert.AddButton("Know more");
                    //		alert.Clicked += (senderalert, buttonArgs) =>
                    //		{
                    //			if (buttonArgs.ButtonIndex == 1)
                    //			{
                    //				UIApplication.SharedApplication.OpenUrl(new NSUrl("http://savvyitdev.com/winehangouts/"));
                    //			}
                    //		};
                    //		alert.Show();
                    //	}
                    //};
                }
                else
                {
                    cell.heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    cell.heartImage.Tag = 0;
                    //cell.heartImage.TouchUpInside +=async delegate
                    //{
                    //	if (CurrentUser.RetreiveUserId() != 0)
                    //	{
                    //		cell.heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                    //		like.UserID = Convert.ToInt32(CurrentUser.RetreiveUserId());
                    //		like.BarCode = cell.WineBarcode;
                    //		like.Liked = true;
                    //		await sw.InsertUpdateLike(like);
                    //	}
                    //	else
                    //	{
                    //		UIAlertView alert = new UIAlertView()
                    //		{
                    //			Title = "This feature is allowed only for VIP Card holders",
                    //			//Message = "Coming Soon..."
                    //		};
                    //		alert.AddButton("OK");
                    //		alert.AddButton("Know more");
                    //		alert.Clicked += (senderalert, buttonArgs) =>
                    //		{
                    //			if (buttonArgs.ButtonIndex == 1)
                    //			{
                    //				UIApplication.SharedApplication.OpenUrl(new NSUrl("http://savvyitdev.com/winehangouts/"));
                    //			}
                    //		};
                    //		alert.Show();
                    //	}
                    //};
                }
                //UIImage image = BlobWrapper.GetImageBitmapFromWineId(myData.ItemList[index].WineId.ToString());
                string url = myData.ItemList[index].SmallImageUrl;
                if (url == null)
                {
                    url = myData.ItemList[index].Barcode + ".jpg";
                }
                UIImage image = BlobWrapper.GetResizedImage(url, cell.btlImage.Bounds, cell.storeId.ToString());
                if (image != null)
                {
                    cell.btlImage.SetImage(image, UIControlState.Normal);
                }
                else
                {
                    cell.btlImage.SetImage(img, UIControlState.Normal);
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace.ToString());
                UIAlertView alert = new UIAlertView()
                {
                    Title = "Something went wrong. We are on it."
                            //Message = "Coming Soon..."
                };

                alert.AddButton("OK");
                alert.Show();
            }
        }