示例#1
0
        async void btnUpdate(object sender, EventArgs e)
        {
            var rep = fu.GetRepresentative(Global.currentRep.Username);

            /*
             *  fu.UpdateREp
             * */
        }
示例#2
0
        async void Login_Clicked(object sender, EventArgs e)
        {
            IsBusy = true;
            string Username = LoginUsername.Text;
            string Password = LoginPassword.Text;

            if (string.IsNullOrEmpty(Username) || string.IsNullOrEmpty(Password))
            {
                await DisplayAlert("Empty Fields", "Please enter both credentials", "OK");
            }

            else
            {
                if (LoginUser.Equals("Donor"))
                {
                    Donor user = await fe.GetDonor(Username);

                    if (user != null)
                    {
                        if (Username == user.Username && Password == user.Password)
                        {
                            App.IsUserLoggedIn  = true;
                            Global.currentDonor = user;
                            // Navigation.InsertPageBefore(new MainPage(), this);
                            // await Navigation.PopAsync();
                            Application.Current.MainPage = new MainPageDonor();
                            IsBusy = false;

                            //redirect to another =mainpaege
                        }
                        else
                        {
                            await DisplayAlert("Login Fail", "Please enter correct password", "OK");

                            LoginPassword.Text = string.Empty;
                        }
                    }
                    else
                    {
                        await DisplayAlert("Login Fail", "User not found", "OK");
                    }
                }
                else if (LoginUser.Equals("Institution"))
                {
                    Institution user = await fe.GetRepresentative(Username);

                    if (user != null)
                    {
                        if (Username == user.Username && Password == user.Password)
                        {
                            App.IsUserLoggedIn = true;
                            Global.currentRep  = user;
                            // Navigation.InsertPageBefore(new MainPage(), this);
                            // await Navigation.PopAsync();
                            Application.Current.MainPage = new MainPage();
                            //redirect to another =mainpaege
                        }
                        else
                        {
                            await DisplayAlert("Login Fail", "Please enter correct password", "OK");

                            LoginPassword.Text = string.Empty;
                        }
                    }
                    else
                    {
                        await DisplayAlert("Login Fail", "User not found", "OK");
                    }
                }
                else
                {
                    await DisplayAlert("Choose user", "Please enter user type", "OK");
                }
            }
        }