Esempio n. 1
0
        public async void DownloadAsync(string WineBarcode, int storeid, UIImageView btlImage, nfloat boxHeight)
        {
            WebClient webClient = new WebClient();
            string    url       = null;

            if (storeid == 1)
            {
                url = "https://icsintegration.blob.core.windows.net/bottleimagedetailswall/" + WineBarcode + ".jpg";
            }
            else if (storeid == 2)
            {
                url = "https://icsintegration.blob.core.windows.net/bottleimagedetailspp/" + WineBarcode + ".jpg";
            }
            byte[] imageBytes = null;
            try
            {
                imageBytes = await webClient.DownloadDataTaskAsync(url);

                HighImgData = NSData.FromStream(new MemoryStream(imageBytes));
            }
            catch (TaskCanceledException)
            {
                //this.progressLayout.Visibility = ViewStates.Gone;
                return;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError("while downloading image of wine id" + WineBarcode + "  " + exe.Message, screenid, exe.StackTrace.ToString());
            }

            //HighresImg  =UIImage.LoadFromData(HighImgData);
            try
            {
                if (HighImgData != null)
                {
                    UIImage image     = UIImage.LoadFromData(HighImgData);
                    nfloat  imgHeight = image.Size.Height;
                    nfloat  ratio     = boxHeight / imgHeight;
                    CGSize  newSize   = new CGSize(image.Size.Width * ratio, image.Size.Height * ratio);
                    image = image.Scale(newSize);
                    nfloat X = (boxHeight - image.Size.Width) / 2;
                    btlImage.Frame = new CGRect(X, 0, image.Size.Width, image.Size.Height);
                    btlImage.Image = image;
                }
                else
                {
                    btlImage.Image = new UIImage("Wines/bottle.jpg");
                }
            }
            catch (Exception Ex)
            {
                LoggingClass.LogError(Ex.Message, screenid, Ex.StackTrace.ToString());
            }
        }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            try
            {
                TokenUpdate();
                nfloat width = UIScreen.MainScreen.Bounds.Width;
                width = width / 2 - 15;
                UICollectionViewFlowLayout flowLayout;
                flowLayout = new UICollectionViewFlowLayout()
                {
                    ItemSize        = new CGSize(width, 325.0f),
                    SectionInset    = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                    ScrollDirection = UICollectionViewScrollDirection.Vertical
                };
                if (CurrentUser.GetStore() == 1)
                {
                    //BTProgressHUD.Show("Please wait...");
                    //NavigationController.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 1), false);
                }
                else if (CurrentUser.GetStore() == 2)
                {
                    //BTProgressHUD.Show("Please wait...");
                    //NavigationController.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 2), false);
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message + " User not allowed to send notifications.", screen, ex.StackTrace);
            }
            nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;

            ScreenHeight = (ScreenHeight - 100) / 3;
            nfloat   margin = 1;
            nfloat   start  = 50;
            UIButton btnMan = new UIButton();
            UIButton btnSec = new UIButton();
            UIButton btnPP  = new UIButton();

            btnMan.Frame = new CGRect(0, start, UIScreen.MainScreen.Bounds.Width, ScreenHeight);
            btnPP.Frame  = new CGRect(0, start + ScreenHeight + margin, UIScreen.MainScreen.Bounds.Width, ScreenHeight);
            btnSec.Frame = new CGRect(0, start + (ScreenHeight + margin) * 2, UIScreen.MainScreen.Bounds.Width, ScreenHeight);
            btnMan.SetTitle("", UIControlState.Normal);
            btnSec.SetTitle("", UIControlState.Normal);
            btnPP.SetTitle("", UIControlState.Normal);
            btnMan.SetBackgroundImage(new UIImage("Images/wall1.jpg"), UIControlState.Normal);
            btnSec.SetBackgroundImage(new UIImage("Images/scacus1.jpg"), UIControlState.Normal);
            btnPP.SetBackgroundImage(new UIImage("Images/pp1.jpg"), UIControlState.Normal);
            View.AddSubview(btnMan);
            View.AddSubview(btnSec);
            View.AddSubview(btnPP);
            BindClicks(btnMan, btnSec, btnPP, View);
        }
Esempio n. 3
0
 public void TokenUpdate()
 {
     try
     {
         AppDelegate ap = new AppDelegate();
         ap.RegisteredForRemoteNotifications(CurrentUser.app, CurrentUser.dt);
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.Message + " User not allowed to send notifications.", screen, ex.StackTrace);
     }
 }
        public async void DownloadAsync()
        {
            //Boolean internetStatus = Reachability.IsHostReachable("https://www.google.com");
            NSData HighImgData = null;

            //UIImage HighresImg = null;
            try
            {
                imgProfile.Image = new UIImage("Images/loadin.png");
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.StackTrace);
                LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
            }
            WebClient webClient = new WebClient();
            //string url = "http://www.my-hd-wallpapers.com/wall/1405244488_moutain-reflect-on-a-lake_800.jpg";
            string url = "https://icsintegration.blob.core.windows.net/profileimages/" + CurrentUser.RetreiveUserId() + ".jpg";

            byte[] imageBytes = null;
            try
            {
                imageBytes = await webClient.DownloadDataTaskAsync(url);

                HighImgData = NSData.FromStream(new MemoryStream(imageBytes));
            }
            catch (TaskCanceledException)
            {
                //this.progressLayout.Visibility = ViewStates.Gone;
                return;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }

            //HighresImg  =UIImage.LoadFromData(HighImgData);
            try
            {
                if (HighImgData != null)
                {
                    imgProfile.Image = UIImage.LoadFromData(HighImgData);
                }
                else
                {
                    imgProfile.Image = new UIImage("user1.png");
                }
            }
            catch (Exception Ex)
            {
                LoggingClass.LogError(Ex.Message, screenid, Ex.StackTrace.ToString());
            }
        }
Esempio n. 5
0
        //Processing the notification
        void ProcessNotification(NSDictionary options, bool fromFinishedLaunching)
        {
            if (null != options && options.ContainsKey(new NSString("aps")))
            {
                try
                {
                    //getting barcode,storeid
                    LoggingClass.LogInfo("Notification Received", screen);
                    string       wine    = options.ObjectForKey(new NSString("barcode")).ToString();
                    string       storeid = options.ObjectForKey(new NSString("storeid")).ToString();
                    NSDictionary aps     = options.ObjectForKey(new NSString("aps")) as NSDictionary;
                    string       alert   = string.Empty;
                    string       wineid  = string.Empty;

                    if (aps.ContainsKey(new NSString("alert")))
                    {
                        alert = (aps[new NSString("alert")] as NSString).ToString();
                    }
                    wineid = wine;
                    if (!fromFinishedLaunching)
                    {
                        if (wineid == "" || wineid == null)
                        {
                            UIAlertView alert1 = new UIAlertView()
                            {
                                Title = "We didn't find tasted wine.",
                            };

                            alert1.AddButton("OK");

                            alert1.Show();
                        }
                        //else if (wineid == "999999")
                        //{
                        //	//var Taste=new MyTastingViewController();
                        //LoggingClass.LogInfo(wineid + " got notification ",screen);
                        //	CurrentUser.navig.PushViewController(new MyTastingViewController(), false);

                        //}
                        else
                        {
                            //
                            LoggingClass.LogInfo(wineid + " got notification ", screen);
                            CurrentUser.navig.PushViewController(new DetailViewController(wineid, storeid, false, false), false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
                }
            }
        }
 public override void ViewDidLoad()
 {
     try
     {
         //   this.NavigationItem.SetRightBarButtonItem(
         //	new UIBarButtonItem(UIBarButtonSystemItem.Action, (sender, args) => {
         //       // button was clicked
         //})
         //, true);
         ServiceWrapper svc = new ServiceWrapper();
         myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
         if (myData.ItemList.Count != 0)
         {
             this.CollectionView.Add(refreshControl);
             refreshControl.ValueChanged += (rcSender, e) =>
             {
                 //Refresh this view
                 myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
                 CollectionView.ReloadData();
                 refreshControl.EndRefreshing();
             };
             BTProgressHUD.Dismiss();
             this.View.BackgroundColor           = new UIColor(256, 256, 256, 0.8f);
             this.CollectionView.BackgroundColor = UIColor.White;
             CollectionView.RegisterClassForCell(typeof(APLCollectionViewCell), APLCollectionViewCell.Key);
         }
         else
         {
             this.View.BackgroundColor           = new UIColor(256, 256, 256, 0.8f);
             this.CollectionView.BackgroundColor = UIColor.White;
             string _name = null;
             if (storeId == 3)
             {
                 _name = LoggingClass.txtstore3;
             }
             UIAlertView alert = new UIAlertView()
             {
                 Title   = _name + " Store",
                 Message = "Coming Soon"
             };
             alert.AddButton("OK");
             alert.Show();
         }
     }
     catch (Exception ex)
     {
         BTProgressHUD.ShowErrorWithStatus("Something went wrong,We're on it.");
         LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
     }
 }
 public override void ViewDidLoad()
 {
     try
     {
         LoggingClass.LogInfo("Entered into MyReviews View", screenid);
         int userId = Convert.ToInt32(CurrentUser.RetreiveUserId());
         var myData = sw.GetItemReviewUID(userId).Result;
         var data   = sw.GetMyTastingsList(userId).Result;
         Noreviews = new UILabel();
         if (data.TastingList.Count != 0)
         {
             Noreviews.Text = "You have tasted " + data.TastingList.Count + " wines.\n We would love to hear your feedback.";
         }
         else
         {
             Noreviews.Text = "Please taste and then review.";
         }
         Noreviews.TextAlignment = UITextAlignment.Center;
         Noreviews.LineBreakMode = UILineBreakMode.WordWrap;
         Noreviews.Lines         = 0;
         Noreviews.TextColor     = UIColor.Black;
         CGSize sTemp = new CGSize(View.Frame.Width, 100);
         sTemp           = Noreviews.SizeThatFits(sTemp);
         Noreviews.Frame = new CGRect(0, 50, View.Frame.Width, sTemp.Height);
         ImgIns          = new UIImageView();
         ImgIns.Image    = UIImage.FromFile("ReviewIns.png");
         ImgIns.Frame    = new CGRect((View.Frame.Width / 2) - 150, 120, 300, 300);
         if (myData.Reviews.Count == 0)
         {
             TableView.SeparatorColor = UIColor.Clear;
             View.AddSubview(Noreviews);
             View.AddSubview(ImgIns);
         }
         else
         {
             TableView.AllowsSelection = false;
             TableView.Source          = new MyReviewTableSource(myData.Reviews.ToList(), NavigationController, this);
         }
     }
     catch (Exception ex)
     {
         UIAlertView alert = new UIAlertView()
         {
             Title = "Something went wrong,we're on it.",
         };
         alert.AddButton("Ok");
         LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
     }
 }
		public async void EmailVerification()
		{
			try
			{
				DeviceToken Dt = new DeviceToken();
				if (CurrentUser.GetId() != null)
				{
					Dt = await svc.VerifyMail(CurrentUser.GetId());
				}
				if (Dt.VerificationStatus == 1)
				{
					CurrentUser.Store(cr.customer.CustomerID.ToString(), cr.customer.FirstName + cr.customer.LastName);
					CurrentUser.PutStore(cr.customer.PreferredStore);
					if (RootTabs == null || _window == null)
					{
						RootTabs = CurrentUser.RootTabs;
						_window = CurrentUser.window;
						nav = new UINavigationController(RootTabs);
						AddNavigationButtons(nav);
						_window.RootViewController = nav;
						LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid);
					}
					else
					{
						nav = new UINavigationController(RootTabs);
						AddNavigationButtons(nav);
						_window.RootViewController = nav;
						LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid);
					}
					BTProgressHUD.Dismiss();
				}
				else
				{
					try
					{
						BTProgressHUD.ShowErrorWithStatus("Your email is not verified plesase check email and verify.", 5000);
						View.AddSubview(btnResend);
					}
					catch (Exception ex)
					{
						LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
					}
				}
			}
			catch (Exception Exe)
			{
				LoggingClass.LogError(Exe.Message, screenid, Exe.StackTrace);
			}
		}
Esempio n. 9
0
		public async void updatetoken(CustomerResponse cr)
		{
			try
			{
				if (CurrentUser.GetDeviceToken() != null)
				{
					ServiceWrapper svc = new ServiceWrapper();
					await svc.InsertUpdateToken(CurrentUser.GetDeviceToken(), cr.customer.CustomerID.ToString());
				}
			}
			catch (Exception ex)
			{
				LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
			}
		}
        //Registering for remote notifications
        public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            try
            {
                CurrentUser.app = application;
                CurrentUser.dt  = deviceToken;
                var DeviceToken = deviceToken.Description;
                if (!string.IsNullOrWhiteSpace(DeviceToken))
                {
                    DeviceToken = DeviceToken.Trim('<').Trim('>');
                    CurrentUser.PutDeviceToken(DeviceToken);
                }
                ServiceWrapper svc = new ServiceWrapper();
                await svc.InsertUpdateToken(DeviceToken, CurrentUser.RetreiveUserId().ToString());

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

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

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

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

                // Save new device token
                NSUserDefaults.StandardUserDefaults.SetString(DeviceToken, "PushDeviceToken");
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message + " User not allowed to send notifications.", screen, ex.StackTrace);
            }
        }
Esempio n. 11
0
        public ReviewCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                SelectionStyle = UITableViewCellSelectionStyle.Gray;
                //ContentView.BackgroundColor = UIColor.FromRGB(218, 255, 127);
                imageView = new UIImageView();
                //ContentView.BackgroundColor = UIColor.Cyan;
                userName = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 15f),
                    TextColor       = UIColor.FromRGB(127, 51, 0),
                    BackgroundColor = UIColor.Clear
                };
                ReviewDate = new UILabel()
                {
                    Font            = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor       = UIColor.FromRGB(38, 127, 0),
                    BackgroundColor = UIColor.Clear,
                    //TextAlignment = UITextAlignment.Center,
                    //BackgroundColor = UIColor.Clear
                };
                Comments = new UITextView()
                {
                    Font            = UIFont.FromName("AmericanTypewriter", 14f),
                    TextColor       = UIColor.FromRGB(255, 127, 0),
                    TextAlignment   = UITextAlignment.Justified,
                    BackgroundColor = UIColor.Clear,
                    Editable        = false
                };
                Readmore = new UIBotton();
                Readmore.SetTitle("...ReadMore", UIControlState.Normal);
                Readmore.SetTitleColor(UIColor.Black, UIControlState.Normal);
                Readmore.BackgroundColor = UIColor.Clear;
                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));

                stars = new PDRatingView(new CGRect(ContentView.Bounds.Width - 200, 20, 60, 25), ratingConfig, 5.0m);

                ContentView.AddSubviews(new UIView[] { userName, ReviewDate, Comments, stars, imageView, Readmore });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
Esempio n. 12
0
		public void UpdateEmail(string Message)
		{
			string Email;
			BTProgressHUD.Dismiss();
			UIAlertView alert = new UIAlertView()
			{
				Title = Message,
				//Message = Message
			};
			alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
			alert.GetTextField(0).Placeholder = "*****@*****.**";
			alert.AddButton("Cancel");
			alert.AddButton("Update");
			alert.Clicked += async (senderalert, buttonArgs) =>
			{
				
				if (buttonArgs.ButtonIndex == 1)
				{
					
					Email = alert.GetTextField(0).Text;
					if (Email == null && Email == "")
					{
						//BTProgressHUD.ShowErrorWithStatus("Email is invalid",3000);
						UpdateEmail("Entered email id is invalid,Please enter again");
					}
					else if (Email.Contains("@") != true && Email.Contains(".") != true)
					{
                        UpdateEmail("Entered email id is invalid,Please enter again");
					}
					else
					{
						//BTProgressHUD.ShowSuccessWithStatus("We're sending mail to the updated mail");
						BtnTest1.Hidden = true;
						BtnTest2.Hidden = true;
						CurrentUser.PutEmail(Email);
						if (emailnotpresent)
						{
							if (screenheight <= 568)
							{
								y = y - 80;
							}
						}
						cr=await svc.UpdateMail(alert.GetTextField(0).Text, CurrentUser.GetId());
						LoggingClass.LogInfo(CurrentUser.GetCardNumber() + " Updated mail id to" + Email, screenid);
						BTProgressHUD.Show(LoggingClass.txtpleasewait);
						//Console.WriteLine(y);
						ShowInfo(cr, false);
					}

					//Console.WriteLine(updatedEmail);
					//Update service;
					//alert.CancelButtonIndex = 0;
				}
			} ;
			//alert.DismissWithClickedButtonIndex(0, true);
			//alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
			alert.Show();
		}
Esempio n. 13
0
 public override void LayoutSubviews()
 {
     try
     {
         base.LayoutSubviews();
         imageView.Frame  = new CGRect(5, 5, 33, 33);
         userName.Frame   = new CGRect(50, 2, ContentView.Bounds.Width - 35, 20);
         ReviewDate.Frame = new CGRect(50, 20, ContentView.Bounds.Width - 35, 25);
         //stars.Frame = new CGRect(35, 50, 100, 20);
         stars.UserInteractionEnabled = false;
         Comments.Frame = new CGRect(45, 45, ContentView.Bounds.Width - 50, 45);
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
     }
 }
Esempio n. 14
0
        public void UpdateCell(Review review)
        {
            try
            {
                UIImage img = BlobWrapper.GetProfileImageforUser(review.ReviewUserId);
                if (img != null)
                {
                    imageView.Image = img;
                }
                else
                {
                    imageView.Image = new UIImage("user1.png");
                }
                userName.Text   = review.Username;
                ReviewDate.Text = review.Date.ToString("MM-dd-yyyy");
                Comments.Text   = review.RatingText;
                if (review.RatingText.Length > 97)
                {
                    Readmore.Frame          = new CGRect(160, 71, ContentView.Bounds.Width, 20);
                    Readmore.TouchUpInside += delegate {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = review.RatingText,
                            //Message = "Coming Soon..."
                        };

                        alert.AddButton("OK");
                        alert.Show();
                    };
                }
                //CGSize sTemp = new CGSize(ContentView.Bounds.Width - 50, 100);
                //sTemp = Comments.SizeThatFits(sTemp);
                //Comments.Frame = new CGRect(0, 40, ContentView.Bounds.Width - 50, sTemp.Height);
                //stars = new PDRatingView(new CGRect(150, 2, 60, 20), ratingConfig, review.Stars);
                //ContentView.Bounds.Height = 90;
                stars.AverageRating = review.RatingStars;
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
Esempio n. 15
0
        public async Task <ItemReviewResponse> GetItemReviewsByWineID(string WineID)
        {
            sw.Start();
            ItemReviewResponse output = null;

            try
            {
                var uri      = new Uri(ServiceURL + "/GetReviewsBarcode/" + WineID);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <ItemReviewResponse>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "GetItemReviewsByWineID");
            //Console.WriteLine("GetItemReviewsByWineID service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 16
0
        public async Task <CustomerResponse> GetCustomerDetails(int userID)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                var uri      = new Uri(ServiceURL + "GetCustomerDetails/" + userID);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <CustomerResponse>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "GetCustomerDetails");
            //Console.WriteLine("GetCustomerDetails service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 17
0
        public async Task <DeviceToken> VerifyMail(string Uid)
        {
            sw.Start();
            DeviceToken output = null;

            try
            {
                var uri      = new Uri(ServiceURL + "GetVerificationStatus/" + Uid);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <DeviceToken>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Verify");
            //Console.WriteLine("Verify mail service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 18
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            ReviewCellView cell = null;

            try
            {
                NSString name = new NSString("TableCell");
                cell = tableView.DequeueReusableCell(name) as ReviewCellView;
                if (cell == null)
                {
                    cell = new ReviewCellView(name);
                }
                cell.UpdateCell(Reviews[indexPath.Row]);
                cell.SetNeedsDisplay();
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            return(cell);
        }
Esempio n. 19
0
        public async Task <TastingListResponse> GetMyTastingsList(int customerid)
        {
            sw.Start();
            TastingListResponse output = null;

            try
            {
                //customerid = 38691;
                var uri      = new Uri(ServiceURL + "GetMyTastingsList/" + customerid);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <TastingListResponse>(response);
            }catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "GetMyTastingsList");
            //Console.WriteLine("GetMyTastingsList service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 20
0
 public override void ViewDidLoad()
 {
     try
     {
         LoggingClass.LogInfo("Entered into detail view of " + WineBarcode, screenid);
         BTProgressHUD.Show();
         nfloat              width  = View.Frame.Width;
         ServiceWrapper      svc    = new ServiceWrapper();
         ItemDetailsResponse myData = svc.GetItemDetailsBarcode(WineBarcode, _storeId).Result;
         ItemReviewResponse  rv     = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result;
         TableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
         TableView.AllowsSelection = false;
         TableView.RowHeight       = UITableView.AutomaticDimension;
         TableView.Source          = new SKUDetailTableSource(width, this, NavigationController, myData.ItemDetails, _storeId);
         BTProgressHUD.Dismiss();
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
     }
 }
Esempio n. 21
0
 public override void LayoutSubviews()
 {
     try
     {
         base.LayoutSubviews();
         int imageWidth = 110;                 // + 10;
         imageView.Frame   = new CGRect(5, 5, imageWidth - 10, 155);
         WineName.Frame    = new CGRect(imageWidth, 2, ContentView.Bounds.Width - imageWidth, 60);
         Vintage.Frame     = new CGRect(imageWidth, 62, ContentView.Bounds.Width - imageWidth, 15);
         separator.Frame   = new CGRect(imageWidth, 79, ContentView.Bounds.Width - (imageWidth + 150), 3);
         location.Frame    = new CGRect(imageWidth, 110, ContentView.Bounds.Width - imageWidth, 20);
         ReviewDate.Frame  = new CGRect(imageWidth, 90, ContentView.Bounds.Width - imageWidth, 20);
         heartImage.Frame  = new CGRect(ContentView.Bounds.Width - 30, 2, 25, 25);
         btnItemname.Frame = new CGRect(imageWidth, 2, ContentView.Bounds.Width - imageWidth, 60);
         //Notastings.Frame=new CGRect(imageWidth, 2, ContentView.Bounds.Width - imageWidth, 60);
         //stars.Frame = new CGRect(35, 50, 100, 20);
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
     }
 }
Esempio n. 22
0
 public async Task <int> InsertUpdateReview(Review review)
 {
     sw.Start();
     try
     {
         var    uri     = new Uri(ServiceURL + "InsertUpdateReview/");
         var    content = JsonConvert.SerializeObject(review);
         var    cont    = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
         string Token   = CurrentUser.GetAuthToken();
         client.DefaultRequestHeaders.Accept.Clear();
         client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token);
         var response = await client.PostAsync(uri, cont);
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
     }
     sw.Stop();
     LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "InsertUpdateReview");
     //Console.WriteLine("InsertUpdateReview service Time Elapsed"+sw.Elapsed.TotalSeconds);
     return(1);
 }
Esempio n. 23
0
        public async Task <int> ResendEMail(string CardNumber)
        {
            sw.Start();
            int output = 0;

            try
            {
                var uri = new Uri(ServiceURL + "ResendEmail/" + CardNumber);
                //var content = JsonConvert.SerializeObject(token);
                //var cont = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <int>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Resend Email Service");
            //Console.WriteLine("Resend Email service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 24
0
        public SKUDetailTableSource(nfloat wid, UIViewController parent, UINavigationController navCtrl, ItemDetails Data, int storeid)
        {
            try
            {
                _store = storeid;
                Width  = wid;
                Parent = parent;
                NavigationController = navCtrl;
                data = Data;

                data.Producer       = Data.Producer;
                data.AverageRating  = Data.AverageRating;               // 4.25m;
                data.WineProperties = new Dictionary <string, string>();
                ServiceWrapper     sw      = new ServiceWrapper();
                ItemReviewResponse ratings = sw.GetItemReviewsByWineID(data.Barcode).Result;
                data.Reviews = ratings.Reviews.ToList();
                //temp = new UITableViewCell[17];
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
Esempio n. 25
0
        public override nint GetItemsCount(UICollectionView collectionView, nint section)
        {
            nint cou = 0;

            try
            {
                cou = myData.ItemList.Count;
                //myData.ErrorDescription
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace.ToString());
                UIAlertView alert = new UIAlertView()
                {
                    Title   = "Sorry",
                    Message = "Something went wrong. We are on it"
                };

                alert.AddButton("OK");
                alert.Show();
            }
            return(cou);
        }
Esempio n. 26
0
        public async Task <int> UpdateCustomer(Customer customer)
        {
            sw.Start();
            try
            {
                var    uri     = new Uri(ServiceURL + "UpdateCustomer/");
                var    content = JsonConvert.SerializeObject(customer);
                var    cont    = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                string Token   = CurrentUser.GetAuthToken();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token);
                var response = await client.PostAsync(uri, cont); // In debug mode it do not work, Else it works

                //var result = response.Content.ReadAsStringAsync().Result;
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "UpdateCustomer");
            //Console.WriteLine("UpdateCustomer service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(1);
        }
Esempio n. 27
0
        public async Task <CustomerResponse> InsertUpdateGuest(string token)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                var uri      = new Uri(ServiceURL + "InsertUpdateguests/" + token + "/token/1");
                var content  = JsonConvert.SerializeObject(token);
                var cont     = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <CustomerResponse>(response);
                CurrentUser.PutGuestId(output.customer.CustomerID.ToString());
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Guest Service");
            //Console.WriteLine("Guest service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 28
0
        public async Task <ItemDetailsResponse> GetItemDetailsBarcode(string wineid, int storeid)
        {
            sw.Start();
            ItemDetailsResponse output = null;

            try
            {
                var    uri   = new Uri(ServiceURL + "GetItemDetailsBarcode/" + wineid + "/user/" + storeid);
                string Token = CurrentUser.GetAuthToken();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <ItemDetailsResponse>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "GetItemDetails");
            //Console.WriteLine("GetItemDetails service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Esempio n. 29
0
        public void BindClicks(UIButton btnMan, UIButton btnSec, UIButton btnPP, UIView parentView)
        {
            try
            {
                btnMan.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();//show spinner + text
                };
                btnPP.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);

                    //BTProgressHUD.Dismiss();//show spinner + text
                };
                btnSec.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);
                };
                btnMan.TouchUpInside += (sender, e) =>
                {
                    nfloat width = UIScreen.MainScreen.Bounds.Width;
                    width = width / 2 - 15;

                    UICollectionViewFlowLayout flowLayout;
                    flowLayout = new UICollectionViewFlowLayout()
                    {
                        ItemSize        = new CGSize(width, 325.0f),
                        SectionInset    = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                        ScrollDirection = UICollectionViewScrollDirection.Vertical
                    };
                    NavigationController.NavigationBar.TopItem.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 1), false);
                    LoggingClass.LogInfo("Entered into " + LoggingClass.txtstore1, screen);
                    BTProgressHUD.Dismiss();
                };
                btnSec.TouchUpInside += (sender, e) =>
                {
                    nfloat width = UIScreen.MainScreen.Bounds.Width;
                    width = width / 2 - 15;

                    UICollectionViewFlowLayout flowLayout;
                    flowLayout = new UICollectionViewFlowLayout()
                    {
                        ItemSize        = new CGSize(width, 325.0f),
                        SectionInset    = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                        ScrollDirection = UICollectionViewScrollDirection.Vertical
                    };
                    NavigationController.NavigationBar.TopItem.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 3), false);
                    LoggingClass.LogInfo("Entered into " + LoggingClass.txtstore3, screen);
                    BTProgressHUD.Dismiss();
                    //UIAlertView alert = new UIAlertView()
                    //{
                    //	Title = LoggingClass.txtstore3+" Store",
                    //	Message = "Coming Soon..."
                    //};
                    //LoggingClass.LogInfo("Clicked on "+LoggingClass.txtstore3, screen);
                    //alert.AddButton("OK");
                    //alert.Show();
                    //nfloat width = UIScreen.MainScreen.Bounds.Width;
                    //width = width / 2 - 15;
                    //					UICollectionViewFlowLayout flowLayout;
                    //flowLayout = new UICollectionViewFlowLayout()
                    //{
                    //	ItemSize = new CGSize(width, 325.0f),
                    //						SectionInset = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                    //						ScrollDirection = UICollectionViewScrollDirection.Vertical
                    //					};
                    //NavigationController.NavigationBar.TopItem.Title = "Locations";
                    //NavigationController.PushViewController(new PhyCollectionView(flowLayout, 3), false);
                    //LoggingClass.LogInfo("Entered into "+LoggingClass.txtstore3, screen);
                    //BTProgressHUD.Dismiss();
                };

                btnPP.TouchUpInside += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //async (sender, e)
                    //ServiceWrapper svc = new ServiceWrapper();
                    //string ret = await svc.GetDataAsync();
                    //((UIButton)sender).SetTitle(ret, UIControlState.Normal);
                    nfloat width = UIScreen.MainScreen.Bounds.Width;
                    width = width / 2 - 15;

                    UICollectionViewFlowLayout flowLayout;
                    flowLayout = new UICollectionViewFlowLayout()
                    {
                        //HeaderReferenceSize = new CGSize(width, 275.0f),
                        ItemSize     = new CGSize(width, 325.0f),
                        SectionInset = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                        //SectionInset = new UIEdgeInsets(20, 20, 20, 20),
                        ScrollDirection = UICollectionViewScrollDirection.Vertical
                                          //MinimumInteritemSpacing = 50, // minimum spacing between cells
                                          //MinimumLineSpacing = 50 // minimum spacing between rows if ScrollDirection is Vertical or between columns if Horizontal
                    };
                    LoggingClass.LogInfo("Entered into Point Plesant", screen);
                    NavigationController.NavigationBar.TopItem.Title = "Locations";
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 2), false);

                    BTProgressHUD.Dismiss();
                };
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
        public void UpdateCell(Review review)
        {
            try
            {
                string url = review.SmallImageURL;
                if (url == null)
                {
                    url = review.Barcode + ".jpg";
                }
                imageView.SetImage(BlobWrapper.GetResizedImage(url, new CGRect(0, 0, 100, 155), review.PlantFinal), UIControlState.Normal);
                separator.Image = UIImage.FromFile("separator.png");
                if (review.Vintage.Length < 4)
                {
                    btnItemname.SetTitle(review.Name + " ", UIControlState.Normal);
                }
                else
                {
                    btnItemname.SetTitle(review.Name + " " + review.Vintage, UIControlState.Normal);
                }
                ReviewDate.Text = review.Date.ToString("MM-dd-yyyy");
                Comments.Text   = review.RatingText;
                if (review.RatingText.Length > 97)
                {
                    ReadMore.Frame          = new CGRect(ContentView.Bounds.Width - 25, 160, 70, 25);
                    ReadMore.TouchUpInside += delegate {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = review.RatingText,
                            //Message = "Coming Soon..."
                        };

                        alert.AddButton("OK");
                        alert.Show();
                    };
                }
                if (review.Liked == 1)
                {
                    btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                    //btnLike.TouchUpInside +=async delegate {
                    //	btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    //		SKULike like = new SKULike();
                    //		like.UserID = Convert.ToInt32(CurrentUser.RetreiveUserId());
                    //		like.BarCode = WineIdLabel.Text;
                    //		like.Liked = Convert.ToBoolean(0);
                    //		myItem.IsLike = Convert.ToBoolean(0);
                    //		await sw.InsertUpdateLike(like);
                    //};
                    btnLike.Tag = 1;
                }
                else
                {
                    btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                    btnLike.Tag = 0;
                }
                //if (review.  == true)
                //	{
                //		heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                //	}
                //CGSize sTemp = new CGSize(ContentView.Frame.Width, 100);
                //sTemp = Comments.SizeThatFits(sTemp);
                //if (review.RatingText.Length > 100)
                //{
                //	//ContentView.AddSubview(ReadMore);
                //	ReadMore.TouchUpInside += delegate {
                //		{
                //			UIAlertView alert = new UIAlertView()
                //			{
                //				Title = review.RatingText,
                //				//Message = "Coming Soon..."
                //			};

                //			alert.AddButton("OK");
                //			alert.Show();
                //		};
                //	};
                //	//ReadMore.Hidden = false;
                //}
                //Vintage.Text = " ";//"Vintage:"+review.Vintage.ToString();
                storeid          = Convert.ToInt32(review.PlantFinal);
                WineIdLabel.Text = review.Barcode.ToString();
                ReadMore.SetTitle("... Read More", UIControlState.Normal);
                ReadMore.SetTitleColor(UIColor.Black, UIControlState.Normal);
                ReadMore.BackgroundColor = UIColor.White;
                stars.AverageRating      = Convert.ToDecimal(review.RatingStars);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }