Esempio n. 1
0
        private async void Bt_Register_Clicked(object sender, EventArgs e)
        {
            DBLoginRegisterConnection db  = new DBLoginRegisterConnection();
            DBCurriculoConnection     db2 = new DBCurriculoConnection();

            String username = Et_Username.Text;
            String password = Et_Password.Text;
            String name     = Et_Name.Text;


            String hashedPassword = Hash.sha256_hash(password);


            Task <string> resultTask = db.RegisterUser(name, username, hashedPassword);

            String result = await resultTask;



            var aluno = JsonConvert.DeserializeObject <Aluno>(result);

            Variaveis._aluno = aluno;


            Task <string> resultTask2 = db2.PostCurriculo(aluno.Id);



            await Navigation.PushModalAsync(new NavigationPage(new MenuPage()));
        }
        private async void Bt_Login_Clicked(object sender, EventArgs e)
        {
            DBLoginRegisterConnection db = new DBLoginRegisterConnection();

            String username = Et_Username.Text;
            String password = Et_Password.Text;

            String hashedPassword = Hash.sha256_hash(password);


            Task <string> resultTask = db.LoginUser(username, hashedPassword);
            string        result     = await resultTask;

            if (result.Contains("success") && result.Contains("true"))
            {
                var aluno = JsonConvert.DeserializeObject <Aluno>(result);

                Variaveis._aluno = aluno;



                await Navigation.PushModalAsync(new NavigationPage(new MenuPage()));
            }

            else
            {
                await DisplayAlert("Result", "Login Failed", "OK");
            }
        }