/// <summary> /// TODO : To Validate Submit Command... /// </summary> /// <param name="obj"></param> private async void SubmitCommandAsync(object obj) { if (!await Validate()) { return; } //Call api.. try { //Call AccessRegister Api.. UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.AccessPasswordReminderApi(new AccessPasswordReminderRequestModel() { emailaddress = Email, }, async(aobj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (aobj as AccessPasswordReminderResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { // UserDialog.HideLoading(); await Navigation.PushModalAsync(new Views.ResetPassword.UpdatePasswordPage(Email)); } else { await App.Current.MainPage.DisplayAlert("", requestList.responsemessage, "Ok"); } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// To Validate all User Input Fields... /// </summary> /// <returns></returns> private async Task <bool> Validate() { UserDialog.ShowLoading("Please Wait…", MaskType.Clear); if (IsBuyRate) { if (string.IsNullOrEmpty(BuyRate)) { UserDialog.HideLoading(); UserDialog.Alert("Please enter buy rate.", "", "Ok"); return(false); } } else { if (string.IsNullOrEmpty(SellRate)) { UserDialog.HideLoading(); UserDialog.Alert("Please enter sell rate.", "", "Ok"); return(false); } } if (string.IsNullOrEmpty(ExpireTime)) { UserDialog.HideLoading(); UserDialog.Alert("Please enter expire time.", "", "Ok"); return(false); } UserDialog.HideLoading(); return(true); }
/// <summary> /// Call This Api For StaticDataSearch /// </summary> /// <returns></returns> public async Task StaticDataSearch() { if (!string.IsNullOrEmpty(Helpers.Settings.GeneralStaticDataResponse)) { var objres = JsonConvert.DeserializeObject <StaticDataSearchResponseModel>(Helpers.Settings.GeneralStaticDataResponse); Helpers.Constants.StaticDataList = new ObservableCollection <Staticdata>(objres.staticdata); } else { //Call api.. try { //Call AccessRegisterActivate Api.. //UserDialogs.Instance.ShowLoading("Loading...", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.StaticDataSearchApi(new StaticDataSearchRequestModel() { }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as StaticDataSearchResponseModel); if (requestList != null) { Staticdatalist = new ObservableCollection <Staticdata>(requestList.staticdata); Helpers.Constants.StaticDataList = Staticdatalist; } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { } } catch (Exception ex) { UserDialog.HideLoading(); } } }
//TODO : To Call Api To Get All Payments... public async Task GetAllPayments() { //Call api.. try { UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.PaymentSearchApi(new PaymentSearchRequestModel() { usertoken = MonicaLoanApp.Helpers.Settings.GeneralAccessToken }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as PaymentSearchResponseModel).payments; if (requestList.Count > 0) { UserDialogs.Instance.HideLoading(); PaymentList = new ObservableCollection <Payment>(requestList); IsPaymentNotAvailable = false; IsPaymentAvailable = true; } else { UserDialogs.Instance.HideLoading(); IsPaymentNotAvailable = true; IsPaymentAvailable = false; } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// Call This Api For AccessRegisterActivate /// </summary> /// <returns></returns> public async Task AccessRegisterActivate() { //Call api.. try { //Call AccessRegisterActivate Api.. UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.AccessRegisterActivateApi(new AccessRegisterActivateRequestModel() { usertoken = Constants.UserToken, validatetoken = "806207727" }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as AccessRegisterResponseModel); //if (requestList != null) //{ // Helpers.Constants.ObjSetUserProfile.birthDate = UserDOB; // Helpers.Constants.ObjSetUserProfile.bloodType = BloodGroupType; // Helpers.Constants.ObjSetUserProfile.emailAddress = UserEmail; // Helpers.Constants.ObjSetUserProfile.fullName = UserFullName; // Helpers.Constants.ObjSetUserProfile.height = Convert.ToInt32(UserHeight); // Helpers.Constants.ObjSetUserProfile.mobilePhone = UserPhoneNumber; // Helpers.Constants.ObjSetUserProfile.weight = Convert.ToInt32(UserWeight); // UserDialog.Alert("Profile updated successfully.", "Success", "Ok"); //} UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
public async Task GetNewProfileData() { try { UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.ProfileGetApi(new ProfileRequestModel() { profiletoken = Helpers.LocalStorage.GeneralProfileToken }, async(objs) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objs as ProfileDetailsResponseModel); if (requestList != null) { UserDialog.HideLoading(); DisplayName = requestList.displayname; Mobileno = requestList.mobilenumber; EmailAddress = requestList.emailaddress == null ? string.Empty : requestList.emailaddress; UserProfileBase64 = requestList.profilepic; MessagingCenter.Send <string>("", "LoadApiImage"); } }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objj as RegisterProfileResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } }); }); } }).ConfigureAwait(false); } else { //UserDialogs.Instance.Loading().Hide(); //await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
public async Task GetLoans() { //Call api.. try { //UserDialogs.Instance.ShowLoading("Loading...", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.LoanSearchApi(new LoanSearchRequestModel() { usertoken = MonicaLoanApp.Helpers.Settings.GeneralAccessToken, loannumber = LoanNumber }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as LoanSearchResponseModel).loans; if (requestList != null) { UserDialogs.Instance.HideLoading(); SchedulesList = new ObservableCollection <Schedule>(requestList[0].schedules); } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// Call This Api For StaticDataSearch /// </summary> /// <returns></returns> public async Task StaticDataSearch() { //Fileter Bank List From Static Data List.. try { var filteredStatelist = Helpers.Constants.StaticDataList.Where(a => a.type == "FAQ").ToList(); FaqList = new ObservableCollection <Staticdata>(filteredStatelist); } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// Call This Api For StaticDataSearch /// </summary> /// <returns></returns> public async Task StaticDataSearch() { //Fileter Bank List From Static Data List.. try { var EmployerList = Helpers.Constants.StaticDataList.Where(a => a.type == "EMPLOYER").ToList(); SelectLoan = new ObservableCollection <Staticdata>(EmployerList); } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// To perform Accept/Reject Action on Search... /// </summary> /// <returns></returns> public async Task PerformActionOnMatches(string action, string matchnum) { try { UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.MatchesRespondApi(new MatchesRespondRequestModel() { profiletoken = Helpers.LocalStorage.GeneralProfileToken, requestnumber = Currency.requestnumber, action = action, matchnumber = matchnum.ToString(), }, async(objs) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objs as ResendTokenResponseModel); if (requestList != null) { UserDialog.HideLoading(); } }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objj as ResendTokenResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TODO : To Perform Resend Code Operation... /// </summary> /// <param name="obj"></param> private async void ResendCodeAsync(object obj) { try { UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.AccessPasswordResendCodeApi(new ResendCodeRequestModel() { emailaddress = Email, }, async(objs) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objs as AccessPasswordChangeResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); Xamarin.Forms.MessagingCenter.Send <string>("", "StartCountDown"); } }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as AccessPasswordChangeResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
public void NeedCurrencySelected(string currency) { if (!string.IsNullOrEmpty(currency)) { if (HaveCurrency == currency) { UserDialog.HideLoading(); UserDialog.Alert("Currency can not be same.", "", "Ok"); return; } } NeedCurrency = currency; }
/// <summary> /// To Validate all User Input Fields... /// </summary> /// <returns></returns> private async Task <bool> Validate() { UserDialog.ShowLoading("Please Wait…", MaskType.Clear); if (string.IsNullOrEmpty(DisplayName)) { UserDialog.HideLoading(); UserDialog.Alert("Please enter your display name.", "", "Ok"); return(false); } //bool isValid1 = (Regex.IsMatch(DisplayName, _Name, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); //if (!isValid1) //{ // UserDialog.HideLoading(); // UserDialog.Alert("Display name must have characters only."); // return false; //} if (DisplayName.Length < 3 || DisplayName.Length > 50) { UserDialog.HideLoading(); UserDialog.Alert("The display name should be between 3 to 50 characters.", "", "Ok"); return(false); } //if (string.IsNullOrEmpty(EmailAddress)) //{ // UserDialog.HideLoading(); // UserDialog.Alert("Please enter your email Address.", "", "Ok"); // return false; //} if (!string.IsNullOrEmpty(EmailAddress)) { if (EmailAddress.Length < 6 || EmailAddress.Length > 100) { UserDialog.HideLoading(); UserDialog.Alert("The Email address should be between 6 to 100 characters.", "", "Ok"); return(false); } } if (!string.IsNullOrEmpty(EmailAddress)) { bool isValid2 = (Regex.IsMatch(EmailAddress, _emailRegex, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); if (!isValid2) { UserDialog.HideLoading(); UserDialog.Alert("Email Address is not valid"); return(false); } } UserDialog.HideLoading(); return(true); }
/// <summary> /// TODO : To Get Profile Details List... /// </summary> public async Task GetProfileData() { try { if (!string.IsNullOrEmpty(Helpers.LocalStorage.GeneralSearches)) { } if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.ProfileGetApi(new ProfileRequestModel() { profiletoken = Helpers.LocalStorage.GeneralProfileToken }, async(objs) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objs as ProfileDetailsResponseModel); if (requestList != null) { } }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objj as RegisterProfileResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } }); }); } }).ConfigureAwait(false); } else { //UserDialogs.Instance.Loading().Hide(); //await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TODO: To define Payment Complete Command... /// </summary> /// <param name="obj"></param> private async void PaymentCommandAsync(object obj) { //Apply LoginValidations... if (!await PaymentValidate()) { return; } //Call api.. try { UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.PaymentCreateApi(new PaymentCreateRequestModel() { usertoken = Helpers.Settings.GeneralAccessToken, loannumber = LoanNumber, loanschedulenumber = LoanSchedule, amount = Amount, paymentmethodcode = "CARD" }, async(objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objj as PaymentCreateResponseModel); if (requestList != null) { UserDialogs.Instance.HideLoading(); var alertConfig = new AlertConfig { Title = "", Message = "Payment created successfully!", OkText = "OK", OnAction = () => { App.Current.MainPage = new Views.Payments.PaymentListPage(); } }; UserDialogs.Instance.Alert(alertConfig); } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } //UserDialog.Alert("Payment Complete successfully.!", "Success", "Ok"); //App.Current.MainPage = new Views.Payments.PaymentListPage(); }
public async Task GetAllLoans() { if (!string.IsNullOrEmpty(Helpers.Settings.GeneralAllLoanResponse)) { var a = Helpers.Settings.GeneralAllLoanResponse; var allUserLoan = JsonConvert.DeserializeObject <AllLoanResponseModel>(a); if (allUserLoan != null) { LoansList = new ObservableCollection <AllLoan>(allUserLoan.loans); } } //Call api.. try { if (string.IsNullOrEmpty(Helpers.Settings.GeneralAllLoanResponse)) { UserDialogs.Instance.ShowLoading(); } if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.GetAllLoansApi(new AllLoanRequestModel() { usertoken = MonicaLoanApp.Helpers.Settings.GeneralAccessToken }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as AllLoanResponseModel).loans; if (requestList.Count > 0) { UserDialogs.Instance.HideLoading(); LoansList = new ObservableCollection <AllLoan>(requestList); } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Currently you have no loans to make payment.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TODO : To Validate NewPasswordCommand... /// </summary> /// <param name="obj"></param> private async void NewPasswordCommandAsync(object obj) { if (!await Validate()) { return; } //Call api.. try { //Call AccessRegister Api.. UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.AccessPasswordChangeApi(new AccessPasswordChangeRequestModel() { validatetoken = Token, password = NewPassword, emailaddress = Email, }, async(aobj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (aobj as AccessPasswordChangeResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { //UserDialogs.Instance.Alert(requestList.responsemessage, "Success", "ok"); //App.Current.MainPage = new Views.Login.LoginPage(Email); UserDialogs.Instance.Alert("Password changed successfully. You may now login with your new password.", "", "ok"); App.Current.MainPage = new Views.Login.LoginPage(Email); } else { await App.Current.MainPage.DisplayAlert("", requestList.responsemessage, "Ok"); } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } // UserDialog.Alert("Password reset successfully.!", "Alert", "Ok"); // }
/// <summary> /// TODO: To define SubmitCommand for naviagtion to next page. /// </summary> /// <param name="obj"></param> private async void SubmitCommandAsync(object obj) { //Apply Validations... if (!await ValidateLoanDetail()) { return; } //Call api.. try { //Call AccessRegister Api.. UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.LoanCreateApi(new LoanCreateRequestModel() { usertoken = Helpers.Settings.GeneralAccessToken, loanamount = Convert.ToInt32(EnterAmount), durationperiod = LoanDuration, durationtotal = Convert.ToInt32(NumberOfWeek), employeesalarymonthly = Convert.ToInt32(EnterSalary), employercode = EmployerCode, purposecode = PurposeCode, employeenumber = EnterEmployeeNumber, employeeidcard = PartImgBase64, employeestartdate = DateOfBirth, }, async(_obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (_obj as LoanCreateResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { Helpers.Settings.GeneralLoanNumber = requestList.loannumber; Helpers.Constants.LoanSubmitSms = requestList.responsemessage; SubmittedLoanApplicationPopup = new SubmittedLoanApplicationPopup(); await Navigation.PushPopupAsync(SubmittedLoanApplicationPopup, true); } else { UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } //SubmittedLoanApplicationPopup = new SubmittedLoanApplicationPopup(); //await Navigation.PushPopupAsync(SubmittedLoanApplicationPopup, true); }
/// <summary> /// To Call Api To Save Profile... /// </summary> /// <param name="obj"></param> private async void SaveCommandAsync(object obj) { IsPageEnable = false; if (string.IsNullOrEmpty(Number)) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Please enter Mobile Number."); IsPageEnable = true; return; } if (Number.Length > 15) { UserDialog.Alert("Mobile Number should not be more than 15 digit."); IsPageEnable = true; return; } //Call api.. try { UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.ProfileSaveApi(new ProfileSaveRequestModel() { usertoken = Helpers.Settings.GeneralAccessToken, mobileno = Number, gender = Gender, maritalstatus = MaritalStatus, bankcode = Helpers.Constants.UserBankcode, bankaccountno = Helpers.Constants.UserBankaccountno, addressline1 = Helpers.Constants.UserAddressline1, addressline2 = Helpers.Constants.UserAddressline2, City = Helpers.Constants.UserCity, Statecode = Helpers.Constants.UserStatecode, employercode = Helpers.Constants.UserEmployercode, employeenumber = Helpers.Constants.UserEmployeenumber, Salary = Helpers.Constants.UserSalary, Startdate = Helpers.Constants.UserStartdate, Profilepic = UserProfileBase64 }, async(_obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (_obj as ProfileSaveResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { await GetProfile(); UserDialogs.Instance.HideLoading(); var alertConfig = new AlertConfig { Title = "", Message = "Your personal details have been successfully updated.", OkText = "OK", OnAction = async() => { await Navigation.PopModalAsync(); } }; UserDialogs.Instance.Alert(alertConfig); } else { UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
//TODO : To Call Loan Respond Api When Accept... public async Task LoanRespond(AllLoan allLoan) { //Call api.. try { UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.LoanRespondApi(new LoanRespondRequestModel() { usertoken = MonicaLoanApp.Helpers.Settings.GeneralAccessToken, loannumber = allLoan.loannumber, action = Action, declinereasoncode = DeclineReasonCode }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as LoanRespondResponseModel); if (requestList != null) { UserDialogs.Instance.HideLoading(); var alertConfig = new AlertConfig { Title = "", Message = "Your loan responded successfully!", OkText = "OK", OnAction = () => { App.Current.MainPage = new Views.Loans.LoanDetailsPage(); } }; UserDialogs.Instance.Alert(alertConfig); } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// To Get The List Of Matches... /// </summary> /// <returns></returns> public async Task GetMatchesList() { try { if (CrossConnectivity.Current.IsConnected) { UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); } if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.MatchesApi(new MatchesRequestModel() { profiletoken = Helpers.LocalStorage.GeneralProfileToken, requestnumber = Currency.requestnumber }, async(objs) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objs as MatchesResponseModel); if (requestList.matches != null) { if (requestList.matches.Count != 0) { CurrencyMatchesList = new ObservableCollection <MatchesModel>(requestList.matches); IsMatchesAvailable = true; IsMatchesNotAvailable = false; } else { IsMatchesAvailable = false; IsMatchesNotAvailable = true; } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objj as ResendTokenResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); //await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// To Call Api To Save Profile... /// </summary> /// <param name="obj"></param> private async void SaveCommandAsync(object obj) { //Apply ValidateEmployement... if (!await ValidateEmployement()) { return; } //Call api.. try { UserDialogs.Instance.ShowLoading(); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.ProfileSaveApi(new ProfileSaveRequestModel() { usertoken = Helpers.Settings.GeneralAccessToken, mobileno = Helpers.Constants.Usermobileno, gender = Helpers.Constants.Usergender, maritalstatus = Helpers.Constants.UserMaritalstatus, bankcode = Helpers.Constants.UserBankcode, bankaccountno = Helpers.Constants.UserBankaccountno, addressline1 = Helpers.Constants.UserAddressline1, addressline2 = Helpers.Constants.UserAddressline2, City = Helpers.Constants.UserCity, Statecode = Helpers.Constants.UserStatecode, employercode = EmployerCode, employeenumber = EnterEmpNo, Salary = EnterSalary, Startdate = StartDate, Profilepic = Helpers.Constants.Userprofilepic }, async(_obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (_obj as ProfileSaveResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { await GetProfile(); UserDialogs.Instance.HideLoading(); var alertConfig = new AlertConfig { Title = "", Message = "Your employment details updated successfully!", OkText = "OK", OnAction = () => { App.Current.MainPage = new Views.MyAccount.MyAccountPage(); } }; UserDialogs.Instance.Alert(alertConfig); } else { UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TODO : To Perform SignOut Page... /// </summary> /// <param name="obj"></param> private async void OnSignOutAsync(object obj) { var res = await UserDialogs.Instance.ConfirmAsync("Are you sure you want to sign out?", null, "No", "Yes"); var text = (res ? "No" : "Yes"); if (text == "Yes") { //Call api.. try { //Call AccessRegister Api.. UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.AccessLogOutApi(new AccessLogOutRequestModel() { usertoken = Helpers.Settings.GeneralAccessToken, }, async(aobj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (aobj as AccessLogOutResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { Helpers.Settings.GeneralAccessToken = string.Empty; App.Current.MainPage = new Views.Login.LoginPage(null); } else { UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } } }
/// <summary> /// TODO: Define NextCommand validation... /// </summary> /// <param name="obj"></param> private async void NextCommandAsync(object obj) { if (!await SignupValidate()) { return; } else { //Call api.. try { //Call AccessRegisterPreValidate Api.. UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.AccessRegisterPreValidateApi(new AccessRegisterPreValidateRequestModel() { emailaddress = Email, bvn = BusinessNumber }, async(resobj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (resobj as AccessRegisterPreValidateResponseModel); if (requestList != null) { if (requestList.responsemessage == "Validation Successful") { FirstGrid = false; SecondGrid = true; } else { UserDialogs.Instance.Alert(requestList.responsemessage, "", "Ok"); } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } } }
/// <summary> /// To Get The List Of Currency /// </summary> /// <returns></returns> public async Task CallCurrenctList() { ContextMenu = new List <string>(); ContextMenu.Add("Show Closed"); ContextMenu.Add("Order By Most Recent"); ContextMenu.Add("Order By Currency I Have"); ContextMenu.Add("Order By Currency I Need"); if (!string.IsNullOrEmpty(Helpers.LocalStorage.GeneralSearches)) { var a = Helpers.LocalStorage.GeneralSearches; var searchDetail = JsonConvert.DeserializeObject <SearchResponseModel>(a); if (searchDetail.searches != null) { //var activeSearches = AllCurrencyList.Where(c => c.statuscode != "CLOSED").ToList(); //CurrencyModelList = new ObservableCollection<SearchModel>(activeSearches); if (searchDetail.searches.Count != 0) { UserDialog.HideLoading(); AllCurrencyList = new ObservableCollection <SearchModel>(searchDetail.searches); var activeSearches = AllCurrencyList.Where(c => c.statuscode != "CLOSED").ToList(); CurrencyModelList = new ObservableCollection <SearchModel>(activeSearches); IsCurrencyAvailable = true; IsCurrencyNotAvailable = false; } else { UserDialog.HideLoading(); IsCurrencyAvailable = false; IsCurrencyNotAvailable = true; } } } try { if (string.IsNullOrEmpty(Helpers.LocalStorage.GeneralSearches)) { UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); } if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.SearchesApi(new ProfileRequestModel() { profiletoken = Helpers.LocalStorage.GeneralProfileToken, }, async(objs) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objs as SearchResponseModel); if (requestList.searches.Count != 0) { UserDialog.HideLoading(); AllCurrencyList = new ObservableCollection <SearchModel>(requestList.searches); var activeSearches = AllCurrencyList.Where(c => c.statuscode != "CLOSED").ToList(); CurrencyModelList = new ObservableCollection <SearchModel>(activeSearches); IsCurrencyAvailable = true; IsCurrencyNotAvailable = false; } else { UserDialog.HideLoading(); IsCurrencyAvailable = false; IsCurrencyNotAvailable = true; } }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objj as ResendTokenResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } }); }); } }).ConfigureAwait(false); } else { //UserDialogs.Instance.Loading().Hide(); //await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TODO: Define FinishCommand validation... /// </summary> /// <param name="obj"></param> //private async void FinishCommandAsync(object obj) //{ // //if (!await FinishSignUpValidate()) return; // //await Navigation.PushModalAsync(new Views.Register.ConfirmRegistrationPage()); // //UserDialog.Alert("Congratulations! You are registered successfully.!", "Success", "Ok"); // //App.Current.MainPage = new Views.Login.LoginPage(); //} /// <summary> /// Call This Api For AccessRegister /// </summary> /// <returns></returns> public async Task AccessRegister() { //Call api.. try { //Call AccessRegister Api.. UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.AccessRegisterApi(new AccessRegisterRequestModel() { firstname = FirstName, middlename = MiddleName, lastname = LastName, emailaddress = Email, password = NewPassword, mobileno = Number, gender = Gender, maritalstatus = MaritalStatus, dateofbirth = DateOfBirth, bvn = BusinessNumber, bankcode = Bankcode, bankaccountno = AccountNumber }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as AccessRegisterResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { Helpers.Constants.UserToken = requestList.usertoken; Helpers.Settings.GeneralUserToken = requestList.usertoken; await Navigation.PushModalAsync(new Views.Register.ConfirmRegistrationPage(Email)); } else { UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
//TODO : To Call Api To Get Loan Details... public async Task GetLoanDetail(AllLoan allLoan) { if (!string.IsNullOrEmpty(Helpers.Settings.GeneralUserLoanDetailResponse)) { var a = Helpers.Settings.GeneralUserLoanDetailResponse; var allUserLoan = JsonConvert.DeserializeObject <LoanSearchResponseModel>(a); if (allUserLoan != null) { var loans = allUserLoan.loans; LoanDetailsList = new ObservableCollection <Schedule>(loans[0].schedules); Status = loans[0].statusname; Date = loans[0].LoanDate; LoanAmount = "N" + loans[0].loanamount; LoanBalance = "N" + loans[0].loanbalance; UserCompany = loans[0].employername; UserSalary = "N" + loans[0].employeesalarymonthly; EmployeeLoanDate = loans[0].EmployeeLoanDate; UserName = loans[0].employeenumber; } } //Call api.. try { if (string.IsNullOrEmpty(Helpers.Settings.GeneralUserLoanDetailResponse)) { UserDialogs.Instance.ShowLoading("", MaskType.Clear); } if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.LoanSearchApi(new LoanSearchRequestModel() { usertoken = MonicaLoanApp.Helpers.Settings.GeneralAccessToken, loannumber = allLoan.loannumber }, async(obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as LoanSearchResponseModel).loans; if (requestList != null) { UserDialogs.Instance.HideLoading(); LoanDetailsList = new ObservableCollection <Schedule>(requestList[0].schedules); Status = requestList[0].statusname; Date = requestList[0].LoanDate; LoanAmount = "N" + requestList[0].loanamount; LoanBalance = "N" + requestList[0].loanbalance; UserCompany = requestList[0].employername; UserSalary = "N" + requestList[0].employeesalarymonthly; EmployeeLoanDate = requestList[0].EmployeeLoanDate; UserName = requestList[0].employeenumber; } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Something went wrong please try again.", "", "OK"); } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TODO : To Call Update Currecny Api... /// </summary> /// <param name="obj"></param> private async void OnUpdateAsync(object obj) { //Apply Validations.. if (!await Validate()) { return; } try { UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { string buyORell = string.Empty; string rate = string.Empty; if (IsBuyRate) { buyORell = "B"; rate = BuyRate; } else { buyORell = "S"; rate = SellRate; } if (_businessCode != null) { //string time = ExpireTime; //if (ExpireTime == "1 Hour") // time = "1H"; //else if (ExpireTime == "12 Hours") // time = "12H"; //else if (ExpireTime == "24 Hours") // time = "24H"; //else if (ExpireTime == "3 Days") // time = "3D"; //else if (ExpireTime == "7 Days") // time = "7D"; await _businessCode.SearchSaveApi(new SearchSaveRequestModel() { profiletoken = Helpers.LocalStorage.GeneralProfileToken, buycurrencycode = Currency.currencybuy, sellcurrencycode = Currency.currencysell, buyorsell = buyORell, duration = ExpireTime, rate = rate, requestnumber = Currency.requestnumber }, async(objs) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (objs as SearchSaveResponseModel); if (requestList != null) { UserDialog.HideLoading(); //Navigate To Currency Page... var alertConfig = new AlertConfig { Title = "", Message = "The search has updated. We will continue to update you of matches before the expiry time.", OkText = "OK", OnAction = async() => { Currency.buyorsell = buyORell; Currency.duration = ExpireTime; Currency.rate = rate; Helpers.Constants.IsBack = true; Helpers.Constants.UpdatedCurrency = Currency; await Navigation.PopModalAsync(); } }; UserDialogs.Instance.Alert(alertConfig); //UserDialogs.Instance.Alert(requestList.responsemessage, "", "Ok"); //await Navigation.PopModalAsync(); } }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (obj as SearchSaveResponseModel); if (requestList != null) { UserDialog.HideLoading(); UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } }); }); } }).ConfigureAwait(false); } else { UserDialogs.Instance.Loading().Hide(); await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TO call Get profile data /// </summary> /// <returns></returns> public async Task GetProfile() { //Call api.. try { //To Load The Data From Cache... if (!string.IsNullOrEmpty(Helpers.Settings.GeneralProfileDataJSON)) { var requestList = JsonConvert.DeserializeObject <ProfileGetResponseModel>(Helpers.Settings.GeneralProfileDataJSON); if (requestList != null) { if (requestList.responsecode == 100) { Helpers.Constants.ProfileNumber = requestList.profilenumber; Helpers.Constants.UserLoanbalance = requestList.loanbalance; Helpers.Constants.UserDuebalance = requestList.duesoon; Helpers.Constants.UserBvn = requestList.bvn; Helpers.Constants.UserCity = requestList.city; Helpers.Constants.UserBankname = requestList.bankname; Helpers.Constants.UserBankcode = requestList.bankcode; Helpers.Constants.UserAddressline1 = requestList.addressline1; Helpers.Constants.UserAddressline2 = requestList.addressline2; Helpers.Constants.UserBankaccountno = requestList.bankaccountno; Helpers.Constants.UserDateofbirth = requestList.dateofbirth; Helpers.Constants.UserEmailAddress = requestList.emailaddress; Helpers.Constants.UserEmployeenumber = requestList.employeenumber; Helpers.Constants.UserEmployercode = requestList.employercode; Helpers.Constants.UserEmployername = requestList.employername; Helpers.Constants.UserFirstname = requestList.firstname; Helpers.Constants.UserMiddlename = requestList.middlename; Helpers.Constants.UserLastname = requestList.lastname; Helpers.Constants.Usermobileno = requestList.mobileno; Helpers.Settings.GeneralProfilePic = requestList.profilepic; var x = Helpers.Settings.GeneralProfilePic; Helpers.Constants.UserMaritalstatus = requestList.maritalstatus; Helpers.Constants.UserSalary = requestList.salary; Helpers.Constants.UserStateName = requestList.statename; if (!string.IsNullOrEmpty(Helpers.Constants.UserStateName)) { var item = Helpers.Constants.StaticDataList.Where(a => a.data == Helpers.Constants.UserStateName).FirstOrDefault(); Helpers.Constants.UserStatecode = item.key; } Helpers.Constants.UserStartdate = requestList.startdate; Helpers.Constants.Usergender = requestList.gender; } } } //Call AccessRegister Api.. //UserDialogs.Instance.ShowLoading("Please Wait…", MaskType.Clear); if (CrossConnectivity.Current.IsConnected) { await Task.Run(async() => { if (_businessCode != null) { await _businessCode.ProfileGetApi(new ProfileGetRequestModel() { usertoken = Helpers.Settings.GeneralAccessToken, }, async(_obj) => { Device.BeginInvokeOnMainThread(async() => { var requestList = (_obj as ProfileGetResponseModel); if (requestList != null) { if (requestList.responsecode == 100) { Helpers.Constants.ProfileNumber = requestList.profilenumber; Helpers.Constants.UserLoanbalance = requestList.loanbalance; Helpers.Constants.UserDuebalance = requestList.duesoon; Helpers.Constants.UserBvn = requestList.bvn; Helpers.Constants.UserCity = requestList.city; Helpers.Constants.UserBankname = requestList.bankname; Helpers.Constants.UserBankcode = requestList.bankcode; Helpers.Constants.UserAddressline1 = requestList.addressline1; Helpers.Constants.UserAddressline2 = requestList.addressline2; Helpers.Constants.UserBankaccountno = requestList.bankaccountno; Helpers.Constants.UserDateofbirth = requestList.dateofbirth; Helpers.Constants.UserEmailAddress = requestList.emailaddress; Helpers.Constants.UserEmployeenumber = requestList.employeenumber; Helpers.Constants.UserEmployercode = requestList.employercode; Helpers.Constants.UserEmployername = requestList.employername; Helpers.Constants.UserFirstname = requestList.firstname; Helpers.Constants.UserMiddlename = requestList.middlename; Helpers.Constants.UserLastname = requestList.lastname; Helpers.Constants.Usermobileno = requestList.mobileno; Helpers.Settings.GeneralProfilePic = requestList.profilepic; var x = Helpers.Settings.GeneralProfilePic; Helpers.Constants.UserMaritalstatus = requestList.maritalstatus; Helpers.Constants.UserSalary = requestList.salary; Helpers.Constants.UserStateName = requestList.statename; if (!string.IsNullOrEmpty(Helpers.Constants.UserStateName)) { var item = Helpers.Constants.StaticDataList.Where(a => a.data == Helpers.Constants.UserStateName).FirstOrDefault(); Helpers.Constants.UserStatecode = item.key; } Helpers.Constants.UserStartdate = requestList.startdate; Helpers.Constants.Usergender = requestList.gender; } else { UserDialogs.Instance.Alert(requestList.responsemessage, "", "ok"); } } UserDialog.HideLoading(); }); }, (objj) => { Device.BeginInvokeOnMainThread(async() => { UserDialog.HideLoading(); UserDialog.Alert("Something went wrong. Please try again later.", "", "Ok"); }); }); } }).ConfigureAwait(false); } else { //UserDialogs.Instance.Loading().Hide(); //await UserDialogs.Instance.AlertAsync("No Network Connection found, Please try again!", "", "Okay"); } } catch (Exception ex) { UserDialog.HideLoading(); } }
/// <summary> /// TODO : To Apply SignupValidations... /// </summary> /// <returns></returns> private async Task <bool> SignupValidate() { if (string.IsNullOrEmpty(FirstName) && string.IsNullOrEmpty(LastName) && string.IsNullOrEmpty(Email) && string.IsNullOrEmpty(NewPassword) && string.IsNullOrEmpty(BusinessNumber)) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("All fields are required."); return(false); } if (string.IsNullOrEmpty(FirstName)) { UserDialog.HideLoading(); UserDialogs.Instance.Alert("Please enter First Name."); return(false); } if (FirstName.Length < 2 || FirstName.Length > 30) { UserDialog.Alert("First name should bebetween 2 to 30 charachters."); return(false); } bool isValid2 = (Regex.IsMatch(FirstName, _NewFrstname, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); if (!isValid2) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Invalid First name."); return(false); } //if (string.IsNullOrEmpty(MiddleName)) //{ // UserDialog.HideLoading(); // UserDialogs.Instance.Alert("Please enter Middle Name"); // return false; //} //if (MiddleName.Length >= 30) //{ // UserDialog.Alert("Token should contain less than 20 charcter."); // return false; //} //bool isValid5 = (Regex.IsMatch(MiddleName, _NewMiddlename, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); //if (!isValid5) //{ // UserDialogs.Instance.HideLoading(); // UserDialogs.Instance.Alert("Please use aphabet only"); // return false; //} if (string.IsNullOrEmpty(LastName)) { UserDialog.HideLoading(); UserDialogs.Instance.Alert("Please enter Last Name"); return(false); } if (LastName.Length < 2 || LastName.Length > 30) { UserDialog.Alert("Last name should bebetween 2 to 30 charachters."); return(false); } bool isValid3 = (Regex.IsMatch(LastName, _NewLastname, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); if (!isValid3) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Invalid Last Name."); return(false); } if (string.IsNullOrEmpty(Email)) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Please enter email."); return(false); } if (Email.Length < 6 || Email.Length > 100) { UserDialog.Alert("Email should be between 6 and 100 characters."); return(false); } bool isValid4 = (Regex.IsMatch(Email, _emailRegex, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); if (!isValid4) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Email is not valid."); return(false); } if (string.IsNullOrEmpty(NewPassword)) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Please enter password."); return(false); } if (NewPassword.Length < 6 || NewPassword.Length > 50) { UserDialog.Alert("Password should be between 6 and 50 characters."); return(false); } bool isvalid1 = (Regex.IsMatch(NewPassword, _password, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); if (!isvalid1) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Password must contain minimum 6 charachters and at least 1 letter, 1 number and 1 special character.", "", "Ok"); return(false); } if (string.IsNullOrEmpty(BusinessNumber)) { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert("Please enter Bvn Number."); return(false); } UserDialogs.Instance.HideLoading(); return(true); }