Exemplo n.º 1
0
        public void RefreshParent()
        {
            ServiceWrapper svc = new ServiceWrapper();

            var             uidreviews = svc.GetItemReviewUID(uid).Result;
            ListView        wineList   = FindViewById <ListView>(Resource.Id.listView1);
            Review          edit       = new Review();
            ReviewPopup     editPopup  = new ReviewPopup(this, edit);
            MyReviewAdapter adapter    = new MyReviewAdapter(this, uidreviews.Reviews.ToList());

            //adapter.Edit_Click += editPopup.EditPopup;

            wineList.Adapter = adapter;
            adapter.NotifyDataSetChanged();
        }
Exemplo n.º 2
0
        private void BindGridData()
        {
            try
            {
                ServiceWrapper svc = new ServiceWrapper();

                var MYtastings = svc.GetMyTastingsList(customerid).Result;
                myArr1 = MYtastings.TastingList.ToList();

                ListView wineList = FindViewById <ListView>(Resource.Id.MyTasting);
                wineList.Clickable = true;

                MyTastingAdapter adapter = new MyTastingAdapter(this, MYtastings.TastingList.ToList());
                wineList.Adapter    = adapter;
                wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    string WineBarcode = myArr1[args.Position].Barcode;
                    int    storeID     = myArr1[args.Position].PlantFinal;
                    LoggingClass.LogInfo("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine from tasting  details", 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);
                };
                ProgressIndicator.Hide();
                AndHUD.Shared.Dismiss();

                //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());
            }
        }
Exemplo n.º 3
0
        public void CreatePopup(object sender, RatingBar.RatingBarChangeEventArgs e)
        {
            //e.Rating

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

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

            custRating.Rating = rat;


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

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

                ((IPopupParent)Parent).RefreshParent();
                editDialog.Dismiss();
            };
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        public void RefreshParent()
        {
            ServiceWrapper svc    = new ServiceWrapper();
            int            wineid = Intent.GetIntExtra("WineID", 138);


            ItemDetailsResponse myData = svc.GetItemDetails(wineid).Result;
            var SkuRating = svc.GetItemReviewsByWineID(wineid).Result;

            this.Title = "Wine Details";



            var commentsView = FindViewById <ListView>(Resource.Id.listView2);

            reviewAdapter comments = new reviewAdapter(this, SkuRating.Reviews.ToList());

            commentsView.Adapter = comments;
            comments.NotifyDataSetChanged();
        }
Exemplo n.º 6
0
        public void RefreshParent()
        {
            ServiceWrapper  svc        = new ServiceWrapper();
            var             uidreviews = svc.GetItemReviewUID(uid).Result;
            ListView        wineList   = FindViewById <ListView>(Resource.Id.listView1);
            Review          edit       = new Review();
            ReviewPopup     editPopup  = new ReviewPopup(this, edit);
            MyReviewAdapter adapter    = new MyReviewAdapter(this, uidreviews.Reviews.ToList());
            //adapter.Edit_Click += editPopup.EditPopup;
            int c = uidreviews.Reviews.Count;

            if (c == 0)
            {
                SetContentView(Resource.Layout.ReviewEmpty);
                txtName = FindViewById <TextView>(Resource.Id.textView1);
                Imag    = FindViewById <ImageView>(Resource.Id.imageView1);
            }
            wineList.Adapter = adapter;
            adapter.NotifyDataSetChanged();
        }
Exemplo n.º 7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Landscape);
            HorizontalScrollView hsw = FindViewById <HorizontalScrollView>(Resource.Id.HorizontalScrollView1);
            int            StoreId   = 2;
            int            userId    = Convert.ToInt32(CurrentUser.getUserId());
            List <Item>    myArr;
            ServiceWrapper sw     = new ServiceWrapper();
            var            output = sw.GetItemList(StoreId, userId).Result;

            myArr = output.ItemList.ToList();
            var gridview = FindViewById <GridView>(Resource.Id.gridview);
            HorizontalViewAdapter adapter = new HorizontalViewAdapter(this, myArr);

            gridview.SetNumColumns(myArr.Count);
            gridview.Adapter = adapter;
            //ListView lv = FindViewById<ListView>(Resource.Id.listView1);
            //lv.Adapter=adapter;
        }
Exemplo n.º 8
0
        protected override void OnCreate(Bundle bundle)
        {
            if (StoreName == "")
            {
                StoreName = Intent.GetStringExtra("MyData");
            }
            this.Title = StoreName;

            int StoreId = 1;
            //if (StoreName == "Wall Store")
            //    StoreId = 1;
            //else if (StoreName == "Point Pleasent Store")
            //    StoreId = 2;
            //else
            //    StoreId = 3;
            int            userId = Convert.ToInt32(CurrentUser.getUserId());
            ServiceWrapper sw     = new ServiceWrapper();
            var            output = sw.GetItemList(StoreId, userId).Result;

            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Potrait);
            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            List <Item> myArr;

            myArr = output.ItemList.ToList();
            ListView       wineList = FindViewById <ListView>(Resource.Id.listView1);
            PotraitAdapter adapter  = new PotraitAdapter(this, myArr);

            wineList.Adapter    = adapter;
            wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                var intent = new Intent(this, typeof(detailViewActivity));
                StartActivity(intent);
            };
        }
Exemplo n.º 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            customerid = Convert.ToInt32(CurrentUser.getUserId());

            SetContentView(Resource.Layout.MyTasting);
            try
            {
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);

                ServiceWrapper svc = new ServiceWrapper();

                var MYtastings = svc.GetMyTastingsList(customerid).Result;

                List <Tastings> myArr;

                //  myArr1 = SampleData1();

                ListView wineList = FindViewById <ListView>(Resource.Id.MyTasting);
                // myArr1 = SampleData1();
                MyTastingAdapter adapter = new MyTastingAdapter(this, MYtastings.TastingList.ToList());
                wineList.Adapter = adapter;
                ProgressIndicator.Hide();
            }

            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();
            }
        }
Exemplo n.º 10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ProfileCell);
            int userId = Convert.ToInt32(CurrentUser.getUserId());

            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ServiceWrapper sw     = new ServiceWrapper();
            var            output = sw.GetCustomerDetails(userId).Result;

            RefreshParent();
            if (CurrentUser.getUserId() == "0" || CurrentUser.getUserId() == null)
            {
                AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                aler.SetTitle("Sorry");
                aler.SetMessage("This feature is available only  for VIP Users");
                aler.SetPositiveButton("Log in", delegate
                {
                    string str = null;
                    CurrentUser.SaveGuestId(str);
                    var intent = new Intent(this, typeof(LoginActivity));
                    StartActivity(intent);
                });
                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.SetNeutralButton("Cancel", delegate
                {
                    var intent = new Intent(this, typeof(Login));
                    StartActivity(intent);
                });
                Dialog dialog1 = aler.Create();
                dialog1.Show();
            }

            try
            {
                propicimage = FindViewById <ImageView>(Resource.Id.user_profile_photo);
                TextView  Name      = FindViewById <TextView>(Resource.Id.user_profile_name);
                TextView  Email     = FindViewById <TextView>(Resource.Id.user_profile_short_bio);
                TextView  Mobile    = FindViewById <TextView>(Resource.Id.user_mobile);
                TextView  Address   = FindViewById <TextView>(Resource.Id.user_Address);
                TextView  PinCode   = FindViewById <TextView>(Resource.Id.user_Zip);
                TextView  Preferrd  = FindViewById <TextView>(Resource.Id.user_Preferred);
                TextView  State     = FindViewById <TextView>(Resource.Id.user_State);
                TextView  Card      = FindViewById <TextView>(Resource.Id.user_Card);
                TextView  Expiry    = FindViewById <TextView>(Resource.Id.User_expiry);
                Button    Drop      = FindViewById <Button>(Resource.Id.drop_down_option_menu);
                ImageView ChangePRo = FindViewById <ImageView>(Resource.Id.add_friend);

                ChangePRo.Click += delegate
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    aler.SetTitle("Please choose an option to upload profile picture");
                    aler.SetPositiveButton("Gallery", delegate
                    {
                        Intent = new Intent();
                        Intent.SetType("image/*");
                        Intent.SetAction(Intent.ActionGetContent);
                        StartActivityForResult(Intent.CreateChooser(Intent, "Select Picture"), PickImageId);
                    });

                    aler.SetNegativeButton("Camera", delegate
                    {
                        if (IsThereAnAppToTakePictures())
                        {
                            CreateDirectoryForPictures();
                            TakeAPicture();
                        }
                    });
                    aler.SetNeutralButton("Cancel", delegate
                    {
                    });
                    Dialog dialog1 = aler.Create();
                    dialog1.Show();
                };
                // Boolean indirect = true;
                if (indirect == true)
                {
                    System.Threading.Timer timer = null;
                    timer = new System.Threading.Timer((obj) =>
                    {
                        DownloadAsync(this, System.EventArgs.Empty);

                        timer.Dispose();
                    },
                                                       null, 2000, System.Threading.Timeout.Infinite);
                }
                else
                {
                    DownloadAsync(this, System.EventArgs.Empty);
                }
                Drop.Click += (s, arg) =>
                {
                    Intent intent = new Intent(this, typeof(ProfileActivity));
                    ProgressIndicator.Show(this);
                    StartActivity(intent);
                    //PopupMenu menu = new PopupMenu(this, Drop);
                    //menu.Inflate(Resource.Drawable.options_menu_1);
                    //menu.Show();
                };
                string First = output.customer.FirstName;
                string Last  = output.customer.LastName;
                Name.Text = string.Concat(First, Last);
                Card.Text = output.customer.CardNumber.ToString();

                Email.Text = output.customer.Email;

                PinCode.Text  = output.customer.Zip.ToString();
                Preferrd.Text = output.customer.PreferredStore.ToString();
                if (Preferrd.Text == "0")
                {
                    Preferrd.Text = "-Select your preferred store-";
                }
                else if (Preferrd.Text == "1")

                {
                    Preferrd.Text = AppConstants.WallStore;
                }
                else if (Preferrd.Text == "2")
                {
                    Preferrd.Text = AppConstants.PointPleasantStore;
                }
                else
                {
                    Preferrd.Text = AppConstants.SecaucusStore;
                }

                State.Text  = output.customer.State;
                Expiry.Text = output.customer.ExpireDate.ToString();
                string Addres2 = output.customer.Address2;
                string Addres1 = output.customer.Address1;
                Address.Text = string.Concat(Addres1, Addres2);
                string phno1 = output.customer.PhoneNumber;
                string phno2 = output.customer.Phone2;
                if (phno1 != null)
                {
                    Mobile.Text = phno1;
                }
                else
                {
                    Mobile.Text = phno2;
                }
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            ProgressIndicator.Hide();
        }
Exemplo n.º 11
0
 public void RefreshParent()
 {
     ServiceWrapper svc    = new ServiceWrapper();
     int            userId = Convert.ToInt32(CurrentUser.getUserId());
     var            output = svc.GetCustomerDetails(userId).Result;
 }
        public void Internal_ViewDidLoad()
        {
            try
            {
                WineBarcode = Intent.GetStringExtra("WineBarcode");
                storeid     = Intent.GetIntExtra("storeid", 1);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ServiceWrapper svc = new ServiceWrapper();
                myData = new ItemDetailsResponse();
                ItemReviewResponse SkuRating = new ItemReviewResponse();
                this.Title = "Wine Details";
                try
                {
                    DownloadAsync(this, System.EventArgs.Empty, WineBarcode);
                    myData      = svc.GetItemDetails(WineBarcode, storeid).Result;
                    SkuRating   = svc.GetItemReviewsByWineBarcode(WineBarcode).Result;
                    ReviewArray = SkuRating.Reviews.ToList();
                    var tempReview = SkuRating.Reviews.ToList().Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId()));
                    if (tempReview != null)
                    {
                        editPopup._editObj.RatingText = tempReview.RatingText;
                    }
                    comments = new reviewAdapter(this, ReviewArray);
                    if (comments.Count == 0)
                    {
                        ErrorDescription.Visibility = ViewStates.Visible;
                        ErrorDescription.Text       = SkuRating.ErrorDescription;
                        ErrorDescription.SetTextColor(Android.Graphics.Color.Black);
                    }
                    else
                    {
                        commentsview.Adapter = comments;
                    }
                    setListViewHeightBasedOnChildren1(commentsview);
                    WineName.Text = myData.ItemDetails.Name;

                    WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
                    Vintage.Text       = myData.ItemDetails.Vintage.ToString();
                    if (Vintage.Text == null || Vintage.Text == "0")
                    {
                        Vintage.Text = "";
                    }
                    else
                    {
                        Vintage.Text = myData.ItemDetails.Vintage.ToString();
                    }
                    if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "")
                    {
                        WineProducer.Text = "Not Available";
                    }
                    else
                    {
                        WineProducer.Text = myData.ItemDetails.Producer;
                    }
                    if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "")
                    {
                        WineDescription.Text = "Not Available";
                    }
                    else
                    {
                        WineDescription.Text = myData.ItemDetails.Description;
                    }
                    AvgRating.Rating = (float)myData.ItemDetails.AverageRating;

                    //ReviewPopup editPopup = new ReviewPopup(this, edit);
                    //RatingBar RatingInput = FindViewById<RatingBar>(Resource.Id.ratingInput);//Taking rating stars input
                    //RatingInput.RatingBarChange += editPopup.CreatePopup;

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


                    HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage);

                    BitmapFactory.Options options = new BitmapFactory.Options
                    {
                        InJustDecodeBounds = false,
                        OutHeight          = 75,
                        OutWidth           = 75
                    };
                    ProgressIndicator.Hide();
                    LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid);
                    Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options);
                }
                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                    AlertDialog.Builder alert = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    alert.SetTitle("Sorry");
                    alert.SetMessage("We're under maintainence");
                    alert.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
            }
            catch { }
        }
Exemplo n.º 13
0
        protected override void OnCreate(Bundle bundle)
        {
            CheckInternetConnection();
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Profile);
            //st.Start();
            try
            {
                ///LoggingClass.UploadErrorLogs(LoggingClass.CreateDirectoryForLogs());
                LoggingClass.LogInfo("Entered into Profile Activity", screenid);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                int            userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper sw     = new ServiceWrapper();
                var            output = sw.GetCustomerDetails(userId).Result;
                propicimage = FindViewById <ImageView>(Resource.Id.propic);
                DownloadAsync(this, System.EventArgs.Empty);
                //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.Dispose();
                //    }
                //    else
                //    {
                //        propicimage.SetImageBitmap(imageBitmap);
                //        propicimage.Dispose();
                //    }
                //}
                //else
                //{
                //    Bitmap imageBitmap = BlobWrapper.ProfileImages(userId);
                //    if (imageBitmap == null)
                //    {
                //        propicimage.SetImageResource(Resource.Drawable.user1);
                //    }
                //    else
                //    {
                //        propicimage.SetImageBitmap(imageBitmap);
                //    }
                //}
                InputMethodManager inputManager = (InputMethodManager)this.GetSystemService(Context.InputMethodService);


                ImageButton changepropic = FindViewById <ImageButton>(Resource.Id.btnChangePropic);
                changepropic.Click += delegate
                {
                    LoggingClass.LogInfo("Clicked on change propic", screenid);
                    Intent intent = new Intent(this, typeof(ProfilePicturePickDialog));
                    StartActivity(intent);
                };
                changepropic.Dispose();
                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.CardNumber;
                //if (CurrentUser.getUserId() != null)
                //{
                //	City.Enabled = false;
                //}
                //else { City.Enabled = true; }
                EditText PinCode = FindViewById <EditText>(Resource.Id.txtZip);


                PinCode.Text = output.customer.Zip;



                Button  updatebtn = FindViewById <Button>(Resource.Id.UpdateButton);
                Spinner spn       = FindViewById <Spinner>(Resource.Id.spinner);
                Spinner Prefered  = FindViewById <Spinner>(Resource.Id.spinner1);
                //spn.SetSelection(4);

                string        state         = output.customer.State;
                int           Preferedstore = output.customer.PreferredStore;
                List <string> storelist     = new List <string>();
                storelist.Add("--select--");
                storelist.Add("Wall");
                storelist.Add("PointPleasent");
                storelist.Add("Both");
                gifImageView = FindViewById <ImageView>(Resource.Id.gifImageView1);
                //gifImageView.StartAnimation();

                List <string> StateList = new List <string>();
                StateList.Add("AL");
                StateList.Add("AK");
                StateList.Add("AZ");
                StateList.Add("AR");
                StateList.Add("CA");
                StateList.Add("CO");
                StateList.Add("CT");
                StateList.Add("DE");
                StateList.Add("FL");
                StateList.Add("GA");
                StateList.Add("HI");
                StateList.Add("ID");
                StateList.Add("IL");
                StateList.Add("IN");
                StateList.Add("IA");
                StateList.Add("KS");
                StateList.Add("KY");
                StateList.Add("LA");
                StateList.Add("ME");
                StateList.Add("MD");
                StateList.Add("MA");
                StateList.Add("MI");
                StateList.Add("MN");
                StateList.Add("MS");
                StateList.Add("MO");
                StateList.Add("MT");
                StateList.Add("NE");
                StateList.Add("NV");
                StateList.Add("NH");
                StateList.Add("NJ");
                StateList.Add("NM");
                StateList.Add("NY");
                StateList.Add("NC");
                StateList.Add("ND");
                StateList.Add("OH");
                StateList.Add("OK");
                StateList.Add("OR");
                StateList.Add("PA");
                StateList.Add("RI");
                StateList.Add("SC");
                StateList.Add("SD");
                StateList.Add("TN");
                StateList.Add("TX");
                StateList.Add("UT");
                StateList.Add("VT");
                StateList.Add("VA");
                StateList.Add("WA");
                StateList.Add("WV");
                StateList.Add("WI");
                StateList.Add("WY");
                int i = StateList.IndexOf(state.ToString());
                spn.SetSelection(i);
                //int p = storelist.IndexOf(Prefered.SelectedItem.ToString());
                Prefered.SetSelection(Preferedstore);
                inputManager.HideSoftInputFromWindow(Firstname.WindowToken, 0);
                inputManager.HideSoftInputFromWindow(Lastname.WindowToken, 0);

                inputManager.HideSoftInputFromWindow(Address.WindowToken, 0);
                inputManager.HideSoftInputFromWindow(PinCode.WindowToken, 0);
                inputManager.HideSoftInputFromWindow(Email.WindowToken, 0);
                if (CurrentUser.getUserId() == null)
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    aler.SetTitle("Sorry");
                    aler.SetMessage("This feature is available only  for VIP Users");
                    aler.SetNegativeButton("Ok", delegate
                    {
                        var intent = new Intent(this, typeof(TabActivity));
                        StartActivity(intent);
                    });
                    Dialog dialog1 = aler.Create();
                    dialog1.Show();
                }
                else
                {
                    updatebtn.Click += async delegate
                    {
                        if ((Email.Text.Contains("@")) == false || (Email.Text.Contains(".")) == false)
                        {
                            AndHUD.Shared.ShowErrorWithStatus(this, "Email is invalid", MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        else if ((PinCode.Text.Length != 5))
                        {
                            AndHUD.Shared.ShowErrorWithStatus(this, "Zipcode is invalid", MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                        else
                        {
                            AndHUD.Shared.Show(this, "Please Wait", Convert.ToInt32(MaskType.Clear));
                            //int p = storelist.IndexOf(Prefered.SelectedItem.ToString());
                            //Prefered.SetSelection(p);
                            Customer customer = new Customer()
                            {
                                FirstName   = Firstname.Text,
                                LastName    = Lastname.Text,
                                PhoneNumber = Mobilenumber.Text,
                                Address1    = Address.Text,
                                Email       = Email.Text,
                                CustomerID  = userId,
                                //State = State.Text,
                                State = spn.SelectedItem.ToString(),

                                //City = City.Text
                                //CardNumber = City.Text,
                                Zip            = PinCode.Text,
                                PreferredStore = Convert.ToInt32(Prefered.SelectedItemId)
                            };
                            CurrentUser.SavePrefered(Convert.ToInt32(Prefered.SelectedItemId));
                            LoggingClass.LogInfo("Clicked on update info", screenid);
                            var x = await sw.UpdateCustomer(customer);

                            if (x == 1)
                            {
                                Toast.MakeText(this, "Thank you your profile is Updated", ToastLength.Short).Show();
                            }
                            AndHUD.Shared.Dismiss();
                            AndHUD.Shared.ShowSuccess(this, "Profile Updated", MaskType.Clear, TimeSpan.FromSeconds(2));
                            //                  var intent = new Intent(this, typeof(TabActivity));
                            //StartActivity(intent);
                        }
                    };
                }
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                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("Profile activity", st.Elapsed.TotalSeconds.ToString());
            ProgressIndicator.Hide();
        }
Exemplo n.º 14
0
        public void CreatePopup(object sender, RatingBar.RatingBarChangeEventArgs e)
        {
            try
            {
                Dialog editDialog = new Dialog(Parent);
                var    rat        = e.Rating;
                //editDialog.Window.RequestFeature(WindowFeatures.NoTitle);
                //editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.White));// (Android.Graphics.Color.Transparent));
                editDialog.SetContentView(Resource.Layout.EditReviewPopup);
                //editDialog.SetTitle();
                ServiceWrapper sw              = new ServiceWrapper();
                Review         review          = new Review();
                ImageButton    close           = editDialog.FindViewById <ImageButton>(Resource.Id.close);
                Button         btnSubmitReview = editDialog.FindViewById <Button>(Resource.Id.btnSubmitReview);
                TextView       Comments        = editDialog.FindViewById <TextView>(Resource.Id.txtReviewComments);
                RatingBar      custRating      = editDialog.FindViewById <RatingBar>(Resource.Id.rating);
                custRating.Rating = rat;
                Comments.Text     = _editObj.RatingText;
                int screenid = 9;
                //ImageButton ibs = editDialog.FindViewById<ImageButton>(Resource.Id.ratingimage);
                //ItemReviewResponse SkuRating = new ItemReviewResponse();
                //SkuRating = sw.GetItemReviewsByWineID(WineId).Result;
                //ReviewArray = SkuRating.Reviews.ToList();
                //for (int i = 0; i < ReviewArray.Count(); i++)
                //{
                //    if (Convert.ToInt32(CurrentUser.getUserId()) == ReviewArray[i].ReviewUserId)
                //    {
                //        ItemReviewResponse uidreviews = new ItemReviewResponse();
                //        uidreviews = sw.GetItemReviewUID(Convert.ToInt32(CurrentUser.getUserId())).Result;
                //        List<Review> myArr1;
                //        myArr1 = uidreviews.Reviews.ToList();
                //        for (int j = 0; j < myArr1.Count; j++)
                //        {
                //            if (ReviewArray[i].Name == myArr1[i].Name)
                //                Comments.Text = myArr1[i].RatingText.ToString();
                //        }
                //    }
                //    else
                //    {
                //        CreatePopup(sender, e);
                //    }
                //}



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

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

            //LoggingClass.LogTime("create popup",st.Elapsed.TotalSeconds.ToString());
        }
Exemplo n.º 15
0
        public void EditPopup(object sender, EventArgs e)
        {
            try
            {
                Dialog editDialog = new Dialog(Parent);
                int    screenid   = 18;
                //editDialog.Window.RequestFeature(WindowFeatures.NoTitle);
                //editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.White));// (Android.Graphics.Color.Transparent));
                editDialog.SetContentView(Resource.Layout.EditReviewPopup);
                //editDialog.SetTitle();
                ServiceWrapper sw     = new ServiceWrapper();
                Review         review = new Review();
                //ImageButton ibs = editDialog.FindViewById<ImageButton>(Resource.Id.ratingimage);
                ImageButton close           = editDialog.FindViewById <ImageButton>(Resource.Id.close);
                Button      btnSubmitReview = editDialog.FindViewById <Button>(Resource.Id.btnSubmitReview);
                TextView    Comments        = editDialog.FindViewById <TextView>(Resource.Id.txtReviewComments);
                RatingBar   custRating      = editDialog.FindViewById <RatingBar>(Resource.Id.rating);
                Comments.Text     = _editObj.RatingText;
                custRating.Rating = _editObj.RatingStars;
                //ibs.SetImageResource(Resource.Drawable.wine_review);
                //ibs.SetScaleType(ImageView.ScaleType.CenterCrop);
                //close.SetImageResource(Resource.Drawable.Close);
                LoggingClass.LogInfo("Entered into EditPopup", screenid);

                close.SetScaleType(ImageView.ScaleType.CenterCrop);
                editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));
                editDialog.Show();
                close.Click += delegate
                {
                    LoggingClass.LogInfo("Closed PoPup", screenid);
                    editDialog.Dismiss();
                };
                btnSubmitReview.Click += async delegate
                {
                    AndHUD.Shared.Show(Parent, "Saving Review...", Convert.ToInt32(MaskType.Clear));

                    // ProgressIndicator.Show(Parent);
                    review.ReviewDate   = DateTime.Now;
                    review.ReviewUserId = Convert.ToInt32(CurrentUser.getUserId());
                    review.RatingText   = Comments.Text;
                    review.RatingStars  = Convert.ToInt32(custRating.Rating);
                    review.IsActive     = true;
                    review.PlantFinal   = storeid;
                    review.Barcode      = WineBarcode;
                    try
                    {
                        await sw.InsertUpdateReview(review);

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

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

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

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

                        ((IPopupParent)Parent).RefreshParent();
                        ProgressIndicator.Hide();
                        editDialog.Dismiss();
                        AndHUD.Shared.Dismiss();
                        AndHUD.Shared.ShowSuccess(Parent, "Sucessfully Saved", MaskType.Clear, TimeSpan.FromSeconds(2));
                    };
                }
                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, ParentScreenId, exe.StackTrace.ToString());
                }
            }
        }
 public void OtpVerification(string sentOtp, string receivedOtp, string username)
 {
     //starting of otp verification code
     if (sentOtp == receivedOtp)
     {
         AlertDialog.Builder alert = new AlertDialog.Builder(this);
         alert.SetTitle("Successfully your logged in");
         alert.SetMessage("Thank You");
         alert.SetNegativeButton("Ok", delegate { });
         Dialog dialog = alert.Create();
         dialog.Show();
         CustomerResponse authen = new CustomerResponse();
         ServiceWrapper   svc    = new ServiceWrapper();
         try
         {
             /// authen = svc.AuthencateUser(username).Result;
             if (authen.customer != null && authen.customer.CustomerID != 0)
             {
                 CurrentUser.SaveUserName(username, 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();
             }
         }
     }
     else
     {
         AlertDialog.Builder aler = new AlertDialog.Builder(this);
         aler.SetTitle("Incorrect Otp");
         aler.SetMessage("Please Check Again");
         aler.SetNegativeButton("Ok", delegate { });
         Dialog dialog = aler.Create();
         dialog.Show();
     }
     //Ending of otp verification code
 }
Exemplo n.º 18
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);
        }
Exemplo 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.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);
        }
Exemplo n.º 20
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            View row = convertView;

            if (row == null)
            {
                row = LayoutInflater.From(myContext).Inflate(Resource.Layout.PotraitListView, null, false);
            }
            TextView txtName = row.FindViewById <TextView>(Resource.Id.SkuName);
            TextView txtYear = row.FindViewById <TextView>(Resource.Id.Vintage);

            TextView    txtDate   = row.FindViewById <TextView>(Resource.Id.Date);
            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.AvgRating);

            edit.SetScaleType(ImageView.ScaleType.CenterCrop);

            //TextView txtPrice = row.FindViewById<TextView>(Resource.Id.txtPrice);
            //ImageView imgWine = row.FindViewById<ImageView>(Resource.Id.imgWine);
            //edit.SetTag(1, 5757);
            //edit.Click += (sender, args) => {
            //    PerformItemClick(sender, args, position, 5757);
            //};

            edit.SetImageResource(Resource.Drawable.heart_empty);


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

            if (count == true)
            {
                edit.SetImageResource(Resource.Drawable.heart_full);
            }
            else
            {
                edit.SetImageResource(Resource.Drawable.heart_empty);
            }
            if (convertView == null)
            {
                edit.Click += async delegate
                {
                    bool x;
                    if (count == false)
                    {
                        edit.SetImageResource(Resource.Drawable.heart_full);
                        x     = true;
                        count = true;
                    }
                    else
                    {
                        edit.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);
                };
            }



            txtDate.SetTextSize(Android.Util.ComplexUnitType.Dip, 12);
            txtName.Text = myItems[position].Name;
            txtYear.Text = myItems[position].Vintage.ToString();;

            txtDate.Text = myItems[position].RegPrice.ToString();
            txtDate.Text = "$ " + txtDate.Text;
            rb.Rating    = (float)myItems[position].AverageRating;
            wineimage.SetImageResource(Resource.Drawable.Tes);
            wineimage.SetScaleType(ImageView.ScaleType.CenterCrop);
            //txtPrice.Text = myItems[position].Price;
            //imgWine.SetImageURI(new Uri(myItems[position].imageURL));



            txtName.Focusable = false;
            txtYear.Focusable = false;
            rb.Focusable      = false;
            txtDate.Focusable = false;
            //txtRatings.Focusable = false;
            //txtUserRatings.Focusable = false;
            //txtPrice.Focusable = false;
            //imgWine.Focusable = false;


            return(row);
        }
Exemplo n.º 21
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);
        }
Exemplo n.º 22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CheckInternetConnection();
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.detailedView);
            WineBarcode = Intent.GetStringExtra("WineBarcode");
            storeid     = Intent.GetIntExtra("storeid", 1);
            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ServiceWrapper      svc       = new ServiceWrapper();
            ItemDetailsResponse myData    = new ItemDetailsResponse();
            ItemReviewResponse  SkuRating = new ItemReviewResponse();

            this.Title   = "Wine Details";
            commentsview = FindViewById <ListView>(Resource.Id.listView2);
            TextView WineName = FindViewById <TextView>(Resource.Id.txtWineName);            //Assigning values to respected Textfields

            WineName.Focusable = false;
            TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer);

            WineProducer.Focusable = false;
            TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage);

            Vintage.Focusable = false;
            TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription);

            WineDescription.Focusable = false;
            RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating);

            AvgRating.Focusable = false;
            TextView ErrorDescription = FindViewById <TextView>(Resource.Id.Error);

            ErrorDescription.Focusable  = false;
            ErrorDescription.Visibility = ViewStates.Invisible;
            TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5);

            try
            {
                DownloadAsync(this, System.EventArgs.Empty, WineBarcode);
                myData      = svc.GetItemDetails(WineBarcode, storeid).Result;
                SkuRating   = svc.GetItemReviewsByWineBarcode(WineBarcode).Result;
                ReviewArray = SkuRating.Reviews.ToList();
                comments    = new reviewAdapter(this, ReviewArray);
                if (comments.Count == 0)
                {
                    ErrorDescription.Text       = SkuRating.ErrorDescription;
                    ErrorDescription.Visibility = ViewStates.Visible;
                    //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    //aler.SetTitle("No Reviews");
                    //aler.SetMessage("Be the first one to Review");
                    //aler.SetNegativeButton("Ok", delegate { });

                    //Dialog dialog = aler.Create();
                    //dialog.Show();
                }
                else
                {
                    commentsview.Adapter = comments;
                }
                setListViewHeightBasedOnChildren1(commentsview);
                WineName.Text      = myData.ItemDetails.Name;
                WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
                Vintage.Text       = myData.ItemDetails.Vintage.ToString();
                if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "")
                {
                    WineProducer.Text = "Not Available";
                }
                else
                {
                    WineProducer.Text = myData.ItemDetails.Producer;
                }
                if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "")
                {
                    WineDescription.Text = "Not Available";
                }
                else
                {
                    WineDescription.Text = myData.ItemDetails.Description;
                }
                AvgRating.Rating = (float)myData.ItemDetails.AverageRating;
                Review edit = new Review()
                {
                    Barcode    = WineBarcode,
                    RatingText = "",
                    PlantFinal = storeid.ToString()
                };
                var tempReview = ReviewArray.Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId()));
                if (tempReview != null)
                {
                    edit.RatingText = tempReview.RatingText;
                }
                ReviewPopup editPopup   = new ReviewPopup(this, edit);
                RatingBar   RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput);             //Taking rating stars input
                RatingInput.RatingBarChange += editPopup.CreatePopup;
                var metrics    = Resources.DisplayMetrics;
                var widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
                var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);


                HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage);

                BitmapFactory.Options options = new BitmapFactory.Options
                {
                    InJustDecodeBounds = false,
                    OutHeight          = 75,
                    OutWidth           = 75
                };
                ProgressIndicator.Hide();
                LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid);
                Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options);
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Sorry");
                alert.SetMessage("We're under maintainence");
                alert.SetNegativeButton("Ok", delegate { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
            //downloadButton = FindViewById<Button>(Resource.Id.Download);
            //try
            //{
            //    //downloadButton.Enabled = true;
            //    downloadButton.Click += downloadAsync;
            //    //downloadButton.Enabled = false;

            //}

            //catch (Exception e) { }
            st.Stop();
            LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString());
            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;
        }
Exemplo n.º 23
0
        public static void DownloadImages(int userid)
        {
            ServiceWrapper sw = new ServiceWrapper();

            //    ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();

            App._dir = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory("WineHangouts"), "winehangouts/wineimages");

            if (!App._dir.Exists())
            {
                App._dir.Mkdirs();
            }
            string path = App._dir.ToString();
            //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            //string path = pppd.CreateDirectoryForPictures();
            //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            int           storeid = 3;
            DirectoryInfo di      = new DirectoryInfo(path);

            bool isthere = di.GetFiles(userid + ".jpg").Any();

            if (!isthere)
            {
                var    uri = new Uri(ServiceURL + "profileimages/" + userid + ".jpg");
                Bitmap bm  = GetImageBitmapFromUrl(uri.ToString());
                try
                {
                    var filePath = System.IO.Path.Combine(path + "/" + userid + ".jpg");
                    var stream   = new FileStream(filePath, FileMode.Create);
                    bm.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
                    stream.Close();
                }
                catch (Exception e)
                {
                    string Exe = e.ToString();
                }
            }

            for (int j = 1; j < storeid; j++)
            {
                var         output = sw.GetItemList(j, userid).Result;
                List <Item> x      = output.ItemList.ToList();
                int         y      = x.Count;
                for (int i = 0; i < y; i++)
                {
                    bool ispresent = di.GetFiles(x[i].WineId + ".").Any();
                    if (!ispresent)
                    {
                        var    uri = new Uri(ServiceURL + "bottleimages/" + x[i].WineId + ".jpg");
                        Bitmap bm  = GetImageBitmapFromUrl(uri.ToString());
                        try
                        {
                            var filePath = System.IO.Path.Combine(path + "/" + x[i].WineId + ".jpg");
                            var stream   = new FileStream(filePath, FileMode.Create);
                            bm.Compress(Bitmap.CompressFormat.Webp, 100, stream);
                            stream.Close();
                        }
                        catch (Exception e)
                        {
                            string Exe = e.ToString();
                        }
                    }
                }
            }
        }
Exemplo n.º 24
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);
        }
Exemplo n.º 25
0
        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);
            customerid = Convert.ToInt32(CurrentUser.getUserId());

            try
            {
                LoggingClass.LogInfo("Entered into My Tasting", screenid);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);

                ServiceWrapper svc = new ServiceWrapper();

                var MYtastings = svc.GetMyTastingsList(customerid).Result;
                myArr1 = MYtastings.TastingList.ToList();
                if (MYtastings.TastingList.Count == 0)
                {
                    SetContentView(Resource.Layout.EmptyTaste);
                    TextView te = FindViewById <TextView>(Resource.Id.textView123a);
                    //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    ////aler.SetTitle("No Reviews Avalilable");
                    //aler.SetMessage("Sorry you haven't Tasted our wines");
                    //LoggingClass.LogInfo("Sorry you haven't Tasted our wines alert", screenid);
                    //aler.SetNegativeButton("Ok", delegate { Finish(); });
                    //LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                    //Dialog dialog = aler.Create();
                    //dialog.Show();
                }
                else
                {
                    SetContentView(Resource.Layout.MyTasting);
                    ListView wineList = FindViewById <ListView>(Resource.Id.MyTasting);

                    MyTastingAdapter adapter = new MyTastingAdapter(this, MYtastings.TastingList.ToList());
                    wineList.Adapter    = adapter;
                    wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                    {
                        string WineBarcode = myArr1[args.Position].Barcode;
                        int    storeID     = myArr1[args.Position].PlantFinal;
                        LoggingClass.LogInfo("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine from tasting  details", screenid);
                        ProgressIndicator.Show(this);
                        var intent = new Intent(this, typeof(DetailViewActivity));
                        intent.PutExtra("WineBarcode", WineBarcode);
                        intent.PutExtra("storeid", storeID);
                        StartActivity(intent);
                    };
                }
                ProgressIndicator.Hide();
            }

            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                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("Tastingactivity", st.Elapsed.TotalSeconds.ToString());
        }
Exemplo n.º 26
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            try
            {
                SetContentView(Resource.Layout.MyFavoriteGridView);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                if (StoreName == "")
                {
                    StoreName = Intent.GetStringExtra("MyData");
                }
                this.Title = StoreName;

                int StoreId = 0;
                if (StoreName == "My Favorites")
                {
                    StoreId = 1;
                }
                else if (StoreName == "Point Pleasent Store")
                {
                    StoreId = 2;
                }
                else if (StoreName == "Wall Store")
                {
                    StoreId = 3;
                }
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = new ItemListResponse();

                output = sw.GetItemFavsUID(userId).Result;


                List <Item> myArr;
                myArr = output.ItemList.ToList();
                var gridview = FindViewById <GridView>(Resource.Id.gridviewfav);
                MyFavoriteAdapter adapter = new MyFavoriteAdapter(this, myArr);
                gridview.SetNumColumns(2);
                gridview.Adapter = adapter;


                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    int WineID = myArr[args.Position].WineId;
                    var intent = new Intent(this, typeof(detailViewActivity));
                    intent.PutExtra("WineID", WineID);
                    StartActivity(intent);
                };
                ProgressIndicator.Hide();
            }

            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();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            AndHUD.Shared.Dismiss();
            CheckInternetConnection();
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.detailedView);
            //         WineBarcode = Intent.GetStringExtra("WineBarcode");
            //storeid = Intent.GetIntExtra("storeid", 1);
            //ActionBar.SetHomeButtonEnabled(true);
            //ActionBar.SetDisplayHomeAsUpEnabled(true);
            //ServiceWrapper svc = new ServiceWrapper();
            //         myData = new ItemDetailsResponse();
            //ItemReviewResponse SkuRating = new ItemReviewResponse();
            //this.Title = "Wine Details";
            commentsview           = FindViewById <ListView>(Resource.Id.listView2);
            WineName               = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields
            WineName.Focusable     = false;
            WineProducer           = FindViewById <TextView>(Resource.Id.txtProducer);
            WineProducer.Focusable = false;
            Vintage                     = FindViewById <TextView>(Resource.Id.txtVintage);
            Vintage.Focusable           = false;
            WineDescription             = FindViewById <TextView>(Resource.Id.txtWineDescription);
            WineDescription.Focusable   = false;
            AvgRating                   = FindViewById <RatingBar>(Resource.Id.avgrating);
            AvgRating.Focusable         = false;
            ErrorDescription            = FindViewById <TextView>(Resource.Id.Error);
            ErrorDescription.Focusable  = false;
            ErrorDescription.Visibility = ViewStates.Gone;
            TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5);

            WineBarcode = Intent.GetStringExtra("WineBarcode");
            storeid     = Intent.GetIntExtra("storeid", 1);
            Review edit = new Review()
            {
                Barcode    = WineBarcode,
                RatingText = "",
                PlantFinal = storeid.ToString()
            };

            ItemReviewResponse SkuRating = new ItemReviewResponse();
            ServiceWrapper     svc       = new ServiceWrapper();

            SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result;
            var tempReview = SkuRating.Reviews.ToList().Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId()));

            if (tempReview != null)
            {
                edit.RatingText = tempReview.RatingText;
            }
            editPopup = new ReviewPopup(this, edit);
            RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput);//Taking rating stars input

            RatingInput.RatingBarChange += editPopup.CreatePopup;

            Internal_ViewDidLoad();
            st.Stop();
            AndHUD.Shared.Dismiss();
            LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString());
        }
        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);
        }
Exemplo n.º 29
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();
        }
Exemplo n.º 30
0
        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);
            try
            {
                //SetContentView(Resource.Layout.MyFavoriteGridView);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                if (StoreName == "")
                {
                    StoreName = Intent.GetStringExtra("MyData");
                }
                this.Title = StoreName;
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = new ItemListResponse();
                output = sw.GetItemFavsUID(userId).Result;
                List <Item> myArr;
                myArr = output.ItemList.ToList();
                if (output.ItemList.Count == 0)
                {
                    SetContentView(Resource.Layout.FavEmp);
                    TextView  txtName = FindViewById <TextView>(Resource.Id.textView1);
                    ImageView Imag    = FindViewById <ImageView>(Resource.Id.imageView1);
                    //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    ////aler.SetTitle("No Reviews Avalilable");
                    //aler.SetMessage("Sorry you didn't tell us your Favourite wines");
                    //LoggingClass.LogInfo("Sorry you didn't tell us your Favourite wines", screenid);
                    //aler.SetNegativeButton("Ok", delegate { Finish(); });
                    //LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                    //Dialog dialog = aler.Create();
                    //dialog.Show();
                }
                else
                {
                    SetContentView(Resource.Layout.MyFavoriteGridView);
                    var gridview = FindViewById <GridView>(Resource.Id.gridviewfav);
                    MyFavoriteAdapter adapter = new MyFavoriteAdapter(this, myArr);
                    LoggingClass.LogInfo("Entered into Favourite Adapter", screenid);
                    gridview.SetNumColumns(2);
                    gridview.Adapter    = adapter;
                    gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                    {
                        try
                        {
                            string WineBarcode = myArr[args.Position].Barcode;
                            int    storeid     = 1;// myArr[args.Position].PlantFinal;
                            //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);
                        }
                        catch (Exception)
                        {
                            string WineBarcode = myArr[args.Position].Barcode;
                            int    storeid     = myArr[args.Position].PlantFinal;
                            ProgressIndicator.Show(this);
                            AndHUD.Shared.Dismiss();
                            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);
                        }
                    };

                    LoggingClass.LogInfo("Entered into My Favorites Activity", screenid);
                }
                st.Stop();
                LoggingClass.LogTime("Favouriteactivity", st.Elapsed.TotalSeconds.ToString());
                ProgressIndicator.Hide();
            }

            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                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();
            }
        }