public async Task <CustomerResponse> ContinueService(CustomerResponse customer)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                var    uri     = new Uri(ServiceURL + "ContinueClick/");
                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).ConfigureAwait(false);

                if (response.IsSuccessStatusCode)
                {
                    var tokenJson = await response.Content.ReadAsStringAsync();

                    output = JsonConvert.DeserializeObject <CustomerResponse>(tokenJson);
                }
                //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(output);
        }
        public async Task <ItemListResponse> GetItemLists(int storeId, int userId)
        {
            sw.Start();
            ItemListResponse output = null;

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

                //Console.WriteLine(DateTime.Now+" Got responce object");
                output = JsonConvert.DeserializeObject <ItemListResponse>(response);
                //Console.WriteLine(DateTime.Now+" Deserialization Done");
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("GetItemList service Time Elapsed" + sw.Elapsed.TotalSeconds, "ItemList");
            //Console.WriteLine("GetItemList service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Example #3
0
        public async void SaveReview()
        {
            try
            {
                BTProgressHUD.Show("Saving the review...");
                ServiceWrapper sw     = new ServiceWrapper();
                Review         review = new Review();
                review.ReviewDate   = DateTime.Now;
                review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                if (txtComments.Text == "Describe your tasting")
                {
                    txtComments.Text = "";
                }
                string reviewtxt = txtComments.Text;
                reviewtxt.Trim();
                review.RatingText  = reviewtxt;
                review.IsActive    = true;
                review.PlantFinal  = storeid.ToString();
                review.RatingStars = Convert.ToInt32(StartsSelected);
                //review.SKU = SKU;
                review.Barcode = WineId;

                await sw.InsertUpdateReview(review);

                //NavController.DismissViewController(true, null);
                BTProgressHUD.ShowSuccessWithStatus("Thank you!!!", 2000);
                ((IPopupParent)parent).RefreshParent();
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
        public async Task <CustomerResponse> UpdateMail(string email, string userid)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                BTProgressHUD.Show(LoggingClass.txtpleasewait);
                var    uri     = new Uri(ServiceURL + "UpdateEmailAddress/" + email + "/user/" + userid);
                var    content = JsonConvert.SerializeObject(email);
                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.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <CustomerResponse>(response);
                BTProgressHUD.Dismiss();
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo(userid + "user updated Service," + email, "Email Service,");
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Email Service,");
            return(output);
        }
        public async Task <int> InsertUpdateToken(string token, string user_id)
        {
            sw.Start();
            try
            {
                var    uri     = new Uri(ServiceURL + "UpdateDeviceToken1/" + user_id + "/token/" + token.Replace(" ", "") + "/DeviceType/2");
                var    content = JsonConvert.SerializeObject(token);
                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(CurrentUser.GetCardNumber() + " User Device token " + token.Replace(" ", ""), "InsertUpdateToken");
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "InsertUpdateToken");
            //Console.WriteLine("InsertUpdateToken service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(1);
        }
        public override void WillEnterForeground(UIApplication application)
        {
            // Called as part of the transiton from background to active state.
            // Here you can undo many of the changes made on entering the background.
            try
            {
                if (LoggingClass.loginview == true)
                {
                    LoginViewController lv = new LoginViewController();
                    lv.EmailVerification(true);
                    //UIAlertView alert = new UIAlertView()
                    //{
                    //	Title = lv.ToString(),
                    //	//Message = "Coming Soon..."
                    //};

                    //alert.AddButton("OK");
                    //alert.Show();
                }
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screen, exe.StackTrace);
            }
        }
 public override void LayoutSubviews()
 {
     try
     {
         base.LayoutSubviews();
         int imageWidth = 165;                 // + 10;
         imageView.Frame = new CGRect(5, 5, 130, 130);
         //imageView.Bounds = new CGRect(3, 3, 133, 133);
         imageView.Layer.ShadowRadius = 10.0f;
         imageView.Layer.ShadowColor  = UIColor.Black.CGColor;
         imageView.Layer.ShadowOffset = new CGSize(2, 2);
         //btnBack.Frame = new CGRect(2, 2, 132, 132);
         btnItemname.Frame            = new CGRect(imageWidth - 4, 2, ContentView.Bounds.Width - imageWidth - 60, 60);
         separator.Frame              = new CGRect(imageWidth, 79, btnItemname.Frame.Width - 100, 3);
         ReviewDate.Frame             = new CGRect(imageWidth, 85, ContentView.Bounds.Width - imageWidth, 20);
         stars.Frame                  = new CGRect(imageWidth - 4, 60, 60, 20);
         stars.UserInteractionEnabled = false;
         Comments.Frame               = new CGRect(imageWidth - 4, 99, ContentView.Bounds.Width - imageWidth - 2, 70);
         btnEdit.Frame                = new CGRect(ContentView.Bounds.Width - 60, 10, 25, 25);
         btnDelete.Frame              = new CGRect(ContentView.Bounds.Width - 30, 10, 25, 25);
         btnLike.Frame                = new CGRect(ContentView.Bounds.Width - 30, 40, 25, 25);
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
     }
 }
        public async Task <CustomerResponse> AuthencateUser(string Email, string CardId, string uid)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                var uri       = new Uri(ServiceURL + "AuthenticateUserBeta/" + CardId + "/email/" + Email + "/DeviceId/" + uid);
                var byteArray = new UTF8Encoding().GetBytes(CardId + ":password");
                client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                var response = await client.GetAsync(uri).ConfigureAwait(false);

                if (response.IsSuccessStatusCode)
                {
                    string Token = response.RequestMessage.Headers.Authorization.Parameter;
                    CurrentUser.SaveAuthToken(Token);
                    output = JsonConvert.DeserializeObject <CustomerResponse>(response.Content.ReadAsStringAsync().Result);
                    //var response = await client.GetStringAsync(uri).ConfigureAwait(false);
                    output = JsonConvert.DeserializeObject <CustomerResponse>(response.Content.ReadAsStringAsync().Result);
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Authencate Card and sending mail");
            //Console.WriteLine("Authencate Card and sending mail service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
Example #9
0
        protected async void Handle_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e)
        {
            try
            {
                //Console.WriteLine("Enterd into Gallery pick");
                // determine what was selected, video or image
                bool isImage = false;
                switch (e.Info[UIImagePickerController.MediaType].ToString())
                {
                case "public.image":
                    //Console.WriteLine("Image selected");
                    isImage = true;
                    break;

                case "public.video":
                    //Console.WriteLine("Video selected");
                    break;
                }
                if (isImage)
                {
                    // get the original image

                    UIImage originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage;
                    if (originalImage != null)
                    {
                        // do something with the image

                        //Console.WriteLine("got the original image");
                        imgprofilepic.Image = originalImage;                         // display
                        using (NSData imagedata = originalImage.AsJPEG())
                        {
                            byte[] myByteArray = new byte[imagedata.Length];
                            System.Runtime.InteropServices.Marshal.Copy(imagedata.Bytes,
                                                                        myByteArray, 0, Convert.ToInt32(imagedata.Length));

                            byte[] img = BlobWrapper.ResizeImageIOS(myByteArray, 250, 300);
                            int    i   = img.Length;
                            await BlobWrapper.UploadProfilePic(img, i);
                        }
                    }
                }
                else
                {                 // if it's a video
                                  // get video url
                    NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl;
                    if (mediaURL != null)
                    {
                        //Console.WriteLine(mediaURL.ToString());
                    }
                }
                // dismiss the picker
                imagePicker.DismissModalViewController(true);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
Example #10
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);
                }
                else if (CurrentUser.GetStore() == 3)
                {
                    NavigationController.PushViewController(new PhyCollectionView(flowLayout, 3), 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);
        }
        public override void ViewDidLoad()
        {
            LoggingClass.LogInfo("Entered into favorite", screen);
            try
            {
                this.CollectionView.Add(refreshControl);
                refreshControl.ValueChanged += (rcSender, e) =>
                {
                    //Refresh this view
                    myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
                    if (myData.ItemList.Count == 0)
                    {
                        UIImageView ImgIns = new UIImageView();
                        ImgIns.Image = UIImage.FromFile("FavIns.png");
                        UILabel NoFav = new UILabel();
                        NoFav.Text          = myData.ErrorDescription;
                        NoFav.LineBreakMode = UILineBreakMode.WordWrap;
                        NoFav.Lines         = 0;
                        CGSize sTemp = new CGSize(View.Frame.Width, 100);
                        sTemp               = NoFav.SizeThatFits(sTemp);
                        NoFav.Frame         = new CGRect(0, 50, View.Frame.Width - 20, sTemp.Height);
                        NoFav.TextAlignment = UITextAlignment.Center;
                        ImgIns.Frame        = new CGRect((View.Frame.Width / 2) - 100, 50 + sTemp.Height + 20, 202, 381);
                        CollectionView.AddSubview(NoFav);
                        CollectionView.AddSubview(ImgIns);
                    }
                    CollectionView.ReloadData();
                    refreshControl.EndRefreshing();
                };

                myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
                if (myData.ItemList.Count == 0)
                {
                    UIImageView ImgIns = new UIImageView();
                    ImgIns.Image = UIImage.FromFile("FavIns.png");
                    UILabel NoFav = new UILabel();
                    NoFav.Text          = myData.ErrorDescription;
                    NoFav.LineBreakMode = UILineBreakMode.WordWrap;
                    NoFav.Lines         = 0;
                    CGSize sTemp = new CGSize(View.Frame.Width, 100);
                    sTemp               = NoFav.SizeThatFits(sTemp);
                    NoFav.Frame         = new CGRect(0, 50, View.Frame.Width - 20, sTemp.Height);
                    NoFav.TextAlignment = UITextAlignment.Center;
                    ImgIns.Frame        = new CGRect((View.Frame.Width / 2) - 100, 50 + sTemp.Height + 20, 202, 381);
                    CollectionView.AddSubview(NoFav);
                    CollectionView.AddSubview(ImgIns);
                }
                BTProgressHUD.Dismiss();
                this.View.BackgroundColor           = new UIColor(256, 256, 256, 0.8f);
                this.CollectionView.BackgroundColor = UIColor.White;
                CollectionView.RegisterClassForCell(typeof(MyFavViewCell), MyFavViewCell.Key);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
Example #12
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());
            }
        }
Example #13
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 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());
            }
        }
Example #15
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 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 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);
			}
		}
 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);
     }
 }
Example #19
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);
            }
        }
Example #21
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);
            }
        }
Example #22
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);
     }
 }
Example #23
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);
            }
        }
Example #24
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);
        }
Example #25
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);
        }
Example #26
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);
        }
Example #27
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);
        }
Example #28
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);
        }
Example #29
0
 public override void ViewDidLoad()
 {
     try
     {
         LoggingClass.LogInfo("Entered into detail view of " + WineBarcode, screenid);
         BTProgressHUD.Show();
         nfloat              width  = View.Frame.Width;
         ServiceWrapper      svc    = new ServiceWrapper();
         ItemDetailsResponse myData = svc.GetItemDetailsBarcode(WineBarcode, _storeId).Result;
         ItemReviewResponse  rv     = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result;
         TableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
         TableView.AllowsSelection = false;
         TableView.RowHeight       = UITableView.AutomaticDimension;
         TableView.Source          = new SKUDetailTableSource(width, this, NavigationController, myData.ItemDetails, _storeId);
         BTProgressHUD.Dismiss();
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
     }
 }
Example #30
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);
     }
 }