public async void OnLogin(object password) { try { Messenger.Default.Register <string>(this, "Encryption", EncryptPassword); string currencyCode = Windows.Globalization.Language.CurrentInputMethodLanguageTag; Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = currencyCode; string intLoginId = IntegratedLogin ? (IntegratedLoginID == null) ? string.Empty : IntegratedLoginID : null; T360Validator.ValidateLogin(UserName, (string)password, intLoginId); IsBusy = true; UserPreference.Instance.HasSaveUserName = SaveUserName; UserPreference.Instance.UserName = UserName; UserPreference.Instance.HasIntegratedLogin = IntegratedLogin; await ServiceInvoker.Instance.Initialize(); var serializableData = GetLoginParameter(password); LoginInfo = await ServiceInvoker.Instance.InvokeServiceUsingPost <LoginInfo>(ServiceInvoker.Instance.AppendUrl(ServiceInvoker.DoLogin), serializableData, false, true); IsBusy = false; Messenger.Default.Unregister <string>(this, "Encryption", EncryptPassword); Navigator.Navigate(Destination.DashboardView, ExistingViewBehavior.Remove, LoginInfo); } catch (T360Exception ex) { if (T360ErrorCodes.DisclaimerError.Equals(ex.ErrorCodes[0].Code)) { LoginInfo = new LoginInfo(); LoginInfo.DisclaimerTitle = ex.ErrorCodes[0].Data[0]; LoginInfo.DisclaimerData = ex.ErrorCodes[0].Data[1]; LoginInfo.HasDisclaimer = true; LoginInfo.IsAuthenticated = true; Navigator.Navigate(Destination.DisclaimerView, ExistingViewBehavior.Remove, LoginInfo); } else if (T360ErrorCodes.PasswordReset.Equals(ex.ErrorCodes[0].Code) || T360ErrorCodes.RequestPasswordReset.Equals(ex.ErrorCodes[0].Code) || T360ErrorCodes.TooSimplePassword.Equals(ex.ErrorCodes[0].Code)) { Credential = new Credential(); Credential.Rules = ex.ErrorCodes[0].Data; Credential.ShowKeepCurrentPassword = T360ErrorCodes.RequestPasswordReset.Equals(ex.ErrorCodes[0].Code); Navigator.Navigate(Destination.ResetPasswordView, ExistingViewBehavior.Remove, Credential); } else { Password = string.Empty; IntegratedLoginID = string.Empty; string message = getMessages(ex); ShowErrorMessage(message, Constants.LoginFailed); } } }
public async Task SaveRejection() { try { T360Validator.ValidateRejectInvoice(SelectedReasonId, NarrativeText); var isOk = await ShowConfirmationMessage(Constants.RejectConfirmationMsg, Constants.RejectConfirmation); if (!isOk) { return; } RejectionData = new InvoiceReject(); RejectionData.ReasonId = SelectedReasonId; RejectionData.NarrativeText = NarrativeText; RejectionData.InvoiceId = InvoiceSummary.InvoiceId; IsBusy = true; var serializableData = GetRejectSerializationData(RejectionData); var data = await ServiceInvoker.Instance.InvokeServiceUsingPost <string>(ServiceInvoker.Instance.AppendUrl(ServiceInvoker.RejectInvoiceService), serializableData, true, false); IsBusy = false; Messenger.Default.Send <ResetListParameter>(new ResetListParameter() { }); Messenger.Default.Send <InvoiceParameter>(new InvoiceParameter() { Invoice = null }, Constants.SetInvoice); if (ServiceInvoker.Success.Equals(data)) { Navigator.Navigate(Destination.InvoiceListView); } } catch (T360Exception ex) { string message = getMessages(ex); ShowErrorMessage(message, Constants.RejectionFailed); } }
public async void SaveAdjustment() { try { T360Validator.ValidateAdjustInvoice(AdjustedAmount.ToString(), SelectedReasonId); var isOk = await ShowConfirmationMessage(Constants.AdjustConfirmationMsg, Constants.AdjustmentConfirmation); if (!isOk) { return; } IsBusy = true; AdjustmentInfo = new InvoiceAdjustment(); AdjustmentInfo.NarrativeText = NarrativeText; AdjustmentInfo.AdjustmentStyle = AdjustmentByTo; AdjustmentInfo.InvoiceId = this.InvoiceSummary.InvoiceId.ToString(); AdjustmentInfo.AdjustmentAmount = AdjustmentSign == AdjustmentSign.Positive ? Convert.ToDouble(AdjustedAmount).ToString(CultureInfo.InvariantCulture) : "-" + Convert.ToDouble(AdjustedAmount).ToString(CultureInfo.InvariantCulture); AdjustmentInfo.ReasonId = SelectedReasonId; AdjustmentInfo.NetTotal = CleanNetTotal(NetAmount, true); AdjustmentInfo.AdjustmentMode = AdjustmentToggleType; AdjustmentInfo.AdjustmentType = AdjustmentType; var serializableData = GetAdjustmentSerializationData(AdjustmentInfo); var data = await ServiceInvoker.Instance.InvokeServiceUsingPost <string>(ServiceInvoker.Instance.AppendUrl(ServiceInvoker.AdjustInvoiceService), serializableData, true, false); IsBusy = false; Messenger.Default.Send <ResetListParameter>(new ResetListParameter() { }); Navigator.Navigate(Destination.InvoiceListView, ExistingViewBehavior.Remove, new object[] { }); } catch (T360Exception ex) { string message = getMessages(ex); ShowErrorMessage(message, Constants.AdjustmentFailed); } }