Esempio n. 1
0
        private void BtnEntrar_Click(object sender, EventArgs e)
        {
            String rota = "http://localhost:3000/usuario-login";

            AdminLogado admin = new AdminLogado();

            admin.email = TxtUsuario.Text;
            admin.senha = TxtSenha.Text;

            String json        = JsonConvert.SerializeObject(admin);
            Object objResponse = ConnectionAPI.login(rota, json);

            if (objResponse != null)
            {
                RespUsuario respUsuario = JsonConvert.DeserializeObject <RespUsuario>(objResponse.ToString());


                if (respUsuario.administrador != null && respUsuario.administrador.ativo.Trim().Equals("true"))
                {
                    //MessageBox.Show("Login efetuado com sucesso!");
                    this.Hide();
                    Dashboard home = new Dashboard(respUsuario.administrador);
                    home.Show();
                }
                else
                {
                    MessageBox.Show(respUsuario.message, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }