Ejemplo n.º 1
0
 public void RefreshParent()
 {
     ServiceWrapper svc         = new ServiceWrapper();
     int            userId      = Convert.ToInt32(CurrentUser.getUserId());
     var            output      = svc.GetCustomerDetails(userId).Result;
     Bitmap         imageBitmap = BlobWrapper.ProfileImages(userId);
 }
Ejemplo n.º 2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.CommentsCell, null, false);
            }
            TextView  Name     = row.FindViewById <TextView>(Resource.Id.textView64);
            TextView  Comments = row.FindViewById <TextView>(Resource.Id.textView66);
            TextView  date     = row.FindViewById <TextView>(Resource.Id.textView67);
            RatingBar rb       = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);
            ImageView Image    = row.FindViewById <ImageView>(Resource.Id.imageButton2);

            Bitmap imageBitmap = BlobWrapper.ProfileImages(myItems[position].ReviewUserId);

            if (imageBitmap == null)
            {
                Image.SetImageResource(Resource.Drawable.user1);
            }
            else
            {
                Image.SetImageBitmap(imageBitmap);
            }
            //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            //string path = pppd.CreateDirectoryForPictures();
            ////string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            ////It's taking lot of time to load user images so giving wine id, after completing compressing image we will give reviewuserid
            //var filePath = System.IO.Path.Combine(path + "/" + myItems[position].ReviewUserId + ".jpg");
            //if (System.IO.File.Exists(filePath))
            //{
            //    imageBitmap = BitmapFactory.DecodeFile(filePath);
            //    Image.SetImageBitmap(imageBitmap);
            //}
            //else
            //{
            //    //It's taking lot of time to load user images so giving wine id, after completing compressing image we will give reviewuserid
            //    imageBitmap = BlobWrapper.ProfileImages(myItems[position].ReviewUserId);
            //    if(imageBitmap==null)
            //    {
            //        Image.SetImageResource(Resource.Drawable.user1);
            //    }
            //    else
            //    {
            //    Image.SetImageBitmap(imageBitmap);
            //    }
            //}
            Name.Text      = myItems[position].Username;
            Name.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
            Comments.Text  = myItems[position].RatingText;
            date.Text      = myItems[position].Date.ToString("dd/MM/yyyy");
            rb.Rating      = myItems[position].RatingStars;
            //Image.SetImageBitmap(imageBitmap);
            Image.SetScaleType(ImageView.ScaleType.CenterCrop);
            return(row);
        }
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyFavorite, null, false);
            }
            //else
            //	return row;

            TextView txtName = row.FindViewById <TextView>(Resource.Id.txtName);

            TextView txtVintage = row.FindViewById <TextView>(Resource.Id.txtVintage);

            TextView  txtPrice = row.FindViewById <TextView>(Resource.Id.txtPrice);
            ImageView imgWine  = row.FindViewById <ImageView>(Resource.Id.imgWine);

            ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imgHeart);
            RatingBar rating   = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);

            rating.Rating = (float)myItems[position].AverageRating;
            txtName.Text  = myItems[position].Name;
            txtPrice.Text = myItems[position].SalePrice.ToString("C", Cultures.UnitedState);

            txtVintage.Text = myItems[position].Vintage.ToString();
            if (txtVintage.Text == "0" || txtVintage.Text == null)
            {
                txtVintage.Text = "";
            }
            else
            {
                txtVintage.Text = myItems[position].Vintage.ToString();
            }
            heartImg.SetImageResource(Resource.Drawable.heart_empty);
            //var heartLP = new FrameLayout.LayoutParams(80, 80);
            //var metrics = myContext.Resources.DisplayMetrics;
            //var widthInDp = ConvertPixelsToDp(metrics.WidthPixels);
            //var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);
            //heartLP.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 110; // 110 = 80 + 30

            //heartLP.TopMargin = 5;
            //heartImg.LayoutParameters = heartLP;
            //heartImg.Layout(50, 50, 50, 50);
            bool count = Convert.ToBoolean(myItems[position].IsLike);

            if (count == true)
            {
                heartImg.SetImageResource(Resource.Drawable.heart_full);
            }
            else
            {
                heartImg.SetImageResource(Resource.Drawable.heart_empty);
            }

            heartImg.Tag = position;

            if (convertView == null)
            {
                heartImg.Click += async delegate
                {
                    int  actualPosition = Convert.ToInt32(heartImg.Tag);
                    bool x;
                    if (count == false)
                    {
                        heartImg.SetImageResource(Resource.Drawable.heart_full);

                        x     = true;
                        count = true;
                    }
                    else
                    {
                        heartImg.SetImageResource(Resource.Drawable.heart_empty);

                        x     = false;
                        count = false;
                    }
                    SKULike like = new SKULike();
                    like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                    like.SKU    = Convert.ToInt32(myItems[actualPosition].SKU);
                    like.Liked  = x;
                    myItems[actualPosition].IsLike = x;
                    like.BarCode = myItems[actualPosition].Barcode;
                    ServiceWrapper sw = new ServiceWrapper();
                    await sw.InsertUpdateLike(like);
                };
            }
            Bitmap imageBitmap;
            string url = myItems[position].SmallImageUrl;

            if (url == null)
            {
                url = myItems[position].Barcode + ".jpg";
            }

            imageBitmap = BlobWrapper.Bottleimages(url, storeid);
            //var place = new FrameLayout.LayoutParams(650, 650);

            ////-650 + (parent.Resources.DisplayMetrics.WidthPixels - imageBitmap.Width) / 2;
            //imgWine.LayoutParameters = place;
            //if (imageBitmap != null)
            //{
            //	if (heartLP.LeftMargin <= 250)
            //	{
            //		place.LeftMargin = -140;
            //		float ratio = (float)500 / imageBitmap.Height;
            //		imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 550, true);
            //	}
            //	else
            //	{
            //		place.LeftMargin = -70;
            //		float ratio = (float)650 / imageBitmap.Height;
            //		imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 650, true);
            //	}


            //	imgWine.SetImageBitmap(imageBitmap);


            //}
            //else
            //{
            //	imgWine.SetImageResource(Resource.Drawable.bottle);
            //}
            if (imageBitmap != null)
            {
                //		if (heartLP.LeftMargin <= 250)
                //		{
                //			place.LeftMargin = -140;
                float ratio = (float)400 / imageBitmap.Height;
                imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 400, true);
                //		}
                //		else
                //		{
                //			place.LeftMargin = -70;
                //			float ratio = (float)650 / imageBitmap.Height;
                //			imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 650, true);
                //		}


                imgWine.SetImageBitmap(imageBitmap);

                //imageBitmap.Dispose();
            }
            else
            {
                //if (heartLP.LeftMargin <= 250)
                //{
                //	place.LeftMargin = -140;
                //	imgWine.SetImageResource(Resource.Drawable.bottle);
                //}
                //else
                //{
                //	place.LeftMargin = -70;
                imgWine.SetImageResource(Resource.Drawable.bottle);
            }

            txtName.Focusable = false;

            txtVintage.Focusable = false;
            txtPrice.Focusable   = false;
            imgWine.Focusable    = false;
            imgWine.Dispose();


            return(row);
        }
Ejemplo n.º 4
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (myItems.Count == 0)

            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.ReviewEmpty, null, false);
                TextView  txtName = row.FindViewById <TextView>(Resource.Id.textView1);
                ImageView Imag    = row.FindViewById <ImageView>(Resource.Id.imageView1);
                //            AlertDialog.Builder aler = new AlertDialog.Builder(myContext);
                ////aler.SetTitle("No Reviews Avalilable");
                //aler.SetMessage("Sorry you haven't Reviewed our wines");
                //aler.SetNegativeButton("Ok", delegate { });
                //LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                //Dialog dialog = aler.Create();
                //dialog.Show();
            }
            else
            {
                if (row == null)
                {
                    row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyReviewsCell, null, false);
                    //else
                    //    return convertView;

                    TextView txtName        = row.FindViewById <TextView>(Resource.Id.textView64);
                    TextView txtYear        = row.FindViewById <TextView>(Resource.Id.textView65);
                    TextView txtDescription = row.FindViewById <TextView>(Resource.Id.textView66);
                    TextView txtDate        = row.FindViewById <TextView>(Resource.Id.textView67);
                    //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice);
                    ImageButton edit       = row.FindViewById <ImageButton>(Resource.Id.imageButton3);
                    ImageButton delete     = row.FindViewById <ImageButton>(Resource.Id.imageButton4);
                    ImageButton wineimage  = row.FindViewById <ImageButton>(Resource.Id.imageButton2);
                    var         metrics    = myContext.Resources.DisplayMetrics;
                    var         widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
                    var         heightInDp = ConvertPixelsToDp(metrics.HeightPixels);

                    RatingBar rb       = row.FindViewById <RatingBar>(Resource.Id.rating);
                    ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imageButton44);
                    heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                    //edit.SetScaleType(ImageView.ScaleType.Center);
                    //delete.SetScaleType(ImageView.ScaleType.Center);
                    //edit.SetImageResource(Resource.Drawable.edit);
                    //delete.SetImageResource(Resource.Drawable.delete);
                    edit.Focusable = false;
                    //edit.FocusableInTouchMode = false;
                    edit.Clickable   = true;
                    delete.Focusable = false;
                    //delete.FocusableInTouchMode = false;
                    delete.Clickable               = true;
                    wineimage.Focusable            = false;
                    wineimage.FocusableInTouchMode = false;
                    wineimage.Clickable            = true;
                    //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice);
                    //ImageView imgWine = row.FindViewById<ImageView>(Resource.Id.imgWine);
                    //edit.SetTag(1, 5757);
                    edit.Click += (sender, args) =>
                    {
                        string WineBarcode = myItems[position].Barcode;
                        Review _review     = new Review();
                        _review.Barcode     = WineBarcode;
                        _review.RatingStars = myItems[position].RatingStars;
                        _review.RatingText  = myItems[position].RatingText;
                        _review.PlantFinal  = myItems[position].PlantFinal;
                        LoggingClass.LogInfo("clicked on edit  an item---->" + WineBarcode + "----->" + _review.RatingStars + "---->" + _review.RatingText, screenid);
                        PerformItemClick(sender, args, _review);
                    };
                    //delete.Click += Delete_Click;
                    delete.Click += (sender, args) =>
                    {
                        string WineBarcode = myItems[position].Barcode;

                        Review _review = new Review();
                        _review.Barcode = WineBarcode;
                        LoggingClass.LogInfo("clicked on delete item--->" + WineBarcode, screenid);
                        PerformdeleteClick(sender, args, _review);
                    };
                    wineimage.Click += (sender, args) => Console.WriteLine("ImageButton {0} clicked", position);
                    txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
                    txtName.Text = myItems[position].Name;
                    // txtName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
                    // txtPrice.Text= myItems[position].
                    txtYear.Text        = myItems[position].Vintage;
                    txtDescription.Text = myItems[position].RatingText;
                    //txtDescription.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
                    txtDate.Text = myItems[position].Date.ToString("dd/MM/yyyy");
                    rb.Rating    = myItems[position].RatingStars;
                    //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId);
                    ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                    string path = pppd.CreateDirectoryForPictures();
                    //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                    var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg");


                    bool count = Convert.ToBoolean(myItems[position].Liked);
                    if (count == true)
                    {
                        heartImg.SetImageResource(Resource.Drawable.HeartFull);
                    }
                    else
                    {
                        heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                    }
                    heartImg.Tag = position;

                    if (convertView == null)
                    {
                        heartImg.Click += async delegate
                        {
                            int  actualPosition = Convert.ToInt32(heartImg.Tag);
                            bool x;
                            if (count == false)
                            {
                                heartImg.SetImageResource(Resource.Drawable.HeartFull);
                                LoggingClass.LogInfoEx("Liked an item------>" + myItems[position].Barcode, screenid);
                                x     = true;
                                count = true;
                            }
                            else
                            {
                                heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                                LoggingClass.LogInfoEx("UnLiked an item" + "----->" + myItems[position].Barcode, screenid);
                                x     = false;
                                count = false;
                            }
                            SKULike like = new SKULike();
                            like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                            like.SKU    = Convert.ToInt32(myItems[actualPosition].SKU);
                            like.Liked  = x;
                            //myItems[actualPosition].IsLike = x;
                            like.BarCode = myItems[actualPosition].Barcode;
                            LoggingClass.LogInfo("Liked an item", screenid);
                            ServiceWrapper sw = new ServiceWrapper();
                            await sw.InsertUpdateLike(like);
                        };
                    }


                    Bitmap imageBitmap;
                    if (System.IO.File.Exists(filePath))
                    {
                        imageBitmap = BitmapFactory.DecodeFile(filePath);
                        wineimage.SetImageBitmap(imageBitmap);
                    }
                    else
                    {
                        imageBitmap = BlobWrapper.Bottleimages(myItems[position].Barcode, Convert.ToInt32(myItems[position].PlantFinal));

                        wineimage.SetImageBitmap(imageBitmap);
                    }
                    //wineimage.SetImageBitmap(imageBitmap);
                    //wineimage.SetImageResource(Resource.Drawable.wine7);
                    wineimage.SetScaleType(ImageView.ScaleType.CenterCrop);

                    txtName.Focusable        = false;
                    txtYear.Focusable        = false;
                    txtDescription.Focusable = false;
                    txtDate.Focusable        = false;
                }
            }
            LoggingClass.LogInfo("Entered into My Review Adapter", screenid);
            return(row);
        }
Ejemplo n.º 5
0
        //public async Task bindImages()
        //{
        //    await
        //}

        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.cell, null, false);
            }
            //else
            //    return row;

            TextView txtName = row.FindViewById <TextView>(Resource.Id.txtName);
            //TextView txtRatings = row.FindViewById<TextView>(Resource.Id.txtRatings);
            TextView txtVintage = row.FindViewById <TextView>(Resource.Id.txtVintage);
            //TextView txtUserRatings = row.FindViewById<TextView>(Resource.Id.txtUserRatings);
            TextView  txtPrice = row.FindViewById <TextView>(Resource.Id.txtPrice);
            ImageView imgWine  = row.FindViewById <ImageView>(Resource.Id.imgWine);
            // ImageView imgPlaceHolder = row.FindViewById<ImageView>(Resource.Id.Placeholder);
            ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imgHeart);
            RatingBar rating   = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);

            rating.Rating = (float)myItems[position].AverageRating;
            //RelativeLayout rel = row.FindViewById<RelativeLayout>(Resource.Id.relative);
            //var place11 = new RelativeLayout.LayoutParams(520, 620)
            //rel.LayoutParameters = place11;
            //rel.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);
            txtName.Text = myItems[position].Name;
            //txtName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
            //txtRatings.Text = myItems[position].Ratings;
            //txtUserRatings.Text = myItems[position].UserRatings;

            txtPrice.Text = myItems[position].SalePrice.ToString("C", Cultures.UnitedState);

            txtVintage.Text = myItems[position].Vintage.ToString();
            //heartImg.t = myItems[position].s;

            heartImg.SetImageResource(Resource.Drawable.heart_empty);
            var heartLP = new FrameLayout.LayoutParams(80, 80);

            var metrics    = myContext.Resources.DisplayMetrics;
            var widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
            var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);

            heartLP.LeftMargin        = parent.Resources.DisplayMetrics.WidthPixels / 2 - 110; // 110 = 80 + 30
            heartLP.TopMargin         = 5;
            heartImg.LayoutParameters = heartLP;

            heartImg.Layout(50, 50, 50, 50);


            bool count = Convert.ToBoolean(myItems[position].IsLike);

            if (count == true)
            {
                heartImg.SetImageResource(Resource.Drawable.heart_full);
            }
            else
            {
                heartImg.SetImageResource(Resource.Drawable.heart_empty);
            }

            heartImg.Tag = position;

            if (convertView == null)
            {
                heartImg.Click += async delegate
                {
                    int  actualPosition = Convert.ToInt32(heartImg.Tag);
                    bool x;
                    if (count == false)
                    {
                        heartImg.SetImageResource(Resource.Drawable.heart_full);
                        x     = true;
                        count = true;
                    }
                    else
                    {
                        heartImg.SetImageResource(Resource.Drawable.heart_empty);
                        x     = false;
                        count = false;
                    }
                    SKULike like = new SKULike();
                    like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                    like.SKU    = Convert.ToInt32(myItems[actualPosition].SKU);
                    like.Liked  = x;
                    myItems[actualPosition].IsLike = x;
                    like.WineId = myItems[actualPosition].WineId;
                    ServiceWrapper sw = new ServiceWrapper();
                    await sw.InsertUpdateLike(like);
                };
            }


            //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            //string path = pppd.CreateDirectoryForPictures();
            //var filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg");
            Bitmap imageBitmap;



            //if (System.IO.File.Exists(filePath))
            //{
            //    imageBitmap = BitmapFactory.DecodeFile(filePath);
            //}
            //else
            //{
            imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId);
            //}
            //var place1 = new FrameLayout.LayoutParams(650, 650);
            //imgPlaceHolder.SetImageResource(Resource.Drawable.placeholder);
            //place1.LeftMargin = -70;
            //imgPlaceHolder.LayoutParameters = place1;



            var place = new FrameLayout.LayoutParams(650, 650);

            place.LeftMargin         = -70; //-650 + (parent.Resources.DisplayMetrics.WidthPixels - imageBitmap.Width) / 2;
            imgWine.LayoutParameters = place;


            if (imageBitmap != null)
            {
                float ratio = (float)650 / imageBitmap.Height;
                imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 650, true);
                //imageBitmap.Recycle();
                //Canvas canvas = new Canvas(imageBitmap);
                //imageBitmap.EraseColor(Color.White);
                //canvas.DrawColor(Color.Transparent, PorterDuff.Mode.Clear);
                //canvas.DrawBitmap(imageBitmap, 0, 0, null);
                imgWine.SetImageBitmap(imageBitmap);

                imageBitmap.Dispose();
            }
            else
            {
                imgWine.SetImageResource(Resource.Drawable.wine7);
            }



            txtName.Focusable = false;

            txtVintage.Focusable = false;
            txtPrice.Focusable   = false;
            imgWine.Focusable    = false;
            //imgPlaceHolder.Focusable = false;
            return(row);
        }
Ejemplo n.º 6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Profile);
            try
            {
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                int                      userId      = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper           sw          = new ServiceWrapper();
                var                      output      = sw.GetCustomerDetails(userId).Result;
                ImageView                propicimage = FindViewById <ImageView>(Resource.Id.propicview);
                ProfilePicturePickDialog pppd        = new ProfilePicturePickDialog();
                string                   path        = pppd.CreateDirectoryForPictures();
                //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

                var filePath = System.IO.Path.Combine(path + "/" + userId + ".jpg");
                if (System.IO.File.Exists(filePath))
                {
                    Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath);
                    if (imageBitmap == null)
                    {
                        propicimage.SetImageResource(Resource.Drawable.user1);
                        //propicimage.SetImageBitmap(imageBitmap);
                    }
                    else
                    {
                        propicimage.SetImageBitmap(imageBitmap);
                    }
                }
                else
                {
                    Bitmap imageBitmap = BlobWrapper.ProfileImages(userId);
                    if (imageBitmap == null)
                    {
                        propicimage.SetImageResource(Resource.Drawable.user1);
                    }
                    else
                    {
                        propicimage.SetImageBitmap(imageBitmap);
                    }
                }

                ImageButton changepropic = FindViewById <ImageButton>(Resource.Id.btnChangePropic);

                //changepropic.SetImageResource(Resource.Drawable.dpreplacer);
                //changepropic.SetScaleType(ImageView.ScaleType.CenterCrop);
                changepropic.Click += delegate
                {
                    Intent intent = new Intent(this, typeof(ProfilePicturePickDialog));
                    StartActivity(intent);
                };

                //Button Btnlogout = FindViewById<Button>(Resource.Id.button1);
                //Btnlogout.Click += delegate
                //{

                //    Intent intent = new Intent(this, typeof(LoginActivity));
                //    StartActivity(intent);
                //};

                EditText Firstname = FindViewById <EditText>(Resource.Id.txtFirstName);
                Firstname.Text = output.customer.FirstName;
                EditText Lastname = FindViewById <EditText>(Resource.Id.txtLastName);
                Lastname.Text = output.customer.LastName;
                EditText Mobilenumber = FindViewById <EditText>(Resource.Id.txtMobileNumber);
                string   phno1        = output.customer.PhoneNumber;
                string   phno2        = output.customer.Phone2;
                if (phno1 != null)
                {
                    Mobilenumber.Text = phno1;
                }
                else
                {
                    Mobilenumber.Text = phno2;
                }
                EditText Email = FindViewById <EditText>(Resource.Id.txtEmail);
                Email.Text = output.customer.Email;
                EditText Address = FindViewById <EditText>(Resource.Id.txtAddress);
                string   Addres2 = output.customer.Address2;
                string   Addres1 = output.customer.Address1;
                Address.Text = string.Concat(Addres1, Addres2);
                EditText City = FindViewById <EditText>(Resource.Id.txtCity);
                City.Text = output.customer.City;
                EditText State = FindViewById <EditText>(Resource.Id.txtState);
                State.Text = output.customer.State;

                Button updatebtn = FindViewById <Button>(Resource.Id.UpdateButton);

                //updatebtn.SetScaleType(ImageView.ScaleType.CenterCrop);
                updatebtn.Click += async delegate
                {
                    Customer customer = new Customer();
                    customer.FirstName   = Firstname.Text;
                    customer.LastName    = Lastname.Text;
                    customer.PhoneNumber = Mobilenumber.Text;
                    customer.Address1    = Address.Text;
                    customer.Email       = Email.Text;
                    customer.CustomerID  = userId;
                    customer.State       = State.Text;
                    customer.City        = City.Text;
                    var x = await sw.UpdateCustomer(customer);

                    if (x == 1)
                    {
                        Toast.MakeText(this, "Thank you your profile is Updated", ToastLength.Short).Show();
                    }
                };
            }
            catch (Exception exe)
            {
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
            ProgressIndicator.Hide();
        }
        public async void DownloadAsync(object sender, System.EventArgs ea, string WineBarcode)
        {
            webClient = new WebClient();
            string url = null;

            if (storeid == 1)
            {
                url = "https://icsintegration.blob.core.windows.net/barcodeppdetail/" + WineBarcode + ".jpg";
                LoggingClass.LogInfo("Download Async image in detail view" + WineBarcode + +',' + storeid, screenid);
            }
            else if (storeid == 2)
            {
                url = "https://icsintegration.blob.core.windows.net/barcodeppdetail/" + WineBarcode + ".jpg";
                LoggingClass.LogInfo("Download Async image in detail view" + WineBarcode + +',' + storeid, screenid);
            }
            byte[] imageBytes = null;
            //progressLayout.Visibility = ViewStates.Visible;
            try
            {
                imageBytes = await webClient.DownloadDataTaskAsync(url);
            }


            catch (TaskCanceledException)
            {
                //this.progressLayout.Visibility = ViewStates.Gone;
                return;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError("while downloading image of wine id" + WineBarcode + "  " + exe.Message, screenid, exe.StackTrace.ToString());
                //progressLayout.Visibility = ViewStates.Gone;
                //downloadButton.Click += downloadAsync;
                //downloadButton.Text = "Download Image";
                Bitmap imgWine = BlobWrapper.Bottleimages(WineBarcode, storeid);
                HighImageWine.SetImageBitmap(imgWine);
                if (imgWine == null)
                {
                    HighImageWine.SetImageResource(Resource.Drawable.bottle);
                }
                return;
            }

            try
            {
                string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                string localFilename = "Wine.png";
                string localPath     = System.IO.Path.Combine(documentsPath, localFilename);

                FileStream fs = new FileStream(localPath, FileMode.OpenOrCreate);
                await fs.WriteAsync(imageBytes, 0, imageBytes.Length);

                fs.Close();

                BitmapFactory.Options options = new BitmapFactory.Options()
                {
                    InJustDecodeBounds = true
                };
                await BitmapFactory.DecodeFileAsync(localPath, options);

                Bitmap bitmap = await BitmapFactory.DecodeFileAsync(localPath);

                if (bitmap == null)
                {
                    HighImageWine.SetImageResource(Resource.Drawable.bottle);
                }
                HighImageWine.SetImageBitmap(bitmap);
            }
            catch (Exception exe)
            {
                LoggingClass.LogError("While setting High resulution image" + exe.Message, screenid, exe.StackTrace.ToString());
            }

            //progressLayout.Visibility = ViewStates.Gone;
            //downloadButton.Click += downloadAsync;
            //downloadButton.Enabled = false;
            HighImageWine.Dispose();
            //downloadButton.Text = "Download Image";
        }
Ejemplo n.º 8
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.cell, null, false);
            }
            //else
            //    return row;

            TextView txtName = row.FindViewById <TextView>(Resource.Id.txtName);

            TextView  txtVintage = row.FindViewById <TextView>(Resource.Id.txtVintage);
            TextView  AmountLeft = row.FindViewById <TextView>(Resource.Id.txtAmountLeft);
            TextView  txtPrice   = row.FindViewById <TextView>(Resource.Id.txtPrice);
            ImageView imgWine    = row.FindViewById <ImageView>(Resource.Id.imgWine);
            ImageView heartImg   = row.FindViewById <ImageView>(Resource.Id.imgHeart);
            RatingBar rating     = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);

            rating.Rating   = (float)myItems[position].AverageRating;
            txtName.Text    = myItems[position].Name;
            txtPrice.Text   = myItems[position].SalePrice.ToString("C", Cultures.UnitedState);
            AmountLeft.Text = "Wine left in bottle: " + myItems[position].AvailableVolume.ToString() + ".ml";
            txtVintage.Text = myItems[position].Vintage.ToString();
            heartImg.SetImageResource(Resource.Drawable.Heart_emp);
            var heartLP    = new FrameLayout.LayoutParams(80, 80);
            var metrics    = myContext.Resources.DisplayMetrics;
            var widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
            var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);

            heartLP.LeftMargin        = parent.Resources.DisplayMetrics.WidthPixels / 2 - 110;              // 110 = 80 + 30
            heartLP.TopMargin         = 5;
            heartImg.LayoutParameters = heartLP;
            heartImg.Layout(50, 50, 50, 50);

            bool count = Convert.ToBoolean(myItems[position].IsLike);

            if (count == true)
            {
                heartImg.SetImageResource(Resource.Drawable.HeartFull);
            }
            else
            {
                heartImg.SetImageResource(Resource.Drawable.Heart_emp);
            }
            heartImg.Tag = position;

            if (convertView == null)
            {
                heartImg.Click += async delegate
                {
                    if (CurrentUser.getUserId() == null)
                    {
                        AlertDialog.Builder aler = new AlertDialog.Builder(myContext, 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);
                        });
                        Dialog dialog1 = aler.Create();
                        dialog1.Show();
                    }
                    else
                    {
                        int  actualPosition = Convert.ToInt32(heartImg.Tag);
                        bool x;
                        if (count == false)
                        {
                            heartImg.SetImageResource(Resource.Drawable.HeartFull);
                            LoggingClass.LogInfoEx("Liked an item------>" + myItems[position].Barcode, screenid);
                            x     = true;
                            count = true;
                        }
                        else
                        {
                            heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                            LoggingClass.LogInfoEx("UnLiked an item" + "----->" + myItems[position].Barcode, screenid);
                            x     = false;
                            count = false;
                        }
                        SKULike like = new SKULike();
                        like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                        like.SKU    = Convert.ToInt32(myItems[actualPosition].SKU);
                        like.Liked  = x;
                        myItems[actualPosition].IsLike = x;
                        like.BarCode = myItems[actualPosition].Barcode;
                        LoggingClass.LogInfo("Liked an item", screenid);
                        ServiceWrapper sw = new ServiceWrapper();
                        await sw.InsertUpdateLike(like);
                    }
                };
                // }
            }


            Bitmap imageBitmap;

            imageBitmap = BlobWrapper.Bottleimages(myItems[position].Barcode, storeid);
            var place = new FrameLayout.LayoutParams(650, 650);

            //-650 + (parent.Resources.DisplayMetrics.WidthPixels - imageBitmap.Width) / 2;
            imgWine.LayoutParameters = place;
            //var place1 = new FrameLayout.LayoutParams(600, 500);

            ////-650 + (parent.Resources.DisplayMetrics.WidthPixels - imageBitmap.Width) / 2;
            //imgWine.LayoutParameters = place1;
            if (imageBitmap != null)
            {
                if (heartLP.LeftMargin <= 250)
                {
                    place.LeftMargin = -140;
                    float ratio = (float)500 / imageBitmap.Height;
                    imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 550, true);
                }
                else
                {
                    place.LeftMargin = -70;
                    float ratio = (float)650 / imageBitmap.Height;
                    imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 650, true);
                }


                imgWine.SetImageBitmap(imageBitmap);

                imageBitmap.Dispose();
            }
            else
            {
                if (heartLP.LeftMargin <= 250)
                {
                    place.LeftMargin = -140;
                    imgWine.SetImageResource(Resource.Drawable.bottle);
                }
                else
                {
                    place.LeftMargin = -70;
                    imgWine.SetImageResource(Resource.Drawable.bottle);
                }
            }

            txtName.Focusable    = false;
            AmountLeft.Focusable = false;
            txtVintage.Focusable = false;
            txtPrice.Focusable   = false;
            imgWine.Focusable    = false;
            imgWine.Dispose();
            return(row);
        }
Ejemplo n.º 9
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyTastingView, null, false);
                //else
                //    return convertView;
                if (myItems.Count == 0)
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(myContext);
                    //aler.SetTitle("No Reviews Avalilable");
                    aler.SetMessage("Sorry you haven't Tasted our wines");
                    aler.SetNegativeButton("Ok", delegate { });
                    LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                    Dialog dialog = aler.Create();
                    dialog.Show();
                }
                else
                {
                    TextView    txtName        = row.FindViewById <TextView>(Resource.Id.SkuName);
                    TextView    txtYear        = row.FindViewById <TextView>(Resource.Id.Vintage);
                    TextView    txtDescription = row.FindViewById <TextView>(Resource.Id.TastingNotes);
                    TextView    txtDate        = row.FindViewById <TextView>(Resource.Id.Date);
                    TextView    txtPrice       = row.FindViewById <TextView>(Resource.Id.Price);
                    ImageView   heartImg       = row.FindViewById <ImageView>(Resource.Id.imageButton4);
                    ImageButton wineimage      = row.FindViewById <ImageButton>(Resource.Id.imageButton2);
                    RatingBar   rb             = row.FindViewById <RatingBar>(Resource.Id.AvgRating);


                    heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                    txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
                    txtName.Text        = myItems[position].Name;
                    txtName.InputType   = Android.Text.InputTypes.TextFlagNoSuggestions;
                    txtYear.Text        = myItems[position].Vintage.ToString();
                    txtDescription.Text = myItems[position].Description;
                    txtDate.Text        = myItems[position].TastingDate.ToString();
                    txtPrice.Text       = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState);
                    rb.Rating           = (float)myItems[position].AverageRating;
                    //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId);
                    ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                    string path = pppd.CreateDirectoryForPictures();
                    //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                    var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg");

                    bool count = Convert.ToBoolean(myItems[position].IsLike);
                    if (count == true)
                    {
                        heartImg.SetImageResource(Resource.Drawable.HeartFull);
                    }
                    else
                    {
                        heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                    }
                    heartImg.Tag = position;

                    if (convertView == null)
                    {
                        heartImg.Click += async delegate
                        {
                            int  actualPosition = Convert.ToInt32(heartImg.Tag);
                            bool x;
                            if (count == false)
                            {
                                heartImg.SetImageResource(Resource.Drawable.HeartFull);
                                LoggingClass.LogInfoEx("Liked an item------>" + myItems[position].Barcode, screenid);
                                x     = true;
                                count = true;
                            }
                            else
                            {
                                heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                                LoggingClass.LogInfoEx("UnLiked an item" + "----->" + myItems[position].Barcode, screenid);
                                x     = false;
                                count = false;
                            }
                            SKULike like = new SKULike();
                            like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                            like.SKU    = Convert.ToInt32(myItems[actualPosition].SKU);
                            like.Liked  = x;
                            myItems[actualPosition].IsLike = x;
                            like.BarCode = myItems[actualPosition].Barcode;
                            LoggingClass.LogInfo("Liked an item", screenid);
                            ServiceWrapper sw = new ServiceWrapper();
                            await sw.InsertUpdateLike(like);
                        };
                    }



                    Bitmap imageBitmap;
                    if (System.IO.File.Exists(filePath))
                    {
                        imageBitmap = BitmapFactory.DecodeFile(filePath);
                        wineimage.SetImageBitmap(imageBitmap);
                    }
                    else
                    {
                        imageBitmap = BlobWrapper.Bottleimages(myItems[position].Barcode, myItems[position].Vintage);

                        wineimage.SetImageBitmap(imageBitmap);
                    }
                    wineimage.SetScaleType(ImageView.ScaleType.CenterCrop);


                    txtName.Focusable        = false;
                    txtYear.Focusable        = false;
                    txtDescription.Focusable = false;
                    txtDate.Focusable        = false;
                }
            }
            LoggingClass.LogInfo("Entered into My tastings Adapter", screenid);
            return(row);
        }
Ejemplo n.º 10
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            //////////////			View row = convertView;
            //////////////			if (row == null)
            //////////////				row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyFavorite, null, false);
            //////////////			else
            //////////////				return row;
            //////////////			if (myItems.Count == 0)
            //////////////			{

            //////////////				AlertDialog.Builder aler = new AlertDialog.Builder(myContext);
            //////////////				aler.SetTitle("No Reviews Avalilable");
            //////////////				aler.SetMessage("Sorry you didn't tell us your Favourite wines");
            //////////////				aler.SetNegativeButton("Ok", delegate { });
            //////////////				LoggingClass.LogInfo("Clicked on Secaucus", screenid);
            //////////////				Dialog dialog = aler.Create();
            //////////////				dialog.Show();
            //////////////			}
            //////////////			else
            //////////////			{

            //////////////				TextView Name = row.FindViewById<TextView>(Resource.Id.txtNamefav);
            //////////////				TextView Vintage = row.FindViewById<TextView>(Resource.Id.txtVintagefav);
            //////////////				ImageView Wine = row.FindViewById<ImageView>(Resource.Id.imgWinefav);
            //////////////				TextView Price = row.FindViewById<TextView>(Resource.Id.txtPricefav);
            //////////////				RatingBar Avgrating = row.FindViewById<RatingBar>(Resource.Id.rtbProductRatingfav);
            //////////////				//ImageView place = row.FindViewById<ImageView>(Resource.Id.placeholdefavr);
            //////////////				ImageView Heart = row.FindViewById<ImageView>(Resource.Id.imgHeartfav);

            //////////////				String str = "lokesh";
            //////////////				Name.Text = myItems[position].Name;

            //////////////				Price.Text = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState);

            //////////////				Avgrating.Rating = (float)myItems[position].AverageRating;
            //////////////				Vintage.Text = myItems[position].Vintage.ToString();


            //////////////				Heart.SetImageResource(Resource.Drawable.Heart_emp);
            //////////////				var heartLP = new RelativeLayout.LayoutParams(80, 80);

            //////////////				var metrics = myContext.Resources.DisplayMetrics;
            //////////////				var widthInDp = ConvertPixelsToDp(metrics.WidthPixels);
            //////////////				var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);
            //////////////				heartLP.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 110; // 110 = 80 + 30

            //////////////				heartLP.TopMargin = 5;
            //////////////				Heart.LayoutParameters = heartLP;
            //////////////				bool count = Convert.ToBoolean(myItems[position].IsLike);
            //////////////				if (count == true)
            //////////////				{
            //////////////					Heart.SetImageResource(Resource.Drawable.HeartFull);
            //////////////				}
            //////////////				else
            //////////////				{
            //////////////					Heart.SetImageResource(Resource.Drawable.Heart_emp);
            //////////////				}

            //////////////				Heart.Click += async delegate
            //////////////				{
            //////////////					bool x;
            //////////////					if (count == false)
            //////////////					{
            //////////////						Heart.SetImageResource(Resource.Drawable.HeartFull);
            //////////////						LoggingClass.LogInfo("Liked an item" + myItems[position].WineId, screenid);
            //////////////						x = true;
            //////////////						count = true;
            //////////////					}
            //////////////					else
            //////////////					{
            //////////////						Heart.SetImageResource(Resource.Drawable.heart_empty);
            //////////////						LoggingClass.LogInfo("UnLiked an item" + myItems[position].WineId, screenid);
            //////////////						x = false;
            //////////////						count = false;
            //////////////					}
            //////////////					SKULike like = new SKULike();
            //////////////					like.UserID = Convert.ToInt32(CurrentUser.getUserId());
            //////////////					like.SKU = Convert.ToInt32(myItems[position].SKU);
            //////////////					like.Liked = x;
            //////////////					ServiceWrapper sw = new ServiceWrapper();
            //////////////					LoggingClass.LogInfo("Liked an item" + myItems[position].WineId, screenid);
            //////////////					like.WineId = myItems[position].WineId;
            //////////////					await sw.InsertUpdateLike(like);
            //////////////				};
            //////////////				////////////////Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId);
            //////////////				//////////////// place.SetImageResource(Resource.Drawable.placeholder);
            //////////////				//////////////ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            //////////////				//////////////string path = pppd.CreateDirectoryForPictures();
            //////////////				////////////////string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            //////////////				//////////////var filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg");
            //////////////				//Bitmap imageBitmap;
            //////////////				Bitmap imageBitmap;
            //////////////				imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId, myItems[position].PlantFinal);
            //////////////				//if (System.IO.File.Exists(filePath))
            //////////////				//{
            //////////////				//	imageBitmap = BitmapFactory.DecodeFile(filePath);
            //////////////				//	Wine.SetImageBitmap(imageBitmap);
            //////////////				//}
            //////////////				//else
            //////////////				{
            //////////////					imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId, myItems[position].PlantFinal);
            //////////////					Wine.SetImageBitmap(imageBitmap);
            //////////////				}
            //////////////				//Wine.SetImageBitmap(imageBitmap);
            //////////////				var place1 = new RelativeLayout.LayoutParams(620, 620);
            //////////////				var place = new RelativeLayout.LayoutParams(620, 620);
            //////////////				//place1.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 430;
            //////////////				Wine.LayoutParameters = place1;

            //////////////				//var place2 = new RelativeLayout.LayoutParams(620, 620);
            //////////////				//place2.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 430;
            //////////////				//place.LayoutParameters = place2;
            //////////////				//imgPlaceHolder.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);
            //////////////				//Wine.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);
            //////////////				if (imageBitmap != null)
            //////////////				{
            //////////////					if (heartLP.LeftMargin <= 250)
            //////////////					{
            //////////////						place1.LeftMargin = -140;
            //////////////						float ratio = (float)500 / imageBitmap.Height;
            //////////////						imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 550, true);
            //////////////					}
            //////////////					else
            //////////////					{
            //////////////						place1.LeftMargin = -70;
            //////////////						float ratio = (float)650 / imageBitmap.Height;
            //////////////						imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 650, true);
            //////////////					}


            //////////////					Wine.SetImageBitmap(imageBitmap);

            //////////////					imageBitmap.Dispose();

            //////////////				}
            //////////////				else
            //////////////				{
            //////////////					Wine.SetImageResource(Resource.Drawable.wine7);
            //////////////				}



            //////////////				Name.Focusable = false;
            //////////////				Vintage.Focusable = false;
            //////////////				Price.Focusable = false;
            //////////////				Wine.Focusable = false;
            //////////////				Wine.Dispose();
            //////////////				Heart.Dispose();
            //////////////				heartLP.Dispose();

            //////////////				NotifyDataSetChanged();
            //////////////				LoggingClass.LogInfo("Entered into my fav Adapter", screenid);
            //////////////			}
            //////////////			return row;
            //////////////		}
            //////////////		private int ConvertPixelsToDp(float pixelValue)
            //////////////		{
            //////////////			var dp = (int)((pixelValue) / myContext.Resources.DisplayMetrics.Density);
            //////////////			return dp;
            //////////////		}
            //////////////	}
            //////////////}
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyFavorite, null, false);
            }
            //else
            //	return row;

            TextView txtName = row.FindViewById <TextView>(Resource.Id.txtName);

            TextView txtVintage = row.FindViewById <TextView>(Resource.Id.txtVintage);

            TextView  txtPrice = row.FindViewById <TextView>(Resource.Id.txtPrice);
            ImageView imgWine  = row.FindViewById <ImageView>(Resource.Id.imgWine);

            ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imgHeart);
            RatingBar rating   = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);

            rating.Rating = (float)myItems[position].AverageRating;
            txtName.Text  = myItems[position].Name;
            txtPrice.Text = myItems[position].SalePrice.ToString("C", Cultures.UnitedState);

            txtVintage.Text = myItems[position].Vintage.ToString();
            heartImg.SetImageResource(Resource.Drawable.Heart_emp);
            var heartLP    = new FrameLayout.LayoutParams(80, 80);
            var metrics    = myContext.Resources.DisplayMetrics;
            var widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
            var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);

            heartLP.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 110;                     // 110 = 80 + 30

            heartLP.TopMargin         = 5;
            heartImg.LayoutParameters = heartLP;
            heartImg.Layout(50, 50, 50, 50);
            bool count = Convert.ToBoolean(myItems[position].IsLike);

            if (count == true)
            {
                heartImg.SetImageResource(Resource.Drawable.HeartFull);
            }
            else
            {
                heartImg.SetImageResource(Resource.Drawable.Heart_emp);
            }

            heartImg.Tag = position;

            if (convertView == null)
            {
                heartImg.Click += async delegate
                {
                    int  actualPosition = Convert.ToInt32(heartImg.Tag);
                    bool x;
                    if (count == false)
                    {
                        heartImg.SetImageResource(Resource.Drawable.HeartFull);
                        LoggingClass.LogInfoEx("Liked an item----->" + myItems[position].Barcode, screenid);
                        x     = true;
                        count = true;
                    }
                    else
                    {
                        heartImg.SetImageResource(Resource.Drawable.Heart_emp);
                        LoggingClass.LogInfoEx("UnLiked an item---->" + myItems[position].Barcode, screenid);
                        x     = false;
                        count = false;
                    }
                    SKULike like = new SKULike();
                    like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                    like.SKU    = Convert.ToInt32(myItems[actualPosition].SKU);
                    like.Liked  = x;
                    myItems[actualPosition].IsLike = x;
                    like.BarCode = myItems[actualPosition].Barcode;
                    LoggingClass.LogInfo("Liked an item", screenid);
                    //myItems[position].pl

                    ServiceWrapper sw = new ServiceWrapper();
                    await sw.InsertUpdateLike(like);
                };
            }
            Bitmap imageBitmap;

            imageBitmap = BlobWrapper.Bottleimages(myItems[position].Barcode, storeid);
            var place = new FrameLayout.LayoutParams(650, 650);

            //-650 + (parent.Resources.DisplayMetrics.WidthPixels - imageBitmap.Width) / 2;
            imgWine.LayoutParameters = place;
            if (imageBitmap != null)
            {
                if (heartLP.LeftMargin <= 250)
                {
                    place.LeftMargin = -140;
                    float ratio = (float)500 / imageBitmap.Height;
                    imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 550, true);
                }
                else
                {
                    place.LeftMargin = -70;
                    float ratio = (float)650 / imageBitmap.Height;
                    imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 650, true);
                }


                imgWine.SetImageBitmap(imageBitmap);
            }
            else
            {
                imgWine.SetImageResource(Resource.Drawable.bottle);
            }

            txtName.Focusable = false;

            txtVintage.Focusable = false;
            txtPrice.Focusable   = false;
            imgWine.Focusable    = false;
            imgWine.Dispose();


            return(row);
        }
Ejemplo n.º 11
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyTastingView, null, false);
            }
            else
            {
                return(convertView);
            }

            TextView txtName        = row.FindViewById <TextView>(Resource.Id.SkuName);
            TextView txtYear        = row.FindViewById <TextView>(Resource.Id.Vintage);
            TextView txtDescription = row.FindViewById <TextView>(Resource.Id.TastingNotes);
            TextView txtDate        = row.FindViewById <TextView>(Resource.Id.Date);
            TextView txtPrice       = row.FindViewById <TextView>(Resource.Id.Price);

            ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2);
            RatingBar   rb        = row.FindViewById <RatingBar>(Resource.Id.AvgRating);



            txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
            txtName.Text        = myItems[position].Name;
            txtName.InputType   = Android.Text.InputTypes.TextFlagNoSuggestions;
            txtYear.Text        = myItems[position].Vintage.ToString();
            txtDescription.Text = myItems[position].Description;
            txtDate.Text        = myItems[position].TastingDate.ToString();
            txtPrice.Text       = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState);
            rb.Rating           = (float)myItems[position].AverageRating;
            //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId);
            ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            string path = pppd.CreateDirectoryForPictures();
            //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var    filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg");
            Bitmap imageBitmap;

            if (System.IO.File.Exists(filePath))
            {
                imageBitmap = BitmapFactory.DecodeFile(filePath);
                wineimage.SetImageBitmap(imageBitmap);
            }
            else
            {
                imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId);

                wineimage.SetImageBitmap(imageBitmap);
            }
            wineimage.SetScaleType(ImageView.ScaleType.CenterCrop);


            txtName.Focusable        = false;
            txtYear.Focusable        = false;
            txtDescription.Focusable = false;
            txtDate.Focusable        = false;



            return(row);
        }
Ejemplo n.º 12
0
        public async void downloadAsync(object sender, System.EventArgs ea, int wineid)
        {
            webClient = new WebClient();
            var url = new Uri("https://icsintegration.blob.core.windows.net/bottleimagesdetails/" + wineid + ".jpg");

            byte[] imageBytes = null;
            //progressLayout.Visibility = ViewStates.Visible;
            try
            {
                imageBytes = await webClient.DownloadDataTaskAsync(url);
            }
            catch (TaskCanceledException)
            {
                //this.progressLayout.Visibility = ViewStates.Gone;
                return;
            }
            catch (Exception exe)
            {
                //progressLayout.Visibility = ViewStates.Gone;
                //downloadButton.Click += downloadAsync;
                //downloadButton.Text = "Download Image";
                Bitmap imgWine = BlobWrapper.Bottleimages(wineid);
                HighImageWine.SetImageBitmap(imgWine);
                return;
            }

            try
            {
                string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                string localFilename = "Wine.png";
                string localPath     = System.IO.Path.Combine(documentsPath, localFilename);

                FileStream fs = new FileStream(localPath, FileMode.OpenOrCreate);
                await fs.WriteAsync(imageBytes, 0, imageBytes.Length);

                Console.WriteLine("Saving image in local path: " + localPath);
                fs.Close();

                BitmapFactory.Options options = new BitmapFactory.Options();
                options.InJustDecodeBounds = true;
                await BitmapFactory.DecodeFileAsync(localPath, options);


                //options.InSampleSize = options.OutWidth > options.OutHeight ? options.OutHeight / imageView.Height : options.OutWidth / imageView.Width;
                //options.InJustDecodeBounds = false;

                Bitmap bitmap = await BitmapFactory.DecodeFileAsync(localPath);

                if (bitmap == null)
                {
                    HighImageWine.SetImageResource(Resource.Drawable.wine7);
                }
                HighImageWine.SetImageBitmap(bitmap);
            }
            catch (Exception e)
            {
            }

            //progressLayout.Visibility = ViewStates.Gone;
            //downloadButton.Click += downloadAsync;
            //downloadButton.Enabled = false;
            HighImageWine.Dispose();
            //downloadButton.Text = "Download Image";
        }
Ejemplo n.º 13
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyFavorite, null, false);
            }
            TextView  txtName    = row.FindViewById <TextView>(Resource.Id.txtName);
            TextView  txtVintage = row.FindViewById <TextView>(Resource.Id.txtVintage);
            TextView  txtPrice   = row.FindViewById <TextView>(Resource.Id.txtPrice);
            ImageView imgWine    = row.FindViewById <ImageView>(Resource.Id.imgWine);
            ImageView heartImg   = row.FindViewById <ImageView>(Resource.Id.imgHeart);
            RatingBar rating     = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);

            rating.Rating = (float)myItems[position].AverageRating;
            txtName.Text  = myItems[position].Name;
            txtPrice.Text = myItems[position].SalePrice.ToString("C", Cultures.UnitedState);

            txtVintage.Text = myItems[position].Vintage.ToString();
            if (txtVintage.Text == "0" || txtVintage.Text == null)
            {
                txtVintage.Text = "";
            }
            else
            {
                txtVintage.Text = myItems[position].Vintage.ToString();
            }
            heartImg.SetImageResource(Resource.Drawable.heart_empty);
            bool count = Convert.ToBoolean(myItems[position].IsLike);

            if (count == true)
            {
                heartImg.SetImageResource(Resource.Drawable.heart_full);
            }
            else
            {
                heartImg.SetImageResource(Resource.Drawable.heart_empty);
            }

            heartImg.Tag = position;

            if (convertView == null)
            {
                heartImg.Click += delegate
                {
                    int  actualPosition = Convert.ToInt32(heartImg.Tag);
                    bool x;
                    if (count == false)
                    {
                        heartImg.SetImageResource(Resource.Drawable.heart_full);

                        x     = true;
                        count = true;
                    }
                    else
                    {
                        heartImg.SetImageResource(Resource.Drawable.heart_empty);

                        x     = false;
                        count = false;
                    }

                    var TaskA = new System.Threading.Tasks.Task(async() =>
                    {
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.getUserId());
                        like.SKU     = Convert.ToInt32(myItems[actualPosition].SKU);
                        like.Liked   = x;
                        myItems[actualPosition].IsLike = x;
                        like.BarCode      = myItems[actualPosition].Barcode;
                        ServiceWrapper sw = new ServiceWrapper();
                        await sw.InsertUpdateLike(like);
                    });
                    TaskA.Start();
                };
            }
            Bitmap imageBitmap;
            string url = myItems[position].SmallImageUrl;

            if (url == null || url == "")
            {
                url = myItems[position].Barcode + ".jpg";
            }

            imageBitmap = BlobWrapper.Bottleimages(url, storeid);
            if (imageBitmap != null)
            {
                float ratio = (float)400 / imageBitmap.Height;
                imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 400, true);
                imgWine.SetImageBitmap(imageBitmap);
            }
            else
            {
                imgWine.SetImageResource(Resource.Drawable.bottle);
            }
            txtName.Focusable    = false;
            txtVintage.Focusable = false;
            txtPrice.Focusable   = false;
            imgWine.Focusable    = false;
            imgWine.Dispose();
            return(row);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.LandscapeCell, null, false);
            }
            //else
            //    return row;

            TextView  txtName     = row.FindViewById <TextView>(Resource.Id.txtWinename);
            ImageView imgWine     = row.FindViewById <ImageView>(Resource.Id.imgWine);
            Bitmap    imagebitmap = BlobWrapper.Bottleimages(myItems[position].WineId);

            imgWine.SetImageBitmap(imagebitmap);
            txtName.Text = myItems[position].Name;
            //TextView txtRatings = row.FindViewById<TextView>(Resource.Id.txtRatings);
            //TextView txtVintage = row.FindViewById<TextView>(Resource.Id.txtVintage);
            ////TextView txtUserRatings = row.FindViewById<TextView>(Resource.Id.txtUserRatings);
            //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice);

            //ImageView imgPlaceHolder = row.FindViewById<ImageView>(Resource.Id.placeholder);
            //ImageView heartImg = row.FindViewById<ImageView>(Resource.Id.imgHeart);
            //RelativeLayout rel = row.FindViewById<RelativeLayout>(Resource.Id.relative);
            //var place11 = new RelativeLayout.LayoutParams(520, 620)
            //rel.LayoutParameters = place11;
            //rel.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);

            //txtRatings.Text = myItems[position].Ratings;
            //txtUserRatings.Text = myItems[position].UserRatings;
            //txtPrice.Text = myItems[position].RegPrice.ToString();
            //txtPrice.Text = "$ " + txtPrice.Text;
            //txtVintage.Text = myItems[position].Vintage.ToString();
            //heartImg.t = myItems[position].s;

            // heartImg.SetImageResource(Resource.Drawable.heart_empty);
            //var heartLP = new RelativeLayout.LayoutParams(80, 80);

            //var metrics = myContext.Resources.DisplayMetrics;
            //var widthInDp = ConvertPixelsToDp(metrics.WidthPixels);
            //var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);
            //heartLP.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2;
            //heartImg.LayoutParameters = heartLP;



            //heartImg.Layout(50, 50, 50, 50);
            //bool count = Convert.ToBoolean(myItems[position].IsLike);
            //if (count == true)
            //{
            //    heartImg.SetImageResource(Resource.Drawable.heart_full);
            //}
            //else
            //{
            //    heartImg.SetImageResource(Resource.Drawable.heart_empty);
            //}
            //if (convertView == null)
            //{
            //    heartImg.Click += async delegate
            //    {
            //        bool x;
            //        if (count == false)
            //        {
            //            heartImg.SetImageResource(Resource.Drawable.heart_full);
            //            x = true;
            //            count = true;
            //        }
            //        else
            //        {
            //            heartImg.SetImageResource(Resource.Drawable.heart_empty);
            //            x = false;
            //            count = false;
            //        }
            //        SKULike like = new SKULike();
            //        like.UserID = Convert.ToInt32(CurrentUser.getUserId());
            //        like.SKU = Convert.ToInt32(myItems[position].SKU);
            //        like.Liked = x;
            //        ServiceWrapper sw = new ServiceWrapper();
            //        await sw.InsertUpdateLike(like);
            //    };
            //}

            //imgPlaceHolder.SetImageResource(Resource.Drawable.placeholder);

            //var place = new RelativeLayout.LayoutParams(heightInDp, heightInDp);
            // var place = new RelativeLayout.LayoutParams(520, 620);
            //place.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 530;
            //imgWine.LayoutParameters = place;

            //var place1 = new RelativeLayout.LayoutParams(heightInDp, heightInDp);
            //place1.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 530;
            //imgPlaceHolder.LayoutParameters = place1;
            //imgPlaceHolder.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);
            //imgWine.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);


            txtName.Focusable = false;
            //txtRatings.Focusable = false;
            //txtUserRatings.Focusable = false;
            //txtVintage.Focusable = false;
            //txtPrice.Focusable = false;
            imgWine.Focusable = false;


            return(row);
        }
Ejemplo n.º 16
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (myItems.Count == 0)

            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.ReviewEmpty, null, false);
                TextView  txtName = row.FindViewById <TextView>(Resource.Id.textView1);
                ImageView Imag    = row.FindViewById <ImageView>(Resource.Id.imageView1);
            }
            else
            {
                if (row == null)
                {
                    row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyReviewsCell, null, false);
                }
                TextView    txtName        = row.FindViewById <TextView>(Resource.Id.textView64);
                TextView    txtYear        = row.FindViewById <TextView>(Resource.Id.textView65);
                TextView    txtDescription = row.FindViewById <TextView>(Resource.Id.textView66);
                TextView    txtDate        = row.FindViewById <TextView>(Resource.Id.textView67);
                ImageButton edit           = row.FindViewById <ImageButton>(Resource.Id.imageButton3);
                ImageButton delete         = row.FindViewById <ImageButton>(Resource.Id.imageButton4);
                ImageButton wineimage      = row.FindViewById <ImageButton>(Resource.Id.imageButton2);
                var         metrics        = myContext.Resources.DisplayMetrics;
                var         widthInDp      = ConvertPixelsToDp(metrics.WidthPixels);
                var         heightInDp     = ConvertPixelsToDp(metrics.HeightPixels);

                RatingBar rb       = row.FindViewById <RatingBar>(Resource.Id.rating);
                ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imageButton44);
                heartImg.SetImageResource(Resource.Drawable.heart_empty);

                edit.Focusable = false;

                edit.Clickable   = true;
                delete.Focusable = false;

                delete.Clickable               = true;
                wineimage.Focusable            = false;
                wineimage.FocusableInTouchMode = false;
                wineimage.Clickable            = true;
                wineimage.Click += (sender, args) => Console.WriteLine("ImageButton {0} clicked", position);
                txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
                txtName.Text = myItems[position].Name;

                txtYear.Text = myItems[position].Vintage;
                if (txtYear.Text == null || txtYear.Text == "0")
                {
                    txtYear.Text = "";
                }
                else
                {
                    txtYear.Text = myItems[position].Vintage;
                }
                txtDescription.Text = myItems[position].RatingText;

                txtDate.Text = myItems[position].Date.ToString("yyyy/MM/dd");
                rb.Rating    = (float)myItems[position].RatingStars;

                ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                string path = pppd.CreateDirectoryForPictures();

                var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg");


                bool count = Convert.ToBoolean(myItems[position].Liked);
                if (count == true)
                {
                    heartImg.SetImageResource(Resource.Drawable.heart_full);
                }
                else
                {
                    heartImg.SetImageResource(Resource.Drawable.heart_empty);
                }
                heartImg.Tag = position;
                edit.Tag     = position;
                delete.Tag   = position;
                if (convertView == null)
                {
                    edit.Click += (sender, args) =>
                    {
                        int    tempPosition = Convert.ToInt32(edit.Tag);
                        string WineBarcode  = myItems[tempPosition].Barcode;
                        Review _review      = new Review();
                        _review.Barcode     = WineBarcode;
                        _review.RatingStars = myItems[tempPosition].RatingStars;
                        _review.RatingText  = myItems[tempPosition].RatingText;
                        _review.PlantFinal  = myItems[tempPosition].PlantFinal;
                        LoggingClass.LogInfo("clicked on edit  an item---->" + WineBarcode + "----->" + _review.RatingStars + "---->" + _review.RatingText, screenid);
                        PerformItemClick(sender, args, _review);
                    };

                    delete.Click += (sender, args) =>
                    {
                        int    tempPositio1n = Convert.ToInt32(edit.Tag);
                        string WineBarcode   = myItems[tempPositio1n].Barcode;

                        Review _review = new Review();
                        _review.Barcode = WineBarcode;
                        LoggingClass.LogInfo("clicked on delete item--->" + WineBarcode, screenid);
                        PerformdeleteClick(sender, args, _review);
                    };
                    heartImg.Click += delegate
                    {
                        int  actualPosition = Convert.ToInt32(heartImg.Tag);
                        bool x;
                        if (count == false)
                        {
                            heartImg.SetImageResource(Resource.Drawable.heart_full);

                            x     = true;
                            count = true;
                        }
                        else
                        {
                            heartImg.SetImageResource(Resource.Drawable.heart_empty);

                            x     = false;
                            count = false;
                        }
                        var TaskA = new System.Threading.Tasks.Task(async() =>
                        {
                            SKULike like      = new SKULike();
                            like.UserID       = Convert.ToInt32(CurrentUser.getUserId());
                            like.SKU          = Convert.ToInt32(myItems[actualPosition].SKU);
                            like.Liked        = x;
                            like.BarCode      = myItems[actualPosition].Barcode;
                            ServiceWrapper sw = new ServiceWrapper();
                            await sw.InsertUpdateLike(like);
                        });
                        TaskA.Start();
                    };
                }
                Bitmap imageBitmap;
                string url = myItems[position].SmallImageURL;
                if (url == null || url == "")
                {
                    url = myItems[position].Barcode + ".jpg";
                }
                imageBitmap = BlobWrapper.Bottleimages(url, Convert.ToInt32(myItems[position].PlantFinal));
                if (imageBitmap == null)
                {
                    wineimage.SetImageResource(Resource.Drawable.bottle);
                }
                else
                {
                    wineimage.SetImageBitmap(imageBitmap);
                }

                txtName.Focusable        = false;
                txtYear.Focusable        = false;
                txtDescription.Focusable = false;
                txtDate.Focusable        = false;
            }
            LoggingClass.LogInfo("Entered into My Review Adapter", screenid);
            return(row);
        }
Ejemplo n.º 17
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();

                //    }

                //}
            };
        }
Ejemplo n.º 18
0
        public async void DownloadAsync(object sender, System.EventArgs ea)
        {
            try
            {
                //st.Start();
                Bitmap img = BlobWrapper.ProfileImages(Convert.ToInt32(CurrentUser.getUserId()));
                if (img != null)
                {
                    propicimage.SetImageBitmap(img);
                }
                else
                {
                    webClient = new WebClient();
                    var    url        = new Uri("https://icsintegration.blob.core.windows.net/profileimages/" + Convert.ToInt32(CurrentUser.getUserId()) + ".jpg");
                    byte[] imageBytes = null;
                    //progressLayout.Visibility = ViewStates.Visible;
                    try
                    {
                        imageBytes = await webClient.DownloadDataTaskAsync(url);
                    }
                    catch (TaskCanceledException)
                    {
                        //this.progressLayout.Visibility = ViewStates.Gone;
                        return;
                    }
                    catch (Exception exe)
                    {
                        LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                        //progressLayout.Visibility = ViewStates.Gone;
                        //downloadButton.Click += downloadAsync;
                        //downloadButton.Text = "Download Image";
                        Bitmap imgWine = BlobWrapper.ProfileImages(Convert.ToInt32(CurrentUser.getUserId()));
                        propicimage.SetImageBitmap(imgWine);
                        return;
                    }

                    try
                    {
                        string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                        string localFilename = "user.png";
                        string localPath     = System.IO.Path.Combine(documentsPath, localFilename);

                        FileStream fs = new FileStream(localPath, FileMode.OpenOrCreate);
                        await fs.WriteAsync(imageBytes, 0, imageBytes.Length);

                        //Console.WriteLine("Saving image in local path: " + localPath);
                        fs.Close();
                        BitmapFactory.Options options = new BitmapFactory.Options()
                        {
                            InJustDecodeBounds = true
                        };
                        await BitmapFactory.DecodeFileAsync(localPath, options);

                        Bitmap bitmap = await BitmapFactory.DecodeFileAsync(localPath);

                        if (bitmap == null)
                        {
                            propicimage.SetImageResource(Resource.Drawable.user1);
                        }
                        propicimage.SetImageBitmap(bitmap);
                    }
                    catch (Exception exe)
                    {
                        LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                    }
                    st.Stop();
                    LoggingClass.LogTime("Download aSync image profile", st.Elapsed.TotalSeconds.ToString());
                    propicimage.Dispose();
                }
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
        }
Ejemplo n.º 19
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyFavorite, null, false);
            }
            else
            {
                return(row);
            }


            TextView  Name      = row.FindViewById <TextView>(Resource.Id.txtNamefav);
            TextView  Vintage   = row.FindViewById <TextView>(Resource.Id.txtVintagefav);
            ImageView Wine      = row.FindViewById <ImageView>(Resource.Id.imgWinefav);
            TextView  Price     = row.FindViewById <TextView>(Resource.Id.txtPricefav);
            RatingBar Avgrating = row.FindViewById <RatingBar>(Resource.Id.rtbProductRatingfav);
            // ImageView place = row.FindViewById<ImageView>(Resource.Id.placeholdefavr);
            ImageView Heart = row.FindViewById <ImageView>(Resource.Id.imgHeartfav);

            //String str = "lokesh";
            Name.Text      = myItems[position].Name;
            Name.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;

            Price.Text = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState);

            Avgrating.Rating = (float)myItems[position].AverageRating;
            Vintage.Text     = myItems[position].Vintage.ToString();


            Heart.SetImageResource(Resource.Drawable.heart_empty);
            var heartLP = new RelativeLayout.LayoutParams(80, 80);

            var metrics    = myContext.Resources.DisplayMetrics;
            var widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
            var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);

            heartLP.LeftMargin     = parent.Resources.DisplayMetrics.WidthPixels / 2;
            Heart.LayoutParameters = heartLP;
            bool count = Convert.ToBoolean(myItems[position].IsLike);

            if (count == true)
            {
                Heart.SetImageResource(Resource.Drawable.heart_full);
            }
            else
            {
                Heart.SetImageResource(Resource.Drawable.heart_empty);
            }

            Heart.Click += async delegate
            {
                bool x;
                if (count == false)
                {
                    Heart.SetImageResource(Resource.Drawable.heart_full);
                    x     = true;
                    count = true;
                }
                else
                {
                    Heart.SetImageResource(Resource.Drawable.heart_empty);
                    x     = false;
                    count = false;
                }
                SKULike like = new SKULike();
                like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                like.SKU    = Convert.ToInt32(myItems[position].SKU);
                like.Liked  = x;
                ServiceWrapper sw = new ServiceWrapper();
                like.WineId = myItems[position].WineId;
                await sw.InsertUpdateLike(like);
            };
            //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId);
            // place.SetImageResource(Resource.Drawable.placeholder);
            ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            string path = pppd.CreateDirectoryForPictures();
            //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var    filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg");
            Bitmap imageBitmap;

            if (System.IO.File.Exists(filePath))
            {
                imageBitmap = BitmapFactory.DecodeFile(filePath);
                Wine.SetImageBitmap(imageBitmap);
            }
            else
            {
                imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId);
                Wine.SetImageBitmap(imageBitmap);
            }
            //Wine.SetImageBitmap(imageBitmap);
            var place1 = new RelativeLayout.LayoutParams(520, 520);

            // var place = new RelativeLayout.LayoutParams(520, 620);
            place1.LeftMargin     = parent.Resources.DisplayMetrics.WidthPixels / 2 - 430;
            Wine.LayoutParameters = place1;

            var place2 = new RelativeLayout.LayoutParams(520, 520);

            place2.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 430;
            // place.LayoutParameters = place2;
            //imgPlaceHolder.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);
            //imgWine.LayoutParameters = new RelativeLayout.LayoutParams(520, 520);



            Name.Focusable    = false;
            Vintage.Focusable = false;
            Price.Focusable   = false;
            Wine.Focusable    = false;

            NotifyDataSetChanged();
            return(row);
        }
Ejemplo n.º 20
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (myItems.Count == 0)

            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.EmptyTaste, null, false);
                TextView te = row.FindViewById <TextView>(Resource.Id.textView123a);
            }
            else
            {
                if (row == null)
                {
                    row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyTastingView, null, false);
                }
                TextView txtName = row.FindViewById <TextView>(Resource.Id.SkuName);
                TextView txtYear = row.FindViewById <TextView>(Resource.Id.Vintage);
                //TextView txtDescription = row.FindViewById<TextView>(Resource.Id.TastingNotes);
                TextView    txtDate   = row.FindViewById <TextView>(Resource.Id.Date);
                TextView    txtPrice  = row.FindViewById <TextView>(Resource.Id.Price);
                ImageView   heartImg  = row.FindViewById <ImageView>(Resource.Id.imageButton4);
                ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2);
                //RatingBar rb = row.FindViewById<RatingBar>(Resource.Id.AvgRating);
                heartImg.SetImageResource(Resource.Drawable.heart_empty);
                txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 11);
                txtPrice.SetTextSize(Android.Util.ComplexUnitType.Dip, 11);
                txtName.Text = myItems[position].Name;
                txtYear.Text = myItems[position].Vintage.ToString();
                if (txtYear.Text == null || txtYear.Text == "0")
                {
                    txtYear.Text = "";
                }
                else
                {
                    txtYear.Text = myItems[position].Vintage.ToString();
                }
                //txtDescription.Text = myItems[position].Description;
                txtDate.Text = "Tasted on :" + myItems[position].TastingDate.ToString("yyyy/MM/dd");
                //txtPrice.Text = myItems[position].SalePrice.ToString("C", GridViewAdapter.Cultures.UnitedState);
                txtPrice.Text = myItems[position].PlantFinal.ToString();
                if (txtPrice.Text == "1")
                {
                    txtPrice.Text = "Tasted at :" + " Wall";
                }
                else if (txtPrice.Text == "2")
                {
                    txtPrice.Text = "Tasted at :" + " Pt.Pleasant Beach";
                }
                //rb.Rating = (float)myItems[position].AverageRating;
                //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId);
                ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                string path = pppd.CreateDirectoryForPictures();
                //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                var filePath = System.IO.Path.Combine(path + "/" + myItems[position].Barcode + ".jpg");

                bool count = Convert.ToBoolean(myItems[position].IsLike);
                if (count == true)
                {
                    heartImg.SetImageResource(Resource.Drawable.heart_full);
                }
                else
                {
                    heartImg.SetImageResource(Resource.Drawable.heart_empty);
                }
                heartImg.Tag = position;

                if (convertView == null)
                {
                    heartImg.Click += async delegate
                    {
                        int  actualPosition = Convert.ToInt32(heartImg.Tag);
                        bool x;
                        if (count == false)
                        {
                            heartImg.SetImageResource(Resource.Drawable.heart_full);

                            x     = true;
                            count = true;
                        }
                        else
                        {
                            heartImg.SetImageResource(Resource.Drawable.heart_empty);

                            x     = false;
                            count = false;
                        }
                        SKULike like = new SKULike();
                        like.UserID = Convert.ToInt32(CurrentUser.getUserId());
                        like.SKU    = Convert.ToInt32(myItems[actualPosition].SKU);
                        like.Liked  = x;
                        myItems[actualPosition].IsLike = x;
                        like.BarCode = myItems[actualPosition].Barcode;

                        ServiceWrapper sw = new ServiceWrapper();
                        await sw.InsertUpdateLike(like);
                    };
                }



                Bitmap imageBitmap;
                //if (System.IO.File.Exists(filePath))
                //{
                //	imageBitmap = BitmapFactory.DecodeFile(filePath);
                //	wineimage.SetImageBitmap(imageBitmap);
                //}
                string url = myItems[position].SmallImageUrl;
                if (url == null)
                {
                    url = myItems[position].Barcode + ".jpg";
                }
                imageBitmap = BlobWrapper.Bottleimages(url, myItems[position].PlantFinal);

                if (imageBitmap == null)
                {
                    wineimage.SetImageResource(Resource.Drawable.bottle);
                }
                else
                {
                    wineimage.SetImageBitmap(imageBitmap);
                }
                //wineimage.SetScaleType(ImageView.ScaleType.CenterCrop);


                txtName.Focusable = false;
                txtYear.Focusable = false;
                //txtDescription.Focusable = false;
                txtDate.Focusable              = false;
                txtPrice.Focusable             = false;
                wineimage.Focusable            = false;
                wineimage.FocusableInTouchMode = false;
                wineimage.Clickable            = true;
            }

            LoggingClass.LogInfo("Entered into My tastings Adapter", screenid);
            return(row);
        }
Ejemplo n.º 21
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;


            if (row == null)
            {
                if (myItems.Count == 0)
                {
                    row = LayoutInflater.From(myContext).Inflate(Resource.Layout.EmptyTaste, null, false);

                    TextView te = row.FindViewById <TextView>(Resource.Id.textView123a);
                }
                else
                {
                    row = LayoutInflater.From(myContext).Inflate(Resource.Layout.Dummy, null, false);
                    TextView  Name     = row.FindViewById <TextView>(Resource.Id.textView64);
                    TextView  Comments = row.FindViewById <TextView>(Resource.Id.textView66);
                    TextView  date     = row.FindViewById <TextView>(Resource.Id.textView67);
                    RatingBar rb       = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);

                    ImageView Image = row.FindViewById <ImageView>(Resource.Id.imageButton2);
                    Image.SetScaleType(ImageView.ScaleType.CenterCrop);
                    Button readmore = row.FindViewById <Button>(Resource.Id.btShowmore);
                    readmore.Visibility = ViewStates.Gone;
                    Bitmap imageBitmap = BlobWrapper.ProfileImages(myItems[position].ReviewUserId);
                    if (imageBitmap == null)
                    {
                        Image.SetImageResource(Resource.Drawable.ProfileEmpty);
                    }

                    else
                    {
                        Image.SetImageBitmap(imageBitmap);
                    }
                    ///imageBitmap.Dispose();
                    //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                    //string path = pppd.CreateDirectoryForPictures();
                    ////string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                    ////It's taking lot of time to load user images so giving wine id, after completing compressing image we will give reviewuserid
                    //var filePath = System.IO.Path.Combine(path + "/" + myItems[position].ReviewUserId + ".jpg");
                    //if (System.IO.File.Exists(filePath))
                    //{
                    //    imageBitmap = BitmapFactory.DecodeFile(filePath);
                    //    Image.SetImageBitmap(imageBitmap);
                    //}
                    //else
                    //{
                    //    //It's taking lot of time to load user images so giving wine id, after completing compressing image we will give reviewuserid
                    //    imageBitmap = BlobWrapper.ProfileImages(myItems[position].ReviewUserId);
                    //    if(imageBitmap==null)
                    //    {
                    //        Image.SetImageResource(Resource.Drawable.user1);
                    //    }
                    //    else
                    //    {
                    //    Image.SetImageBitmap(imageBitmap);
                    //    }
                    //}
                    Name.Text      = myItems[position].Username;
                    Name.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
                    Comments.Text  = myItems[position].RatingText;


                    int counnt;

                    counnt = myItems[position].RatingText.Length;// Length();
                    myItems[position].RatingText.Contains('\n');
                    int strcount = countofrepeatedchar(myItems[position].RatingText, '\n');


                    date.Text = myItems[position].Date.ToString("yyyy/MM/dd");
                    rb.Rating = (float)myItems[position].RatingStars;
                    if (strcount >= 3)
                    {
                        readmore.Visibility = ViewStates.Visible;
                        Comments.SetMaxLines(2);
                        readmore.Click += (sender, e) =>
                        {
                            AlertDialog.Builder alert = new AlertDialog.Builder(myContext, Resource.Style.MyDialogTheme);

                            alert.SetMessage(myItems[position].RatingText);
                            alert.SetNegativeButton("Ok", delegate {
                                readmore.Visibility = ViewStates.Visible;
                            });
                            Dialog dialog = alert.Create();
                            dialog.Show();
                        };

                        readmore.Visibility = ViewStates.Visible;
                        //Image.SetImageBitmap(imageBitmap);
                    }
                    else
                    {
                        if (counnt >= 80)
                        {
                            readmore.Visibility = ViewStates.Visible;
                            Comments.SetMaxLines(2);
                            readmore.Click += (sender, e) =>
                            {
                                AlertDialog.Builder alert = new AlertDialog.Builder(myContext, Resource.Style.MyDialogTheme);

                                alert.SetMessage(myItems[position].RatingText);
                                alert.SetNegativeButton("Ok", delegate {
                                    readmore.Visibility = ViewStates.Visible;
                                });
                                Dialog dialog = alert.Create();
                                dialog.Show();
                            };

                            readmore.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            readmore.Visibility = ViewStates.Gone;
                            Comments.Text       = myItems[position].RatingText;
                        }
                    }
                }
            }
            return(row);
        }
Ejemplo n.º 22
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                if (myItems.Count == 0)
                {
                    row = LayoutInflater.From(myContext).Inflate(Resource.Layout.EmptyTaste, null, false);

                    TextView te = row.FindViewById <TextView>(Resource.Id.textView123a);
                }
                else
                {
                    row = LayoutInflater.From(myContext).Inflate(Resource.Layout.ReviewInDetail, null, false);
                    TextView  Name     = row.FindViewById <TextView>(Resource.Id.textView64);
                    TextView  Comments = row.FindViewById <TextView>(Resource.Id.textView66);
                    TextView  date     = row.FindViewById <TextView>(Resource.Id.textView67);
                    RatingBar rb       = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);
                    Image = row.FindViewById <ImageView>(Resource.Id.imageButton2);
                    Image.SetScaleType(ImageView.ScaleType.CenterCrop);
                    Button readmore = row.FindViewById <Button>(Resource.Id.btShowmore);
                    readmore.Visibility = ViewStates.Gone;
                    Bitmap imageBitmap = BlobWrapper.ProfileImages(myItems[position].ReviewUserId);
                    if (imageBitmap == null)
                    {
                        Image.SetImageResource(Resource.Drawable.ProfileEmpty);
                    }
                    else
                    {
                        Image.SetImageBitmap(imageBitmap);
                    }
                    if (convertView == null)
                    {
                        Name.Text      = myItems[position].Username;
                        Name.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
                        Comments.Text  = myItems[position].RatingText;
                        int counnt;
                        counnt = myItems[position].RatingText.Length;// Length();
                        myItems[position].RatingText.Contains('\n');
                        int strcount = countofrepeatedchar(myItems[position].RatingText, '\n');
                        date.Text = myItems[position].Date.ToString("yyyy/MM/dd");
                        rb.Rating = (float)myItems[position].RatingStars;
                        if (strcount >= 2)
                        {
                            readmore.Visibility = ViewStates.Visible;
                            Comments.SetMaxLines(2);
                            readmore.Click += (sender, e) =>
                            {
                                AlertDialog.Builder alert = new AlertDialog.Builder(myContext, Resource.Style.MyDialogTheme);

                                alert.SetMessage(myItems[position].RatingText);
                                alert.SetNegativeButton("Ok", delegate
                                {
                                    readmore.Visibility = ViewStates.Visible;
                                });
                                Dialog dialog = alert.Create();
                                dialog.Show();
                            };

                            readmore.Visibility = ViewStates.Visible;
                            //Image.SetImageBitmap(imageBitmap);
                        }
                        else
                        {
                            if (counnt >= 80)
                            {
                                readmore.Visibility = ViewStates.Visible;
                                Comments.SetMaxLines(2);
                                readmore.Click += (sender, e) =>
                                {
                                    AlertDialog.Builder alert = new AlertDialog.Builder(myContext, Resource.Style.MyDialogTheme);

                                    alert.SetMessage(myItems[position].RatingText);
                                    alert.SetNegativeButton("Ok", delegate
                                    {
                                        //  readmore.Visibility = ViewStates.Visible;
                                    });
                                    Dialog dialog = alert.Create();
                                    dialog.Show();
                                };

                                readmore.Visibility = ViewStates.Visible;
                            }
                            else
                            {
                                readmore.Visibility = ViewStates.Gone;
                                Comments.Text       = myItems[position].RatingText;
                            }
                        }
                    }
                }
            }
            Image.Dispose();
            return(row);
        }
Ejemplo n.º 23
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.MyReviewsCell, null, false);
            }
            //else
            //    return convertView;

            TextView txtName        = row.FindViewById <TextView>(Resource.Id.textView64);
            TextView txtYear        = row.FindViewById <TextView>(Resource.Id.textView65);
            TextView txtDescription = row.FindViewById <TextView>(Resource.Id.textView66);
            TextView txtDate        = row.FindViewById <TextView>(Resource.Id.textView67);
            //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice);
            ImageButton edit      = row.FindViewById <ImageButton>(Resource.Id.imageButton3);
            ImageButton delete    = row.FindViewById <ImageButton>(Resource.Id.imageButton4);
            ImageButton wineimage = row.FindViewById <ImageButton>(Resource.Id.imageButton2);
            RatingBar   rb        = row.FindViewById <RatingBar>(Resource.Id.rating);

            //edit.SetScaleType(ImageView.ScaleType.Center);
            //delete.SetScaleType(ImageView.ScaleType.Center);
            //edit.SetImageResource(Resource.Drawable.edit);
            //delete.SetImageResource(Resource.Drawable.delete);
            edit.Focusable = false;
            //edit.FocusableInTouchMode = false;
            edit.Clickable   = true;
            delete.Focusable = false;
            //delete.FocusableInTouchMode = false;
            delete.Clickable               = true;
            wineimage.Focusable            = false;
            wineimage.FocusableInTouchMode = false;
            wineimage.Clickable            = true;
            //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice);
            //ImageView imgWine = row.FindViewById<ImageView>(Resource.Id.imgWine);
            //edit.SetTag(1, 5757);
            edit.Click += (sender, args) => {
                int    WineId  = myItems[position].WineId;
                Review _review = new Review();
                _review.WineId      = WineId;
                _review.RatingStars = myItems[position].RatingStars;
                _review.RatingText  = myItems[position].RatingText;
                PerformItemClick(sender, args, _review);
            };
            //delete.Click += Delete_Click;
            delete.Click += (sender, args) => {
                int    WineId  = myItems[position].WineId;
                Review _review = new Review();
                _review.WineId = WineId;

                PerformdeleteClick(sender, args, _review);
            };
            wineimage.Click += (sender, args) => Console.WriteLine("ImageButton {0} clicked", position);
            txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
            txtName.Text = myItems[position].Name;
            // txtName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
            // txtPrice.Text= myItems[position].
            txtYear.Text             = myItems[position].Vintage;
            txtDescription.Text      = myItems[position].RatingText;
            txtDescription.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
            txtDate.Text             = myItems[position].Date.ToString("dd/MM/yyyy");
            rb.Rating = myItems[position].RatingStars;
            //Bitmap imageBitmap = bvb.Bottleimages(myItems[position].WineId);
            ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            string path = pppd.CreateDirectoryForPictures();
            //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var    filePath = System.IO.Path.Combine(path + "/" + myItems[position].WineId + ".jpg");
            Bitmap imageBitmap;

            if (System.IO.File.Exists(filePath))
            {
                imageBitmap = BitmapFactory.DecodeFile(filePath);
                wineimage.SetImageBitmap(imageBitmap);
            }
            else
            {
                imageBitmap = BlobWrapper.Bottleimages(myItems[position].WineId);

                wineimage.SetImageBitmap(imageBitmap);
            }
            //wineimage.SetImageBitmap(imageBitmap);
            //wineimage.SetImageResource(Resource.Drawable.wine7);
            wineimage.SetScaleType(ImageView.ScaleType.CenterCrop);

            txtName.Focusable        = false;
            txtYear.Focusable        = false;
            txtDescription.Focusable = false;
            txtDate.Focusable        = false;



            return(row);
        }
Ejemplo n.º 24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CheckInternetConnection();
            Stopwatch st = new Stopwatch();

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

            TaskA.Start();
            //checking user id's exist or not.
            if ((CurrentUser.getUserId() != null || CurrentUser.getUserId() != "0") && (CurrentUser.getUserId() != null))
            {
                IntoApp();
            }
            else if (CurrentUser.GetGuestId() != null || CurrentUser.getUserId() == "0")
            {
                IntoApp();
            }
            else
            {
                //if (CurrentUser.GetCardNumber() != null)
                //{
                //    Preinfo(CurrentUser.GetCardNumber());
                //}
                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";// "900497354894";//await scanner.Scan();

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

                BtnGuestLogin.Click += async delegate
                {
                    Intent intent = new Intent(this, typeof(Login));
                    ProgressIndicator.Show(this);
                    LoggingClass.LogInfo("User Tried to login with Guest Login ", screenid);
                    StartActivity(intent);
                    CustomerResponse csr = new CustomerResponse();
                    csr = await svc.InsertUpdateGuest("Didn't get the token");

                    CurrentUser.SaveGuestId(csr.customer.CustomerID.ToString());
                };
                TxtScanresult             = FindViewById <TextView>(Resource.Id.txtScanresult);
                Txtem                     = FindViewById <TextView>(Resource.Id.textV);
                BtnLogin                  = FindViewById <Button>(Resource.Id.btnLogin);
                txtmail                   = FindViewById <EditText>(Resource.Id.txtmail);
                BtnResend                 = FindViewById <Button>(Resource.Id.btnResend);
                update                    = FindViewById <Button>(Resource.Id.btnUpdateEmailclick);
                BtnContinue               = FindViewById <Button>(Resource.Id.btnContinue);
                BtnUpdateEmail            = FindViewById <Button>(Resource.Id.btnUpdateEmail);
                BtnResend.Visibility      = ViewStates.Gone;
                update.Visibility         = ViewStates.Gone;
                BtnLogin.Visibility       = ViewStates.Gone;
                BtnContinue.Visibility    = ViewStates.Gone;
                BtnUpdateEmail.Visibility = ViewStates.Gone;
                txtmail.Visibility        = ViewStates.Gone;
                Txtem.Visibility          = ViewStates.Gone;
                if (IsPlayServicesAvailable())
                {
                    var TaskB = new System.Threading.Tasks.Task(() =>
                    {
                        var intent = new Intent(this, typeof(RegistrationIntentService));
                        StartService(intent);
                    });
                    TaskB.Start();
                }
                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);
                BtnScanner.Dispose();
            }
        }
Ejemplo n.º 25
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.ListView, null, false);
            }
            //else
            //    return row;

            TextView txtName = row.FindViewById <TextView>(Resource.Id.txtName);

            TextView  txtVintage = row.FindViewById <TextView>(Resource.Id.txtVintage);
            TextView  AmountLeft = row.FindViewById <TextView>(Resource.Id.txtAmountLeft);
            TextView  txtPrice   = row.FindViewById <TextView>(Resource.Id.txtPrice);
            ImageView imgWine    = row.FindViewById <ImageView>(Resource.Id.imgWine);
            ImageView buy        = row.FindViewById <ImageView>(Resource.Id.imgHeart1);

            //buy.Click += delegate
            //{
            //    ProgressIndicator.Show(myContext);
            //    var intent = new Intent(myContext, typeof(Wineoutletweb));
            //    intent.PutExtra("WineBarcode", WineBarcode);
            //    StartActivity(intent);
            //};
            ImageView heartImg = row.FindViewById <ImageView>(Resource.Id.imgHeart);
            RatingBar rating   = row.FindViewById <RatingBar>(Resource.Id.rtbProductRating);

            rating.Rating   = (float)myItems[position].AverageRating;
            txtName.Text    = myItems[position].Name;
            txtPrice.Text   = myItems[position].SalePrice.ToString("C", Cultures.UnitedState);
            AmountLeft.Text = "Wine left in bottle: " + myItems[position].AvailableVolume.ToString() + " ml";
            txtVintage.Text = myItems[position].Vintage.ToString();
            if (txtVintage.Text == "0" || txtVintage.Text == null)
            {
                txtVintage.Text = "";
            }
            else
            {
                txtVintage.Text = myItems[position].Vintage.ToString();
            }
            heartImg.SetImageResource(Resource.Drawable.heart_empty);
            //var heartLP = new FrameLayout.LayoutParams(80, 80);
            //var metrics = myContext.Resources.DisplayMetrics;
            //var widthInDp = ConvertPixelsToDp(metrics.WidthPixels);
            //var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);
            //heartLP.LeftMargin = parent.Resources.DisplayMetrics.WidthPixels / 2 - 110; // 110 = 80 + 30
            //heartLP.TopMargin = 5;
            //heartImg.LayoutParameters = heartLP;
            //heartImg.Layout(50, 50, 50, 50);

            bool count = Convert.ToBoolean(myItems[position].IsLike);

            if (count == true)
            {
                heartImg.SetImageResource(Resource.Drawable.heart_full);
            }
            else
            {
                heartImg.SetImageResource(Resource.Drawable.heart_empty);
            }
            heartImg.Tag = position;

            if (convertView == null)
            {
                buy.Click += delegate
                {
                    ProgressIndicator.Show(myContext);
                    var    intent = new Intent(myContext, typeof(Wineoutletweb));
                    string sku    = myItems[position].SKU;
                    intent.PutExtra("sku", sku);
                    intent.PutExtra("Val", "1");
                    myContext.StartActivity(intent);
                };
                heartImg.Click +=
                    delegate
                {
                    if (CurrentUser.GetGuestId() != null || CurrentUser.getUserId() == "0")
                    {
                        AlertDialog.Builder aler = new AlertDialog.Builder(myContext, Resource.Style.MyDialogTheme);
                        aler.SetTitle("Sorry");
                        aler.SetMessage("This Feature is available for VIP Users only");
                        //aler.SetNegativeButton("KnowMore", delegate
                        //{
                        //    var uri = Android.Net.Uri.Parse("https://hangoutz.azurewebsites.net/index.html");
                        //    var intent = new Intent(Intent.ActionView, uri);
                        //    StartActivity(intent);



                        //});
                        aler.SetNegativeButton("Ok", delegate
                        {
                            LoggingClass.LogInfo("Closed PoPup", screenid);
                        });
                        Dialog dialog1 = aler.Create();
                        dialog1.Show();
                    }
                    else
                    {
                        int  actualPosition = Convert.ToInt32(heartImg.Tag);
                        bool x;
                        if (count == false)
                        {
                            heartImg.SetImageResource(Resource.Drawable.heart_full);

                            x     = true;
                            count = true;
                        }
                        else
                        {
                            heartImg.SetImageResource(Resource.Drawable.heart_empty);

                            x     = false;
                            count = false;
                        }
                        var TaskA = new System.Threading.Tasks.Task(async() =>
                        {
                            SKULike like = new SKULike();
                            like.UserID  = Convert.ToInt32(CurrentUser.getUserId());
                            like.SKU     = Convert.ToInt32(myItems[actualPosition].SKU);
                            like.Liked   = x;
                            myItems[actualPosition].IsLike = x;
                            like.BarCode = myItems[actualPosition].Barcode;
                            //LoggingClass.LogInfo("Liked an item", screenid);
                            ServiceWrapper sw = new ServiceWrapper();
                            await sw.InsertUpdateLike(like);
                        });
                        TaskA.Start();
                    }
                };

                // }
            }


            Bitmap imageBitmap;
            string url = myItems[position].SmallImageUrl;

            if (url == null || url == "")
            {
                url = myItems[position].Barcode + ".jpg";
            }
            imageBitmap = BlobWrapper.Bottleimages(url, storeid);
            //var place = new RelativeLayout.LayoutParams(650, 650);

            ////-650 + (parent.Resources.DisplayMetrics.WidthPixels - imageBitmap.Width) / 2;
            //	imgWine.LayoutParameters = place;
            //var place1 = new FrameLayout.LayoutParams(600, 500);

            ////-650 + (parent.Resources.DisplayMetrics.WidthPixels - imageBitmap.Width) / 2;
            //imgWine.LayoutParameters = place1;
            if (imageBitmap != null)
            {
                //		if (heartLP.LeftMargin <= 250)
                //		{
                //			place.LeftMargin = -140;
                float ratio = (float)400 / imageBitmap.Height;
                imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 400, true);
                //		}
                //		else
                //		{
                //			place.LeftMargin = -70;
                //			float ratio = (float)650 / imageBitmap.Height;
                //			imageBitmap = Bitmap.CreateScaledBitmap(imageBitmap, Convert.ToInt32(imageBitmap.Width * ratio), 650, true);
                //		}


                imgWine.SetImageBitmap(imageBitmap);
            }
            else
            {
                //if (heartLP.LeftMargin <= 250)
                //{
                //	place.LeftMargin = -140;
                //	imgWine.SetImageResource(Resource.Drawable.bottle);
                //}
                //else
                //{
                //	place.LeftMargin = -70;
                imgWine.SetImageResource(Resource.Drawable.bottle);
            }


            txtName.Focusable    = false;
            AmountLeft.Focusable = false;
            txtVintage.Focusable = false;
            txtPrice.Focusable   = false;
            imgWine.Focusable    = false;
            imgWine.Dispose();
            //imageBitmap.Dispose();
            return(row);
        }