public CheckConfirmEmailAddressResponse checkConfirmEmailAddress(ConfirmEmailAddressRequest request, string token) { CheckConfirmEmailAddressResponse res = new CheckConfirmEmailAddressResponse(); try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "RegistrationMobile/checkConfirmEmailAddress"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var myContent = JsonConvert.SerializeObject(request); var buffer = Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = client.PostAsync(client.BaseAddress, byteContent).Result; if (response.IsSuccessStatusCode) { var responseStream = response.Content.ReadAsStringAsync().Result; res = JsonConvert.DeserializeObject <CheckConfirmEmailAddressResponse>(responseStream); } } } catch (Exception ex) { throw ex; } return(res); }
private CheckConfirmEmailAddressResponse checkConfirmEmailAddress(ConfirmEmailAddressRequest request) { CheckConfirmEmailAddressResponse response = new CheckConfirmEmailAddressResponse(); LoginController controller = new LoginController(); response = controller.checkConfirmEmailAddress(request, token); return(response); }
public enterConfirmationCodePage(int customerId) { InitializeComponent(); request = new ConfirmEmailAddressRequest(); response = null; token = App.Current.Properties["currentToken"].ToString(); emailAddressLabel.Text = Constants.cutomerAuthContext.CustomerEmail; this.customerId = customerId; this.confirmationType = emailConfirmationType.LogIn; this.fromVal = 0; }
public CheckConfirmEmailAddressResponse checkConfirmEmailAddress(ConfirmEmailAddressRequest request, string token) { CheckConfirmEmailAddressResponse response = new CheckConfirmEmailAddressResponse(); try { response = loginservice.checkConfirmEmailAddress(request, token); } catch (Exception ex) { throw ex; } return(response); }
private async void ConfirmBtn_Clicked(object sender, EventArgs e) { try { if (ContactNoEntry.Text == null) { // Use default vibration length Vibration.Vibrate(); codeFrame.BorderColor = Color.Red; codeFrameshakeAnimation(); } else { string code = ContactNoEntry.Text.Replace(" ", "").Trim(); if (code.Length < 6) { Vibration.Vibrate(); codeFrame.BorderColor = Color.Red; codeFrameshakeAnimation(); ContactNoEntry.Text = null; } else { request.ClientId = Constants.ClientId; request.CustomerId = Constants.cutomerAuthContext.CustomerId; request.Email = Constants.cutomerAuthContext.CustomerEmail; request.ConfirmationCode = code; bool busy = false; if (!busy) { try { busy = true; await PopupNavigation.Instance.PushAsync(new LoadingPopup("Loading details...")); await Task.Run(async() => { try { response = checkConfirmEmailAddress(request); } catch (Exception ex) { await PopupNavigation.Instance.PushAsync(new Error_popup(ex.Message)); } }); } finally { busy = false; if (PopupNavigation.Instance.PopupStack.Count == 1) { await PopupNavigation.Instance.PopAllAsync(); } if (PopupNavigation.Instance.PopupStack.Count > 1) { if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup)) { await PopupNavigation.Instance.PopAllAsync(); } } if (response != null) { if (response.refId == 1) { if (App.Current.Properties.ContainsKey("CustomerId")) { App.Current.Properties["CustomerId"] = customerId; } else { App.Current.Properties.Add("CustomerId", customerId); } if (fromVal == 1) { await Navigation.PushModalAsync(new EmailonfirmSuccess(confirmationType, fromVal)); } else { await Navigation.PushModalAsync(new EmailonfirmSuccess(confirmationType)); } } else if (response.refId == 2) { await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, your confirmation code was expired. Please resend code. ")); } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Invalid confirmation code")); } } else { await PopupNavigation.Instance.PushAsync(new Error_popup("Something went wrong, Please try again.")); } } } } } } catch (FeatureNotSupportedException ex) { // Feature not supported on device } catch (Exception ex) { // Other error has occurred. } //Navigation.PushAsync(new EmailonfirmSuccess()); }