示例#1
0
        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");
            }
        }
示例#2
0
        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");
            }
        }
示例#3
0
        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");
            }
        }
示例#4
0
        private async Task <string> GetMemberDetails()
        {
            string result = "Success";

            dsLogin = new F4HApp.dataservice.DSLogin();
            string Response = await dsLogin.GetMemberDetails(App.MemberID);

            try
            {
                MemberDetailResponseObject m = JsonConvert.DeserializeObject <MemberDetailResponseObject>(Response.Replace("[", "").Replace("]", ""));
                string Result    = m.Status;
                string AddLine1  = m.AddLine1;
                string AddLine2  = m.AddLine2;
                string CityTown  = m.CityTown;
                string StateArea = m.StateArea;
                string PostCode  = m.PostCode;
                string Country   = m.Country;


                Device.BeginInvokeOnMainThread(() =>
                {
                    txtAddress1.Text = AddLine1;
                    txtAddress2.Text = AddLine2;

                    txtCityTown.Text  = CityTown;
                    txtStateArea.Text = StateArea;
                    txtPostcode.Text  = PostCode;
                    if (Country != "")
                    {
                        ddlCountry.SelectedIndex = ddlCountry.Items.IndexOf(Country);
                    }
                    else
                    {
                        ddlCountry.SelectedIndex = ddlCountry.Items.IndexOf("KENYA");
                    }
                });
            }
            catch (Exception ex)
            {
                string rr = ex.Message;
            }

            return(result);
        }
示例#5
0
        private async void OnAboutUSPlans(object sender, EventArgs e)
        {
            dsLogin = new F4HApp.dataservice.DSLogin();
            string result = await dsLogin.GetAboutUSPlans("");

            string AboutUsMessage = "";

            try
            {
                AboutHelathPlanResponceObject m = JsonConvert.DeserializeObject <AboutHelathPlanResponceObject>(result.Replace("[", "").Replace("]", ""));
                AboutUsMessage = m.AboutHelathPlanMessage.ToString();

                await DisplayAlert("About Health Plans", AboutUsMessage, "OK");
            }
            catch (Exception ex)
            {
                await DisplayAlert("Conection Error", ex.ToString(), "Error");
            }
        }
示例#6
0
        private async void OnAboutUSPatnersMark()
        {
            dsLogin = new F4HApp.dataservice.DSLogin();
            string result = await dsLogin.GetAboutUSPatners("");

            string AboutUsMessage = "";

            try
            {
                AboutPatnerResponceObject m = JsonConvert.DeserializeObject <AboutPatnerResponceObject>(result.Replace("[", "").Replace("]", ""));
                AboutUsMessage = m.AboutPatnerMessage.ToString();

                await DisplayAlert("Partners ", AboutUsMessage, "OK");
            }
            catch (Exception ex)
            {
                await DisplayAlert("Conection Error", ex.ToString(), "Error");
            }
        }
示例#7
0
        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");
        }
示例#8
0
        private async void OnButtonSubmit(object sender, EventArgs e)
        {
            //if (CrossConnectivity.Current.IsConnected)
            //{
            //await Navigation.PushModalAsync(new F4HApp.MP());
            var    MobileNo      = txtMobileNo.Text;
            var    Password      = txtPassword.Text;
            string MemberID      = "";
            string MemberName    = "";
            string IsLoggedIn    = "Fail";
            string Msg           = "Invalid Login";
            string LastLoginDate = "";

            if (MobileNo == null)
            {
                await DisplayAlert("Validation Error", "Username cannot be blank", "Re-try");

                return;
            }

            if (Password == null)
            {
                await DisplayAlert("Validation Error", "Password cannot be blank", "Re-try");

                return;
            }

            dsLogin = new F4HApp.dataservice.DSLogin();
            string result = await dsLogin.ChkLogin(MobileNo, Password);

            LoginResponseObject m = JsonConvert.DeserializeObject <LoginResponseObject>(result.Replace("[", "").Replace("]", ""));

            IsLoggedIn    = m.IsLoggedIn.ToString();
            MemberID      = m.MemberId;
            MemberName    = m.Name;
            Msg           = m.Msg;
            LastLoginDate = m.LastLoginDate;

            if (IsLoggedIn == "Success")
            {
                App.IsLoggedIn    = true;
                App.MemberID      = MemberID;
                App.MemberName    = MemberName;
                App.LastLoginDate = LastLoginDate;
                App.MobileNumber  = txtMobileNo.Text.Trim();
                await Navigation.PushModalAsync(new F4HApp.MP());
            }
            else
            {
                await DisplayAlert("Validation Error", "Invalid login attempt", "Re-try");
            }


            //try
            //{
            //    var content = "";
            //    HttpClient client = new HttpClient();
            //    var RestURL = "http://www.khubisolutions.com/f4hrestapi/api/home";
            //    client.BaseAddress = new Uri(RestURL);
            //    client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            //    HttpResponseMessage response = await client.GetAsync(RestURL);
            //    content = await response.Content.ReadAsStringAsync();
            //    //var Items = JsonConvert.DeserializeObject<List<ItemClass>>(content);
            //    //ListView1.ItemsSource = Items;
            //}
            //catch(Exception ex)
            //{
            //    string rr = ex.Message.ToString();
            //}
            //}
            //else
            //{
            //    await DisplayAlert("Conection Error", "Internet Conection Wifi/Mobile Data is currently inactive. Try again later.", "Re-try");
            //}
        }
示例#9
0
        private async Task <string> GetMemberDetails()
        {
            string result = "Success";

            dsLogin = new F4HApp.dataservice.DSLogin();
            string Response = await dsLogin.GetMemberDetails(App.MemberID);

            try
            {
                MemberDetailResponseObject m = JsonConvert.DeserializeObject <MemberDetailResponseObject>(Response.Replace("[", "").Replace("]", ""));
                string Result    = m.Status;
                string MobileNo  = "Mobile No : " + m.MobileNo;
                string EmailID   = "Email ID : " + m.EmailID;
                string AddLine1  = m.AddLine1;
                string AddLine2  = m.AddLine2;
                string AddLine3  = m.AddLine3;
                string CityTown  = m.CityTown;
                string StateArea = m.StateArea;
                string PostCode  = m.PostCode;
                string Country   = m.Country;
                string Address   = "";

                if (AddLine1.Trim() != "")
                {
                    Address += AddLine1;
                }

                if (AddLine2.Trim() != "")
                {
                    Address += " , " + AddLine2;
                }

                if (AddLine3.Trim() != "")
                {
                    Address += "\n" + AddLine3;
                }

                if (CityTown.Trim() != "")
                {
                    Address += " , " + CityTown;
                }

                if (StateArea.Trim() != "")
                {
                    Address += "\n" + StateArea;
                }

                if (PostCode.Trim() != "")
                {
                    Address += " " + PostCode;
                }

                if (Country.Trim() != "")
                {
                    Address += "\n" + Country;
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    lblMobileNo.Text     = MobileNo;
                    lblEmailAddress.Text = EmailID;

                    if (Address == "")
                    {
                        lblAddress.Text       = "Pending";
                        btnChangeAddress.Text = "Enter Contact Address";
                    }
                    else
                    {
                        lblAddress.Text       = Address;
                        btnChangeAddress.Text = "Change Contact Address";
                    }
                });
            }
            catch (Exception ex)
            {
                string rr = ex.Message;
            }

            return(result);
        }
示例#10
0
        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());
        }
示例#11
0
        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");
            }
        }