예제 #1
0
		public async void ShowInfo(CustomerResponse cr, Boolean Continue)
		{
			BTProgressHUD.Show("Please wait...");
			CGSize sTemp = new CGSize(View.Frame.Width, 100);
			try
			{
				if (CardNumber != null)
				{
					CurrentUser.PutCardNumber(CardNumber);
				}
				if (cr != null)
				{

					if (cr.customer.Email != "" && cr.customer.Email != null)
					{
						if ((cr.ErrorDescription == null && cr.ErrorDescription == "") || cr.customer.CustomerID != 0)
						{
							lblInfo.Text = "Hi " + cr.customer.FirstName + " " +
								cr.customer.LastName + ",\nWe have sent you a verification link to "
								+ cr.customer.Email + ". Please click on the activation link to activate the account.";
						}
						else
						{
							lblInfo.Text = cr.ErrorDescription;
						}
						lblInfo.LineBreakMode = UILineBreakMode.WordWrap;
						lblInfo.Lines = 0;
						sTemp = lblInfo.SizeThatFits(sTemp);
						//Console.WriteLine("Show info "+y);
						lblInfo.Frame = new CGRect(10, y, View.Frame.Width - 10, sTemp.Height);
						lblInfo.TextAlignment = UITextAlignment.Left;
						lblInfo.TextColor = UIColor.Black;
						CurrentUser.StoreId(cr.customer.CustomerID.ToString());
						try
						{
							BtnTest1.Hidden = true;
							BtnTest2.Hidden = true;
							btnLogin.Hidden = false;
							btnResend.Hidden = false;
						}
						catch (Exception exe)
						{
							//Console.WriteLine(exe.Message);
						}

						start = 0;
						start = y + lblInfo.Frame.Height + 10;
						btnLogin.Frame = new CGRect(180, start, 120, 30);
						btnResend.Frame = new CGRect(30, start, 120, 30);

						btnResend.TouchUpInside += async (send, eve) =>
						{
							BTProgressHUD.Show("Sending verification email to " + cr.customer.Email);
							if (CardNumber != null)
							{
								await svc.ResendEMail(CardNumber);
							}
							else
							{
								await svc.ResendEMail(CurrentUser.GetCardNumber());
							}
							BTProgressHUD.ShowSuccessWithStatus("Sent");
						};
						btnLogin.TouchUpInside += (sen, ev) =>
						{
							try
							{
								BTProgressHUD.Show("Checking email verification");
								EmailVerification(false);
							}
							catch (Exception ex)
							{
								//LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
							}

						};
						BTProgressHUD.Dismiss();
					}
					else
					{
						lblInfo.Text = cr.ErrorDescription;
						//lblInfo.TextAlignment = UITextAlignment.Center;
						lblInfo.TextColor = UIColor.Red;
						try
						{
							btnLogin.Hidden = true;
							btnResend.Hidden = true;
						}
						catch (Exception exe)
						{
							//LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
						}
						sTemp = lblInfo.SizeThatFits(sTemp);
						lblInfo.Frame = new CGRect(0, start, View.Frame.Width - 10, sTemp.Height);
						BTProgressHUD.Dismiss();
					}
				}
				else
				{

					lblInfo.Text = "Sorry. Your Card number is not matching our records.\n Please re-scan Or Try app as Guest Log In.";
					lblInfo.TextColor = UIColor.Red;
					lblInfo.TextAlignment = UITextAlignment.Center;
					sTemp = lblInfo.SizeThatFits(sTemp);
					lblInfo.Frame = new CGRect(0, start, View.Frame.Width - 10, sTemp.Height);
					try
					{
						if (btnLogin != null || btnResend != null)
						{
							btnLogin.SetTitleColor(UIColor.White, UIControlState.Normal);
							btnResend.SetTitleColor(UIColor.White, UIControlState.Normal);
							btnLogin.BackgroundColor = UIColor.White;
							btnResend.BackgroundColor = UIColor.White;
						}
					}
					catch (Exception ex)
					{
						//LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
					}
					BTProgressHUD.Dismiss();
				}
				BTProgressHUD.Dismiss();
			}
			catch (Exception exe)
			{
				lblInfo.Text = "Something went wrong.We're on it.";
				lblInfo.TextColor = UIColor.Red;
				sTemp = lblInfo.SizeThatFits(sTemp);
				lblInfo.Frame = new CGRect(0, start, View.Frame.Width - 10, sTemp.Height);
				LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
			}
			BTProgressHUD.Dismiss();
		}
예제 #2
0
		public async void PreInfo(string CardNumber)
		{
			CGSize sTemp = new CGSize(View.Frame.Width, 100);
			try
			{
				if (btnLogin != null && btnResend != null)
				{
					btnLogin.Hidden = true;
					btnResend.Hidden = true;
				}
				BTProgressHUD.Show(LoggingClass.txtpleasewait);
				try
				{
					EmailVerification(true);
				}
				catch (Exception exe)
				{
					//Console.WriteLine(exe.Message, exe.StackTrace);
				}
				cr = await svc.AuthencateUser("email", CardNumber, uid_device);
				if (CardNumber != null)
				{
					CurrentUser.PutCardNumber(CardNumber);
				}
				if (cr != null)
				{
					//Updating device token in different thread
					var TaskA = new System.Threading.Tasks.Task(() =>
					{
						updatetoken(cr);
					});
					TaskA.Start();
					//Storing customerid and updating the device tokens
					CurrentUser.StoreId(cr.customer.CustomerID.ToString());
					if (cr.customer.Email != null && cr.customer.Email != "")
					{
						if ((cr.ErrorDescription == null && cr.ErrorDescription == "") && cr.customer.CustomerID != 0)
						{
							//Console.WriteLine("Error Description is not there");
							lblInfo.Text = "Hi " + cr.customer.FirstName
								+ " " + cr.customer.LastName +
								", \nWe are sending a verification email to " +
								cr.customer.Email +
								" . To proceed press continue.\nTo change your emailAddress click on Update.";
						}
						else
						{
							lblInfo.Text = cr.ErrorDescription;
						}
						lblInfo.LineBreakMode = UILineBreakMode.WordWrap;
						lblInfo.TextAlignment = UITextAlignment.Justified;
						lblInfo.Lines = 0;
						sTemp = lblInfo.SizeThatFits(sTemp);
						if (screenheight <= 568)
						{
							y = y - 80;
							lblInfo.Frame = new CGRect(10, y, View.Frame.Width - 10, sTemp.Height);
						}
						else
						{
							lblInfo.Frame = new CGRect(10, y, View.Frame.Width - 10, sTemp.Height);
						}
						lblInfo.TextAlignment = UITextAlignment.Left;
						lblInfo.TextColor = UIColor.Black;
						lblInfo.Font = UIFont.FromName("HelveticaNeue", 15f);
						CurrentUser.StoreId(cr.customer.CustomerID.ToString());
						start = 0;
						start = y + lblInfo.Frame.Height + 10;
						//Console.WriteLine("Error " + cr.ErrorDescription);
						BtnTest1.Frame = new CGRect(180, start, 120, 30);
						BtnTest2.Frame = new CGRect(30, start, 140, 30);
						try
						{
							BtnTest1.Hidden = false;
							BtnTest2.Hidden = false;
						}
						catch (Exception ex)
						{
							//LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
						}
						BtnTest1.TouchUpInside += async delegate
						 {
							 BTProgressHUD.Show(LoggingClass.txtloading);
							 cr = await svc.ContinueService(cr);
							 ShowInfo(cr, false);
							 //btnCardScanner.Hidden = true;
						 };
						BtnTest2.TouchUpInside += delegate
						{
							BTProgressHUD.Show(LoggingClass.txtloading);
							UpdateEmail("Please enter your new E-mail Id");
							//btnCardScanner.Hidden = true;
						};
					}
					else
					{
						emailnotpresent = true;
						//Console.WriteLine("Error Discription before if " + cr.ErrorDescription);
						if ((cr.ErrorDescription == null && cr.ErrorDescription == "") || cr.customer.CustomerID != 0)
						{
							//Console.WriteLine("Error Discription in if " + cr.ErrorDescription);
							UpdateEmail("Hi " + cr.customer.FirstName + cr.customer.LastName +
										", \nIt seems we do not have your email address! Please update it so we can send you a verification link that will activate your account.");
						}
						else
						{
							UpdateEmail(cr.ErrorDescription);
						}
					}
					BTProgressHUD.Dismiss();

				}
				else
				{
					try
					{
						BtnTest2.Hidden = true;
						BtnTest1.Hidden = true;
						btnLogin.Hidden = true;
						btnResend.Hidden = true;
					}
					catch (Exception ex)
					{
						//Console.WriteLine(ex.Message);
					}
					lblInfo.Text = "Sorry. Your Card number is not matching our records.\n Please re-scan Or Try app as Guest Log In.";
					lblInfo.TextColor = UIColor.Red;
					lblInfo.TextAlignment = UITextAlignment.Center;
					sTemp = lblInfo.SizeThatFits(sTemp);
					lblInfo.Frame = new CGRect(0, y, View.Frame.Width - 10, sTemp.Height);
					BTProgressHUD.Dismiss();
				}
			}
			catch (Exception ex)
			{
				//Console.WriteLine(ex.Message);
			}
		}