예제 #1
0
        private void BindGridData()
        {
            int StoreId = 0;

            if (StoreName == "Wall Store")
            {
                StoreId = 1;
            }
            else if (StoreName == "Point Pleasant Store")
            {
                StoreId = 2;
            }
            else
            {
                StoreId = 3;
            }
            try
            {
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = sw.GetItemList(StoreId, userId).Result;

                List <Item> myArr = output.ItemList.ToList();
                LoggingClass.LogInfo("entered into " + StoreName, screenid);
                var gridview = FindViewById <GridView>(Resource.Id.gridview);
                adapter = new GridViewAdapter(this, myArr, StoreId);
                LoggingClass.LogInfoEx("Entered into Grid View Adapter", screenid);
                gridview.SetNumColumns(2);
                gridview.Adapter = adapter;

                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    WineBarcode = myArr[args.Position].Barcode;
                    // ProgressIndicator.Show(this);
                    AndHUD.Shared.Show(this, "Loading...", Convert.ToInt32(MaskType.Clear));
                    var intent = new Intent(this, typeof(DetailViewActivity));
                    LoggingClass.LogInfo("Clicked on " + myArr[args.Position].Barcode + " to enter into wine details", screenid);
                    intent.PutExtra("WineBarcode", WineBarcode);
                    intent.PutExtra("storeid", StoreId);
                    StartActivity(intent);
                };
                //TokenModel devInfo = new TokenModel();
                //var activityManager = (ActivityManager)this.GetSystemService(Context.ActivityService);

                //ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
                //activityManager.GetMemoryInfo(memInfo);

                //System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Avail {0} - {1} MB", memInfo.AvailMem, memInfo.AvailMem / 1024 / 1024);
                //System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Low {0}", memInfo.LowMemory);
                //System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Total {0} - {1} MB", memInfo.TotalMem, memInfo.TotalMem / 1024 / 1024);

                //devInfo.AvailableMainMemory = memInfo.AvailMem;
                //devInfo.IsLowMainMemory = memInfo.LowMemory;
                //devInfo.TotalMainMemory = memInfo.TotalMem;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
        }
예제 #2
0
        private void BindGridData()
        {
            int StoreId = 0;

            if (StoreName == AppConstants.WallStore)
            {
                StoreId = 1;
            }
            else if (StoreName == AppConstants.PointPleasantStore)
            {
                StoreId = 2;
            }
            else if (StoreName == AppConstants.SecaucusStore)
            {
                StoreId = 3;
            }
            try
            {
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = sw.GetItemList(StoreId, userId).Result;

                List <Item> myArr = output.ItemList.ToList();
                if (myArr.Count == 0)
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this);
                    aler.SetTitle("Secaucus Store");
                    aler.SetMessage("Coming Soon!");
                    aler.SetNegativeButton("Ok", delegate {
                        var intent = new Intent(this, typeof(Login));
                        StartActivity(intent);
                    });
                    LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                    Dialog dialog = aler.Create();
                    dialog.Show();
                }
                LoggingClass.LogInfo("entered into " + StoreName, screenid);
                var gridview = FindViewById <GridView>(Resource.Id.gridview);
                adapter = new GridViewAdapter(this, myArr, StoreId);
                LoggingClass.LogInfoEx("Entered into Grid View Adapter", screenid);
                gridview.SetNumColumns(2);
                gridview.Adapter    = adapter;
                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    WineBarcode = myArr[args.Position].Barcode;
                    ProgressIndicator.Show(this);
                    var intent = new Intent(this, typeof(DetailViewActivity));
                    LoggingClass.LogInfo("Clicked on " + myArr[args.Position].Barcode + " to enter into wine details", screenid);
                    intent.PutExtra("WineBarcode", WineBarcode);
                    StartActivity(intent);
                };
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
        }
        public async void SendRegistrationToAppServer(string token)
        {
            TokenModel _token = new TokenModel()
            {
                User_id     = Convert.ToInt32(CurrentUser.getUserId()),
                DeviceToken = token,
                DeviceType  = 1
            };

            LoggingClass.LogInfoEx("Token sent to db", screenid);
            int x = await svc.InsertUpdateToken1(_token);
        }
예제 #4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.DeleteReviewPop, container, false);

            LoggingClass.LogInfo("Entered into Delete review popup with" + WineBarcode, screenid);
            ServiceWrapper sw     = new ServiceWrapper();
            Review         review = new Review();
            Button         Delete = view.FindViewById <Button>(Resource.Id.button1);
            Button         Cancel = view.FindViewById <Button>(Resource.Id.button2);

            try
            {
                Delete.Click += async delegate
                {
                    AndHUD.Shared.Show(Parent, "Deleting  Review...", Convert.ToInt32(MaskType.Clear));
                    review.Barcode = WineBarcode;
                    // ProgressIndicator.Show(Parent);
                    review.ReviewUserId = Convert.ToInt32(CurrentUser.getUserId());

                    await sw.DeleteReview(review);

                    ((IPopupParent)Parent).RefreshParent();
                    ProgressIndicator.Hide();
                    myDialog.Dismiss();
                    AndHUD.Shared.Dismiss();
                    AndHUD.Shared.ShowSuccess(Parent, "Sucessfully Deleted", MaskType.Clear, TimeSpan.FromSeconds(2));

                    LoggingClass.LogInfoEx("User deleted winereview" + WineBarcode + "from " + review.PlantFinal + "st Store", screenid);
                };
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            Cancel.Click += delegate
            {
                LoggingClass.LogInfo("clicked on cancel" + WineBarcode + review.PlantFinal, screenid);
                myDialog.Dismiss();
            };
            st.Stop();
            LoggingClass.LogTime("Deletereview time", st.Elapsed.TotalSeconds.ToString());
            return(view);
        }
        public async void EmailVerification(Boolean Load)
        {
            if (Load == true)
            {
                AndHUD.Shared.Show(this, "Checking Email Verification", Convert.ToInt32(MaskType.Clear));
            }
            DeviceToken DO = new DeviceToken();

            try
            {
                //  DO = await svc.CheckMail(AuthServ.customer.CustomerID.ToString());
                DO = await svc.CheckMail(CurrentUser.GetInternalCustometID());

                if (DO.VerificationStatus == 1)
                {
                    //  if (AuthServ.customer != null && AuthServ.customer.CustomerID != 0)
                    if (CurrentUser.GetInternalCustometID() != null && Convert.ToInt32(CurrentUser.GetInternalCustometID()) != 0)
                    {
                        // LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.getUserId(), screenid);

                        SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                        // CurrentUser.SavePrefered(AuthServ.customer.PreferredStore);
                        int storename = Convert.ToInt32(CurrentUser.GetPrefered());///AuthServ.customer.PreferredStore;
                        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 if (storename == 3)
                        {
                            Intent intent = new Intent(this, typeof(GridViewActivity));
                            intent.PutExtra("MyData", AppConstants.SecaucusStore);

                            ProgressIndicator.Show(this);
                            StartActivity(intent);
                        }
                        else
                        {
                            Intent intent = new Intent(this, typeof(Login));
                            ProgressIndicator.Show(this);
                            StartActivity(intent);
                        }
                        LoggingClass.LogInfoEx("User verified and Logging" + "---->" + CurrentUser.GetCardNumber(), screenid);
                        AndHUD.Shared.Dismiss();
                        AndHUD.Shared.ShowSuccess(Parent, "Success!", MaskType.Clear, TimeSpan.FromSeconds(2));
                    }
                    else
                    {
                        AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                        aler.SetTitle("Sorry");
                        aler.SetMessage("You entered wrong details or authentication failed");
                        aler.SetNegativeButton("Ok", delegate { });
                        Dialog dialog1 = aler.Create();
                        dialog1.Show();
                    };
                }
                else
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    aler.SetMessage("Your email is not verified. please check email and verify.");
                    aler.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = aler.Create();
                    dialog.Show();
                }
                AndHUD.Shared.Dismiss();
            }

            catch (Exception exe)
            {
                AndHUD.Shared.Dismiss();
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            AndHUD.Shared.Dismiss();
            //BtnLogin.Dispose();
            //BtnResend.Dispose();
            //BtnContinue.Dispose();
            //BtnUpdateEmail.Dispose();
            //update.Dispose();
        }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
0
        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);
            uid = Convert.ToInt32(CurrentUser.getUserId());
            try
            {
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ServiceWrapper     svc        = new ServiceWrapper();
                ItemReviewResponse uidreviews = new ItemReviewResponse();
                uidreviews = svc.GetItemReviewUID(uid).Result;
                List <Review> myArr1;
                myArr1 = uidreviews.Reviews.ToList();
                int c = uidreviews.Reviews.Count;
                if (c == 0)
                {
                    var data = svc.GetMyTastingsList(uid).Result;


                    SetContentView(Resource.Layout.ReviewEmpty);
                    txtName = FindViewById <TextView>(Resource.Id.textView1);
                    if (data.TastingList.Count != 0)
                    {
                        txtName.Text = "You have tasted " + data.TastingList.Count + " wines.\n We would love to hear your feedback.";
                    }
                    else
                    {
                        txtName.Text = "Please taste and then review.";
                    }
                    Imag = FindViewById <ImageView>(Resource.Id.imageView1);
                    var TaskA = new System.Threading.Tasks.Task(() =>
                    {
                        Imag.SetImageResource(Resource.Drawable.ReviewIns);
                    });
                    TaskA.Start();
                }
                else
                {
                    SetContentView(Resource.Layout.MyReviews);
                    var             wineList  = FindViewById <ListView>(Resource.Id.listView1);
                    Review          edit      = new Review();
                    ReviewPopup     editPopup = new ReviewPopup(this, edit);
                    MyReviewAdapter adapter   = new MyReviewAdapter(this, myArr1);
                    wineList.Adapter = adapter;

                    wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                    {
                        string WineBarcode = myArr1[args.Position].Barcode;
                        int    storeID     = Convert.ToInt32(myArr1[args.Position].PlantFinal);
                        LoggingClass.LogInfoEx("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine details From ReviewAct", screenid);
                        ProgressIndicator.Show(this);
                        //AndHUD.Shared.Show(this, "Loading...", Convert.ToInt32(MaskType.Clear));
                        var intent = new Intent(this, typeof(DetailViewActivity));
                        intent.PutExtra("WineBarcode", WineBarcode);
                        intent.PutExtra("storeid", storeID);
                        StartActivity(intent);
                    };

                    LoggingClass.LogInfo("Entered into My Review", screenid);
                }
                ProgressIndicator.Hide();
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                AndHUD.Shared.Dismiss();
                ProgressIndicator.Hide();
                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();
            }
            st.Stop();
            LoggingClass.LogTime("Reviewactivity", st.Elapsed.TotalSeconds.ToString());
        }
예제 #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);
        }
예제 #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);
        }
예제 #11
0
        public async void EmailVerification()
        {
            int count = 0;

            if (count == 0)
            {
                AndHUD.Shared.Show(this, "Checking Email Verification", Convert.ToInt32(MaskType.Clear));
                AuthServ = await svc.AuthencateUser("test", CurrentUser.GetCardNumber(), CurrentUser.GetDeviceID());

                DeviceToken DO = new DeviceToken();
                try
                {
                    DO = await svc.CheckMail(AuthServ.customer.CustomerID.ToString());

                    if (DO.VerificationStatus == 1)
                    {
                        if (AuthServ.customer != null && AuthServ.customer.CustomerID != 0)
                        {
                            LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.getUserId(), screenid);
                            CurrentUser.SaveUserName(AuthServ.customer.FirstName + AuthServ.customer.LastName, AuthServ.customer.CustomerID.ToString());
                            SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                            CurrentUser.SavePrefered(AuthServ.customer.PreferredStore);
                            int storename = AuthServ.customer.PreferredStore;
                            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);
                            }
                            LoggingClass.LogInfoEx("User verified and Logging" + "---->" + CurrentUser.GetCardNumber(), screenid);
                            AndHUD.Shared.Dismiss();
                            AndHUD.Shared.ShowSuccess(Parent, "Success!", MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        else
                        {
                            int count12 = 0;
                            if (count12 == 0)
                            {
                                AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                                aler.SetTitle("Sorry");
                                aler.SetMessage("You entered wrong details or authentication failed");
                                aler.SetNegativeButton("Ok", delegate { });
                                Dialog dialog1 = aler.Create();
                                dialog1.Show();
                                //   AndHUD.Shared.ShowErrorWithStatus(this, "You entered wrong details or authentication failed", MaskType.Clear, TimeSpan.FromSeconds(2));
                            }
                            count12 = 1;
                        };
                    }
                    else
                    {
                        AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                        //aler.SetTitle("Sorry");
                        aler.SetMessage("Your email is not verified. please check email and verify.");
                        aler.SetNegativeButton("Ok", delegate { });
                        Dialog dialog = aler.Create();
                        dialog.Show();
                        //  AndHUD.Shared.ShowErrorWithStatus(this, "Your email is not verified plesase check email and verify.", MaskType.Clear, TimeSpan.FromSeconds(2));
                    }
                    //ProgressIndicator.Hide();
                    AndHUD.Shared.Dismiss();
                }

                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                }
                AndHUD.Shared.Dismiss();
            }
            count = 1;
        }