protected async void GotoPage(string p) { if (IsBusy || IsLoading) { // Message Tosat ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; await NavigationService.NavigateAsync($"{p}"); IsLoading = false; }
private async void GotoCancel() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; await NavigationService.GoBackAsync().ConfigureAwait(false); IsLoading = false; }
private async void OnGotoPageCommand(string p) { if (IsBusy || IsLoading) { // Message toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; await NavigationService.NavigateAsync($"{p}").ConfigureAwait(false); IsLoading = false; }
public ManualPaymentViewModel(INavigationService navigationService, IEventAggregator ea, IAuthentication authentication, IUserInformation userinformation, IFeature makepayment) : base(navigationService) { _authentication = authentication; _userinformation = userinformation; _makepayment = makepayment; _ea = ea; PreviousText.Value = TranslateManagerHelper.Convert("cancel").ToUpperInvariant(); NextText.Value = TranslateManagerHelper.Convert("next").ToUpperInvariant(); Initialize(); }
protected void Initialize() { IsLoading = true; Items = new ObservableCollection <SlideItem>() { new SlideItem() { Icon = "icon-pay_bills_electricity", PrimayText = TranslateManagerHelper.Convert("electricity").ToUpperInvariant(), Url = "" }, new SlideItem() { Icon = "icon-pay_bills_water", PrimayText = TranslateManagerHelper.Convert("water").ToUpperInvariant(), Url = "" }, }; IsLoading = false; }
protected void Initialize() { IsLoading = true; Items = new ObservableCollection <SlideItem>() { new SlideItem() { Icon = "icon-pay_bills_internet", PrimayText = TranslateManagerHelper.Convert("airtime").ToUpperInvariant(), Url = "" }, new SlideItem() { Icon = "icon-chart-bar", PrimayText = TranslateManagerHelper.Convert("data").ToUpperInvariant(), Url = "" }, }; IsLoading = false; }
private async void GotoAccept() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; string message = null; if (string.IsNullOrEmpty(MerchantId.Value)) { message = TranslateManagerHelper.Convert("merchant_error"); } else if (string.IsNullOrEmpty(Amount.Value) || decimal.Parse(Amount.Value) <= 0) { message = TranslateManagerHelper.Convert("amount_error"); } else if (string.IsNullOrEmpty(Currency.Value)) { message = TranslateManagerHelper.Convert("source_account_error"); } if (!string.IsNullOrEmpty(message)) { var parameters1 = new NavigationParameters { { Constants.PopupIsSucces, false }, { Constants.PopupMessage, message }, { Constants.PopupNextPage, FunctionName.MerchantPayment } }; await NavigationService.NavigateAsync(PopupName.SuccessfullPopup, parameters1).ConfigureAwait(false); IsLoading = false; return; } var parameters = new NavigationParameters { { Constants.PopupId, "QR_CODE_PAYMENT" }, }; await NavigationService.NavigateAsync(PopupName.PinCodePopup, parameters).ConfigureAwait(false); IsLoading = false; }
public async void Load() { if (!IsLoaded) { var response = await _fMPlatform.GetApplicationBySystemId(_authentication.GetToken(), ApiConstants.SystemId); if (response?.isuccess == true) { App = response.data; IsLoaded = true; } else { DependencyService.Get <IMessage>().ShowSnackBarNetwork(TranslateManagerHelper.Convert("network_unavailable_token")); } } }
private void GotoValidate() { PinCode.HasError = false; PinCode.ErrorText = ""; if (string.IsNullOrEmpty(PinCode.Value)) { PinCode.HasError = true; PinCode.ErrorText = TranslateManagerHelper.Convert("pincode_cannot_empty"); return; } if (PinCode.Value.Length <= PinCodeMinLength.Value) { PinCode.HasError = true; PinCode.ErrorText = TranslateManagerHelper.Convert("pincode_is_short"); return; } if (PinCode.Value != _userInformation.Password) { PinCode.HasError = true; PinCode.ErrorText = TranslateManagerHelper.Convert("pincode_is_incorrect"); return; } if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; var parameters = new NavigationParameters { { Constants.PopupId, _id }, { Constants.PopupResponseData, true } }; NavigationService.GoBackAsync(parameters); IsLoading = false; }
private async void LoadGiftCard() { if (IsBusy || IsLoading) { // Message toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; var listr = await _applicationsService.GetApplicationUserGiftcards(_authentication.GetToken(), _appInfo.App.Id, _userInformation.UserId); if (listr != null && listr?.isuccess == true) { Items = listr.data.Select(x => new GiftCardModel { GiftCardNumber = x.Number, Currency = x.CurrencyCode, Amount = x.Value.ToString(), QRCodeData = x.QrCode }).ToObservableCollection(); } else { string message; switch (listr?.errcode) { case "EXCEPTION": message = TranslateManagerHelper.Convert("operation_failed"); break; default: message = !string.IsNullOrEmpty(listr.msg) ? listr?.msg : TranslateManagerHelper.Convert("error_contact_support"); break; } var parameters = new NavigationParameters { { Constants.PopupIsSucces, false }, { Constants.PopupIsBeforeHome, false }, { Constants.PopupMessage, message }, { Constants.PopupNextPage, FunctionName.GiftCard } }; await NavigationService.NavigateAsync(PopupName.SuccessfullPopup, parameters).ConfigureAwait(false); } IsEmpty = Items.Count == 0; IsLoading = false; }
private void Initialize() { SubMenus = new ObservableCollection <SubMenuModel>() { new SubMenuModel() { Title = TranslateManagerHelper.Convert("merchant_payment").ToUpperInvariant(), SecondDescription = TranslateManagerHelper.Convert("scan_merchant_qr_code"), Icon = "icon-qr_code", Url = "MerchantPaymentQRCode" }, new SubMenuModel() { Title = TranslateManagerHelper.Convert("manual_payment").ToUpperInvariant(), SecondDescription = TranslateManagerHelper.Convert("scan_merchant_qr_code"), Icon = "icon-qr_code", Url = "MerchantPaymentManual" } }; }
private void Initialize() { SubMenus = new ObservableCollection <SubMenuModel>() { new SubMenuModel() { Title = TranslateManagerHelper.Convert("with_card").ToUpperInvariant(), SecondDescription = TranslateManagerHelper.Convert("use_your_card"), Icon = "icon-kash_in_with_card_method_sub", Url = "KashInWithCard" }, new SubMenuModel() { Title = TranslateManagerHelper.Convert("with_bank").ToUpperInvariant(), SecondDescription = TranslateManagerHelper.Convert("use_your_bank_account"), Icon = "icon-kash_in_with_bank_method_sub", Url = "KashInWithCard" } }; }
public static void LoadApiConfiguration(ApiConfiguration apiConfiguration) { if (apiConfiguration == null || apiConfiguration == default) { DependencyService.Get <IMessage>().ShowSnackBarNetwork(TranslateManagerHelper.Convert("error_occured_application_loading")); System.Diagnostics.Debug.WriteLine($"Appli Client error ApiConstants.LoadApiConfiguration: Error occured"); } AuthBaseApiUrl = apiConfiguration.AuthBaseApiUrl; CatalogBaseApiUrl = apiConfiguration.CatalogBaseApiUrl; FetaureBaseApiUrl = apiConfiguration.FetaureBaseApiUrl; TokenEndPoint = apiConfiguration.TokenEndPoint; AuthSystemId = apiConfiguration.AuthSystemId; AuthSecret = apiConfiguration.AuthSecret; SystemId = apiConfiguration.SystemId; CountryPrefix = apiConfiguration.CountryPrefix; PlateformBaseApiUrl = apiConfiguration.PlateformBaseApiUrl; ApplicationBaseApiUrl = apiConfiguration.ApplicationBaseApiUrl; NotificationQueue = apiConfiguration.NotificationQueue; }
private async void GotoHomeWithAciveNotification(bool ok) { if (IsBusy || IsLoading) { // Message toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; if (ok) { _userInformationLocalStorage.UnSubscribeNotification(); _userInformationLocalStorage.SubscribeNotification(_userInformation.UserName); } await NavigationService.NavigateAsync($"/CustomMasterDetailPageView/NavigationPage/{FunctionName.Home}").ConfigureAwait(false); IsLoading = false; }
protected void Initialize() { IsLoading = true; Items = new ObservableCollection <SlideItem>() { new SlideItem() { Icon = "icon-kash_in", PrimayText = TranslateManagerHelper.Convert("add_kash"), Url = "AddKah" }, new SlideItem() { Icon = "icon-tab_transfers", PrimayText = TranslateManagerHelper.Convert("transfers"), Url = "Transfers" }, new SlideItem() { Icon = "icon-merchant_payment", PrimayText = TranslateManagerHelper.Convert("merchant_payment"), Url = "MerchantPayment" }, }; IsLoading = false; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null || (int)value == 0) { return(string.Empty); } var nbPassenger = (int)value; if (nbPassenger < 2) { string symbol = TranslateManagerHelper.Convert("passenger").ToUpper(); return($"{nbPassenger} {symbol}"); } else { string symbol = TranslateManagerHelper.Convert("passengers").ToUpper(); return($"{nbPassenger} {symbol}"); } }
private void Connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e) { var current = Connectivity.NetworkAccess; switch (current) { case NetworkAccess.Unknown: case NetworkAccess.None: DependencyService.Get <IMessage>().ShowSnackBarNetwork(TranslateManagerHelper.Convert("network_unavailable")); break; case NetworkAccess.Local: case NetworkAccess.ConstrainedInternet: DependencyService.Get <IMessage>().ShowSnackBarNetwork(TranslateManagerHelper.Convert("network_limited")); break; case NetworkAccess.Internet: DependencyService.Get <IMessage>().ShowSnackBarNetwork(TranslateManagerHelper.Convert("network_available"), true); break; } }
private async void GotoFingerPrint() { if (IsBusy || IsLoading) { //Message Toast return; } IsLoading = true; var result = await CrossFingerprint.Current.AuthenticateAsync(TranslateManagerHelper.Convert("proove_you_have_finger")); if (result.Authenticated) { PinCode.Value = _userInformationLocalStorage.FPassword; IsLoading = false; GotoValidate(); } else { IsLoading = false; } }
private async void GotoNext() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; switch (CurrentStep.Value) { case 1: { FirstStep.Value = false; SecondStep.Value = true; PreviousText.Value = TranslateManagerHelper.Convert("previous").ToUpperInvariant(); NextText.Value = TranslateManagerHelper.Convert("validate").ToUpperInvariant(); CurrentStep.Value++; break; } case 2: { var parameters = new NavigationParameters { { Constants.PopupId, "PINCODE_POPUP" }, }; await NavigationService.NavigateAsync(PopupName.PinCodePopup, parameters).ConfigureAwait(false); IsLoading = false; break; } default: break; } IsLoading = false; }
private async void GotoOpenAccountPopup() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; var parameters = new NavigationParameters { { Constants.PopupId, "ACCOUNT_POPUP" }, { Constants.PopupTitle, TranslateManagerHelper.Convert("select_account").ToUpperInvariant() }, // {Constants.PopupIcon, "icon-add-user"}, { Constants.PopupCurrentData, _accountSelected }, }; await NavigationService.NavigateAsync(PopupName.PikerWalletPopup, parameters).ConfigureAwait(false); IsLoading = false; }
private async void OnOpenOrganizationPopup() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; ObservableCollection <PikerItem> list = new ObservableCollection <PikerItem>(); var listorgs = await _organizations.GetList(_authentication.GetToken(), (int)_appInfo.GetApp()?.Id); if (listorgs?.isuccess == true) { list = listorgs.data.Select(x => new PikerItem { Id = x.UserId, Name_1 = $"{x.Fname} {x.Lname}" }).ToObservableCollection(); } var parameters = new NavigationParameters { { Constants.PopupId, "ORGANIZATION_POPUP" }, { Constants.PopupTitle, TranslateManagerHelper.Convert("select_organization").ToUpperInvariant() }, // {Constants.PopupIcon, "icon-add-user"}, { Constants.PopupCurrentData, list.FirstOrDefault(x => x.Id == Organization.Id) }, { Constants.PopupResquestData, list } }; await NavigationService.NavigateAsync(PopupName.PikerPopup, parameters).ConfigureAwait(false); IsLoading = false; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) { return(string.Empty); } var minutes = int.Parse((string)value); TimeSpan time = TimeSpan.FromMinutes(minutes); if (time.Days > 0) { string symbol = TranslateManagerHelper.Convert("duration_day_symbol"); return($"{time.Days}{symbol}{time.Hours}h{time.Minutes}min"); } else if (time.Hours > 0) { return($"{time.Hours}h{time.Minutes}min"); } else { return($"{time.Minutes}min"); } }
private async void GotoPrevious() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; switch (CurrentStep.Value) { case 2: { SecondStep.Value = false; FirstStep.Value = true; PreviousText.Value = TranslateManagerHelper.Convert("cancel").ToUpperInvariant(); NextText.Value = TranslateManagerHelper.Convert("next").ToUpperInvariant(); CurrentStep.Value--; break; } default: await NavigationService.GoBackAsync().ConfigureAwait(false); break; } IsLoading = false; }
private async void GotoOpenAccountTypePPopup() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; // appel service pour recuperer la liste des genders, attention, le service devra gerer le cache de sorte // a ne pas rappeller a cahque fois le service referential ObservableCollection <PikerItem> exampleGendersList = new ObservableCollection <PikerItem>(); //var listg = await _genderservice.GetList(""); //if (listg?.isuccess == true) //{ // exampleGendersList = listg.data.Select(x => new PikerItem { Id = x.id.ToString(), Name_1 = x.name }).ToObservableCollection(); //} var parameters = new NavigationParameters { { Constants.PopupId, "ACCOUNT_TYPE_POPUP" }, { Constants.PopupTitle, TranslateManagerHelper.Convert("account_type").ToUpperInvariant() }, //{Constants.PopupCurrentData, exampleGendersList.FirstOrDefault(x => x.Id == Gender.Id)}, { Constants.PopupResquestData, exampleGendersList } }; await NavigationService.NavigateAsync(PopupName.PikerPopup, parameters).ConfigureAwait(false); IsLoading = false; }
private async void GotoNext() { if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; switch (CurrentStep.Value) { case 1: { MerchantId.HasError = Amount.HasError = CurrentCurrency.HasError = false; if (string.IsNullOrEmpty(MerchantId.Value)) { MerchantId.ErrorText = TranslateManagerHelper.Convert("merchant_error"); MerchantId.HasError = true; IsLoading = false; return; } if (string.IsNullOrEmpty(Amount.Value)) { Amount.ErrorText = TranslateManagerHelper.Convert("amount_error"); Amount.HasError = true; IsLoading = false; return; } if (double.Parse(Amount.Value) <= 0) { Amount.ErrorText = TranslateManagerHelper.Convert("amount_must_be_greater_than_0"); Amount.HasError = true; IsLoading = false; return; } if (string.IsNullOrEmpty(CurrentCurrency.Value)) { CurrentCurrency.ErrorText = TranslateManagerHelper.Convert("source_account_error"); CurrentCurrency.HasError = true; IsLoading = false; return; } FirstStep.Value = false; SecondStep.Value = true; PreviousText.Value = TranslateManagerHelper.Convert("previous").ToUpperInvariant(); NextText.Value = TranslateManagerHelper.Convert("make_payment").ToUpperInvariant(); CurrentStep.Value++; break; } default: var parameters = new NavigationParameters { { Constants.PopupId, "MANUAL_PAYMENT" }, }; await NavigationService.NavigateAsync(PopupName.PinCodePopup, parameters).ConfigureAwait(false); break; } IsLoading = false; }
private async void DoPaymentService(bool ok) { if (!ok) { return; } if (IsBusy || IsLoading) { //Message Toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; AccountModel accountSelected; if (Currency.Value == _accountLRD.Currency) { accountSelected = _accountLRD; } else if (Currency.Value == _accountUSD.Currency) { accountSelected = _accountUSD; } else { var parameters1 = new NavigationParameters { { Constants.PopupIsSucces, false }, { Constants.PopupMessage, TranslateManagerHelper.Convert("operation_failed") }, { Constants.PopupNextPage, FunctionName.MerchantPayment } }; await NavigationService.NavigateAsync(PopupName.SuccessfullPopup, parameters1).ConfigureAwait(false); IsLoading = false; return; } // call service feature MerchantPaymentRequest mpr = new MerchantPaymentRequest() { TargetAccountNumber = accountSelected.AccountNumber }; featureDTO f = new featureDTO() { FeatureName = "MERCHANT_PAYMENT", SenderId = ApiConstants.CountryPrefix + _userInformation.UserName, SenderPassword = _userInformation.Password, Amount = decimal.Parse(Amount.Value), TargetId = MerchantId.Value, jsonObjString = JsonConvert.SerializeObject(mpr) }; bool issuccess = false; string message = ""; var mkp = await _makepayment.Execute <featureDTO, MerchantPaymentResponse>(_authentication.GetToken(), f, ApiConstants.SystemId); if (mkp != null) { if (mkp.isuccess) { issuccess = true; var mk = mkp.data; UpdateUserAccount(new AccountModel { AccountNumber = mk.AccountUpdate.AccountNumber, Balance = mk.AccountUpdate.Balance.ToString(), Currency = mk.AccountUpdate.CurrencyISO, Type = mk.AccountUpdate.AccountType }); message = TranslateManagerHelper.Convert("operation_successfully"); } else { issuccess = false; switch (mkp.errcode) { case "EXCEPTION": message = TranslateManagerHelper.Convert("operation_failed"); break; case "WrongPincode": message = mkp.msg; break; default: message = !string.IsNullOrEmpty(mkp?.msg) ? mkp.msg : TranslateManagerHelper.Convert("error_occured"); break; } } } else { issuccess = false; message = TranslateManagerHelper.Convert("error_occured"); } var parameters = new NavigationParameters { { Constants.PopupIsSucces, issuccess }, { Constants.PopupMessage, message }, { Constants.PopupNextPage, FunctionName.MerchantPayment } }; await NavigationService.NavigateAsync(PopupName.SuccessfullPopup, parameters).ConfigureAwait(false); IsLoading = false; }
private async void OnTapAddNumberPosition(string value) { Message.HasError = false; Message.ErrorText = ""; if (_pincode.Length >= Constants.MaxLenthPinCode) { return; } _pincode += value.ToString(); switch (_pincode.Length) { case 1: Number_1.Value = "*"; break; case 2: Number_2.Value = "*"; break; case 3: Number_3.Value = "*"; break; case 4: Number_4.Value = "*"; break; case 5: Number_5.Value = "*"; break; default: break; } if (_pincode.Length >= Constants.MaxLenthPinCode) { if (IsBusy || IsLoading) { // Message toast ShowSnackBarWithAction(TranslateManagerHelper.Convert("loading_please_wait"), null, TranslateManagerHelper.Convert("ok").ToUpperInvariant()); return; } IsLoading = true; // call service check_pincode featureDTO fb = new featureDTO { FeatureName = "CHECK_PINCODE", SenderId = ApiConstants.CountryPrefix + _userInformation.UserName, SenderPassword = _pincode, TargetId = "", Amount = 0, jsonObjString = "" }; var response = await _checkpincode.Execute <featureDTO, CheckPincodeResponse>(_authentication.GetToken(), fb, ApiConstants.SystemId); if (response != null && response.isuccess) { _userInformation.SetPassword(_pincode); _userInformation.SetUserId(response.data.Id); _authentication.Connect(); CheckPincodeResponse cp = response.data; _userFullName = $"{cp.Fname} {cp.Lname}"; foreach (AccountInfo ai in cp.AccountUpdate) { UpdateUserAccount(new AccountModel { AccountNumber = ai.AccountNumber, Balance = ai.Balance.ToString(), Currency = ai.CurrencyISO, Type = ai.AccountType }); } if (_userInformationLocalStorage.HasSubscribeNotification) { if (_userInformationLocalStorage.UserForNotification != _userInformation.UserName) { // Call popup message action var parameters = new NavigationParameters { { Constants.PopupId, "NOTIFICATION_ACTIVE_POPUP" }, { Constants.PopupMessage, TranslateManagerHelper.Convert("do_you_want").ToUpper() }, { Constants.PopupMessage2, TranslateManagerHelper.Convert("to_receive_your_notifications_on_this_device").ToUpper() }, }; await NavigationService.NavigateAsync(PopupName.MessageWithActionPopup, parameters).ConfigureAwait(false); IsLoading = false; return; } } else { _userInformationLocalStorage.SubscribeNotification(_userInformation.UserName); } await NavigationService.NavigateAsync($"/CustomMasterDetailPageView/NavigationPage/{FunctionName.Home}").ConfigureAwait(false); } else { for (int i = 0; i < 5; i++) { OnTapRemoveNumberPosition(); } switch (response?.errcode) { case "EXCEPTION": Message.ErrorText = TranslateManagerHelper.Convert("operation_failed"); break; default: Message.ErrorText = !string.IsNullOrEmpty(response?.msg) ? response?.msg : TranslateManagerHelper.Convert("error_occured"); break; } Message.HasError = true; } IsLoading = false; } }
private async void DoService(bool ok) { if (!ok) { return; } if (IsBusy || IsLoading) { // message toast return; } IsLoading = true; // call the donation service DonationRequest d = new DonationRequest(); d.SourceAccountNumber = _accountSelected.AccountNumber; featureDTO f = new featureDTO { FeatureName = "DONATION", Amount = decimal.Parse(Amount.Value), SenderId = ApiConstants.CountryPrefix + _userInformation.UserName, SenderPassword = _userInformation.Password, TargetId = Organization.Id, jsonObjString = JsonConvert.SerializeObject(d) }; var result = await _donationservice.Execute <featureDTO, DonationResponse>(_authentication.GetToken(), f, ApiConstants.SystemId); NavigationParameters parameters = null; string message = ""; bool isSuccess = false; if (result != null) { if (result.isuccess) { var acc = result.data; UpdateUserAccount(new AccountModel { AccountNumber = acc.AccountUpdate.AccountNumber, Balance = acc.AccountUpdate.Balance.ToString(), Currency = acc.AccountUpdate.CurrencyISO, Type = acc.AccountUpdate.AccountType }); message = !string.IsNullOrEmpty(result.msg) ? result.msg : TranslateManagerHelper.Convert("operation_successfully"); isSuccess = true; } else { switch (result.errcode) { case "EXCEPTION": message = TranslateManagerHelper.Convert("operation_failed"); break; default: message = !string.IsNullOrEmpty(result.msg) ? result.msg : TranslateManagerHelper.Convert("error_occured"); break; } isSuccess = false; } } else { // TODO : what message do we send ? isSuccess = false; message = TranslateManagerHelper.Convert("error_contact_support"); } parameters = new NavigationParameters { { Constants.PopupIsSucces, isSuccess }, { Constants.PopupIsBeforeHome, false }, { Constants.PopupMessage, message }, { Constants.PopupNextPage, FunctionName.Charity } }; await NavigationService.NavigateAsync(PopupName.SuccessfullPopup, parameters); SecondStep.Value = false; FirstStep.Value = true; IsLoading = false; }
private void Initialize() { _accountSelected = new AccountModel(); PreviousText.Value = TranslateManagerHelper.Convert("cancel").ToUpperInvariant(); NextText.Value = TranslateManagerHelper.Convert("next").ToUpperInvariant(); }
private async Task Load() { if (IsBusy || IsLoading) { // message toast return; } IsLoading = true; AccountStatementRequest asr = new AccountStatementRequest(); asr.SourceAccountNumber = ""; featureDTO fb = new featureDTO { FeatureName = "MY_DONATION", SenderId = ApiConstants.CountryPrefix + _userInformation.UserName, SenderPassword = _userInformation.Password, TargetId = "", Amount = 0, jsonObjString = JsonConvert.SerializeObject(asr) }; List <StatementDetails> list = new List <StatementDetails>(); var raccst = await _statementsservice.Execute <featureDTO, List <AccountStatementResponse> >(_authentication.GetToken(), fb, Infrastructure.ApiConstants.SystemId); if (raccst != null && raccst.isuccess) { var accresp = raccst?.data; list = accresp?.Select(x => new StatementDetails { OperationNumber = x.TransactionId, Amount = x.Amount.ToString(), Currency = "Ex.LRD", Description = x.Stakeholder, // x.Type, OperationSign = x.Sign, IsPositive = x.Sign == "+", OperationTime = x.Date.ToShortTimeString(), OpDate = x.Date.ToString("yyyy-MM-dd"), OperationType = x.Opname.ToUpperInvariant() }).ToList(); foreach (var s in list) { try { var group = Items.FirstOrDefault(x => x.OperationDate.Equals(s.OpDate)); if (group == null) { group = new StatetementGroup(s.OpDate); Items.Add(group); } group.Add(s); } catch (Exception ex) { DependencyService.Get <IMessage>().ShowSnackBarNetwork(TranslateManagerHelper.Convert("error_occured")); } } } else { string message; switch (raccst?.errcode) { case "EXCEPTION": message = TranslateManagerHelper.Convert("operation_failed"); break; default: message = !string.IsNullOrEmpty(raccst?.msg) ? raccst?.msg : TranslateManagerHelper.Convert("error_occured"); break; } var parameters = new NavigationParameters { { Constants.PopupIsSucces, false }, { Constants.PopupMessage, message }, { Constants.PopupNextPage, FunctionName.Home } }; await NavigationService.NavigateAsync(PopupName.SuccessfullPopup, parameters); IsLoading = false; } IsEmpty = Items.Count == 0; IsLoading = false; }