private async void OnButtonSubmit(object sender, EventArgs e) { var Query = txtQuery.Text; if (Query == "") { await DisplayAlert("Validation Error", "Please enter your query", "Re-try"); return; } dsMaster = new F4HApp.dataservice.DSMaster(); string result = await dsMaster.SupportQuery(App.MemberID, txtQuery.Text); RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", "")); string Status = m.Status.ToString(); string Msg = m.Msg; if (Status == "Success") { await DisplayAlert("Food4Health", "Your query has been successfuly submitted. You will be able to check our response in the Support Forum section. Thank you", "Done"); txtQuery.Text = ""; } else { await DisplayAlert("Food4Health Error", Msg, "Re-try"); } }
private async void OnbtnChangePassword(object sender, EventArgs e) { var ExistingPassword = txtExistingPassword.Text; var NewPassword = txtNewPassword.Text; var ConfirmPassword = txtConfirmPassword.Text; string Status = "Fail"; string Msg = "Technical Error"; if (ExistingPassword == "") { await DisplayAlert("Validation Error", "Existing Password cannot be blank", "Re-try"); return; } if (NewPassword == "") { await DisplayAlert("Validation Error", "New Password cannot be blank", "Re-try"); return; } if (ConfirmPassword == "") { await DisplayAlert("Validation Error", "Confirm Password cannot be blank", "Re-try"); return; } if (ConfirmPassword != NewPassword) { await DisplayAlert("Validation Error", "Confirm password and New password doesnot match", "Re-try"); return; } dsLogin = new F4HApp.dataservice.DSLogin(); string result = await dsLogin.UpdateMemberPassword(App.MemberID, ExistingPassword, NewPassword); RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", "")); Status = m.Status.ToString(); Msg = m.Msg; if (Status == "Success") { await DisplayAlert("Food4Health", "Password Changed", "Done"); txtExistingPassword.Text = ""; txtNewPassword.Text = ""; txtConfirmPassword.Text = ""; } else { await DisplayAlert("Food4Health Error", Msg, "Re-try"); } }
private async void OnbtnSendCode(object sender, EventArgs e) { var MobileNo = string.Empty; MobileNo = txtMobileNo.Text; string ValidationMsg = ""; bool IsValid = true; if (MobileNo == null) { ValidationMsg += "Enter Mobile\n"; IsValid = false; } else { if (!CheckValidMobile(MobileNo)) { ValidationMsg += "Enter 9 digit mobile no.\n"; IsValid = false; } } if (IsValid) { dsLogin = new F4HApp.dataservice.DSLogin(); string result = await dsLogin.ChkMobileExists(MobileNo); RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", "")); string Status = m.Status.ToString(); string Msg = m.Msg; if (Status == "Success") { IntRandom = RandomNumber(1, 9999); string Message = @"Your OTP is " + IntRandom.ToString(); string SMSResult = await dsLogin.SendSms(MobileNo, Message); SMSResponceObject S = JsonConvert.DeserializeObject <SMSResponceObject>(SMSResult.Replace("[", "").Replace("]", "")); string SmsStatusAlert = S.Status.ToString(); await DisplayAlert("Food4Health - OTP ", IntRandom.ToString(), "Done"); StackMobileNo.IsVisible = false; StackReset.IsVisible = false; StackOTP.IsVisible = true; } else { await DisplayAlert("Validation Error", "Mobile number not found", "Re-try"); } } else { await DisplayAlert("Validation Error", ValidationMsg, "Re-try"); } }
private async void OnbtnChangeAddress(object sender, EventArgs e) { var AddLine1 = txtAddress1.Text; var AddLine2 = txtAddress2.Text; var CityTown = txtCityTown.Text; var StateArea = txtStateArea.Text; var PostCode = txtPostcode.Text; var Country = ddlCountry.Items[ddlCountry.SelectedIndex]; string Status = "Fail"; string Msg = "Technical Error"; if (AddLine1 == "") { await DisplayAlert("Validation Error", "Address Line 1 cannot be blank", "Re-try"); return; } if (CityTown == "") { await DisplayAlert("Validation Error", "City / Town cannot be blank", "Re-try"); return; } //if (Country == "") //{ // await DisplayAlert("Validation Error", "Country cannot be blank", "Re-try"); // return; //} dsLogin = new F4HApp.dataservice.DSLogin(); string result = await dsLogin.UpdateMemberDetails(App.MemberID, AddLine1, AddLine2, "", CityTown, StateArea, PostCode, Country); RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", "")); Status = m.Status.ToString(); Msg = m.Msg; if (Status == "Success") { await DisplayAlert("Food4Health", "Contact Address updated successfully", "Done"); txtAddress1.Text = ""; txtAddress2.Text = ""; txtCityTown.Text = ""; txtStateArea.Text = ""; txtPostcode.Text = ""; ddlCountry.SelectedIndex = ddlCountry.Items.IndexOf("KENYA"); } else { await DisplayAlert("Food4Health Error", "Technical Error", "Re-try"); } }
private async void OnbtnResetPassword(object sender, EventArgs e) { var Pass = string.Empty; Pass = txtResetPassword.Text; if (Pass == null) { await DisplayAlert("Validation Error", "Enter new password", "Re-try"); return; } dsLogin = new F4HApp.dataservice.DSLogin(); string result = await dsLogin.ResetMemberPassword(txtMobileNo.Text, Pass); RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", "")); string Status = m.Status.ToString(); string Msg = m.Msg; txtResetPassword.Text = ""; await DisplayAlert("Food4Health", Msg, "Done"); }
private async void OnbtnRegister(object sender, EventArgs e) { var Title = string.Empty; var FirstName = string.Empty; var LastName = string.Empty; var MobileNo = string.Empty; var EmailID = string.Empty; var DOB = string.Empty; var Password = string.Empty; string ValidationMsg = ""; bool IsValid = true; FirstName = txtFirstName.Text; LastName = txtLastName.Text; MobileNo = txtMobileNo.Text; EmailID = txtEmailID.Text; DOB = txtDOB.Text; Password = txtPassword.Text; if (ddlTitle.SelectedIndex > -1) { Title = ddlTitle.Items[ddlTitle.SelectedIndex]; } if (Title == "") { ValidationMsg += "Title\n"; IsValid = false; } if (FirstName == null) { ValidationMsg += "First Name\n"; IsValid = false; } if (LastName == null) { ValidationMsg += "Last Name\n"; IsValid = false; } if (MobileNo == null) { ValidationMsg += "Mobile\n"; IsValid = false; } else { if (!CheckValidMobile(MobileNo)) { ValidationMsg += "Enter 9 digit mobile no.\n"; IsValid = false; } } if (EmailID == null) { ValidationMsg += "Email address\n"; IsValid = false; } else { if (!CheckValidEmail(EmailID)) { ValidationMsg += "Invalid email address\n"; IsValid = false; } } if (DOB == null) { ValidationMsg += "Date of birth\n"; IsValid = false; } else { if (!CheckValidDOB(DOB)) { ValidationMsg += "Invalid date of birth format\n"; IsValid = false; } } if (Password == null) { ValidationMsg += "Password\n"; IsValid = false; } if (IsValid) { string Status = "Fail"; string Msg = "Technical Error"; dsLogin = new F4HApp.dataservice.DSLogin(); string result = await dsLogin.Registration(Title, FirstName, LastName, DOB, MobileNo, EmailID, Password); try { RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", "")); Status = m.Status.ToString(); Msg = m.Msg; } catch { } if (Status == "Success") { string Message = @"Welcome to F4H, your gateway to earn loyalty points. Login credentials - Mobile No.: " + MobileNo + @" Password:"******"[", "").Replace("]", "")); string SmsStatusAlert = S.Status.ToString(); await DisplayAlert("Congratulations " + SmsStatusAlert, "Your registration was successful", "Login"); await Navigation.PushModalAsync(new F4HApp.views.Home()); } else { await DisplayAlert("Food4Health", Msg, "Re-Try"); } } else { await DisplayAlert("Validation Error", ValidationMsg, "Re-try"); } //await Navigation.PushModalAsync(new F4HApp.MP()); }
private async void OnbtnAdd(object sender, EventArgs e) { var FName = txtFName.Text; var LName = txtLName.Text; var MobileNo = txtMobileNo.Text; string Status = "Fail"; string Msg = "Technical Error"; if (FName == null) { await DisplayAlert("Validation Error", "First name cannot be blank", "Re-try"); return; } if (LName == null) { await DisplayAlert("Validation Error", "Last name cannot be blank", "Re-try"); return; } if (MobileNo == null) { await DisplayAlert("Validation Error", "Mobile No cannot be blank", "Re-try"); return; } if (ddlCategory.SelectedIndex == -1) { await DisplayAlert("Validation Error", "Category cannot be blank", "Re-try"); return; } var FFCategory = ddlCategory.Items[ddlCategory.SelectedIndex]; dsLogin = new F4HApp.dataservice.DSLogin(); string result = await dsLogin.MemberFF(App.MemberID, FName, LName, MobileNo, FFCategory); RegistrationResponseObject m = JsonConvert.DeserializeObject <RegistrationResponseObject>(result.Replace("[", "").Replace("]", "")); Status = m.Status.ToString(); Msg = m.Msg; if (Status == "Success") { await DisplayAlert("Food4Health", "Member added to your list", "Done"); string Response = await FamilyList(); Response = await FriendList(); txtFName.Text = ""; txtLName.Text = ""; txtMobileNo.Text = ""; } else { await DisplayAlert("Food4Health Error", Msg, "Re-try"); } }