protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.LA_Relatorio_HTML); Banco banco = new Banco(); FuncoesAlerta func = new FuncoesAlerta(); int tamanhoFor = banco.QuantidadeNotas(); DataTable notas = banco.TodasNotas(); WebView web = FindViewById <WebView>(Resource.Id.WV_Ver_Notas); string codigoUsuario = Intent.GetStringExtra("codigoUsuario"); for (int x = 0; x < tamanhoFor; x++) { web.LoadData(func.RetornaHTML(tamanhoFor, notas).ToString(), "text/html", "UTF-8"); } Button Voltar_HTML = FindViewById <Button>(Resource.Id.BT_Rela_HTML_Voltar); Voltar_HTML.Click += delegate { var verNotas = new Intent(this, typeof(AC_VerNotas)); verNotas.PutExtra("codigoUsuario", codigoUsuario); StartActivity(verNotas); Finish(); }; }
//Método para validar o login do EditText e entrar na tela de visualização de notas public void EntrarSistema(object sender, EventArgs eventArgs) { EditText login = (EditText)FindViewById(Resource.Id.ET_Login_Nome); EditText senha = (EditText)FindViewById(Resource.Id.ET_Login_Senha); Banco banco = new Banco(); FuncoesAlerta func = new FuncoesAlerta(); if (func.VerificaDados(login.Text, senha.Text)) { if (!banco.ValidaUsuario(login.Text, func.Criptografa(senha.Text))) { this.AlertaUsarioNegado(); } else { //Envia o código do usuário para a activity AC_VerNotas //poder buscar o datatable com as notas e preencher no gridview string codigoUsuario = banco.RetornaCodUsu(login.Text, func.Criptografa(senha.Text)); var verNotas = new Intent(this, typeof(AC_VerNotas)); verNotas.PutExtra("codigoUsuario", codigoUsuario); StartActivity(verNotas); Finish(); } } else { this.AlertaDadosVazios(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Banco banco = new Banco(); FuncoesAlerta funcao = new FuncoesAlerta(); SetContentView(Resource.Layout.LA_Cadastrar_Notas); // Create your application here string codigoUsuario = Intent.GetStringExtra("codigoUsuario"); //Evento click para cadastrar uma nova nota //no banco de dados Button inserirNota = FindViewById <Button>(Resource.Id.BT_Cad_Nota_Confirmar); inserirNota.Click += delegate { EditText titulo = (EditText)FindViewById(Resource.Id.ET_Cad_Nota_Titulo); EditText descricao = (EditText)FindViewById(Resource.Id.ET_Cad_Nota_Descricao); if (funcao.VerificaDados(titulo.Text, descricao.Text)) { banco.CadastrarNota(codigoUsuario, titulo.Text, descricao.Text); funcao.LimparTextEdit(titulo, descricao); Toast.MakeText(this, "Nota cadastrada!", ToastLength.Short).Show(); } }; //Evento click para voltar a tela de ver notas //já exibindo a nota recém inserida Button voltar_Ver_Notas = FindViewById <Button>(Resource.Id.BT_Cad_Nota_Voltar); voltar_Ver_Notas.Click += delegate { var verNotas = new Intent(this, typeof(AC_VerNotas)); verNotas.PutExtra("codigoUsuario", codigoUsuario); StartActivity(verNotas); Finish(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.LA_Editar_Nota); // Create your application here //Pega o título e a descrição e exibem para edição EditText titulo = (EditText)FindViewById(Resource.Id.ET_Ed_Nota_Titulo); EditText descricao = (EditText)FindViewById(Resource.Id.ET_Ed_Nota_Descricao); titulo.Text = Intent.GetStringExtra("titulo"); descricao.Text = Intent.GetStringExtra("descricao"); Button voltar_Para_Ver_Notas = FindViewById <Button>(Resource.Id.BT_Ed_Nota_Voltar); voltar_Para_Ver_Notas.Click += delegate { var verNota = new Intent(this, typeof(AC_VerNotas)); verNota.PutExtra("codigoUsuario", Intent.GetStringExtra("codigoUsuario")); StartActivity(verNota); }; //Método para exibir um alerta e confirmar se a edição //é para ser concluída. Button confirmar_Edicao_Notas = FindViewById <Button>(Resource.Id.BT_Ed_Nota_Confirmar); confirmar_Edicao_Notas.Click += delegate { AlertDialog.Builder alerta = new AlertDialog.Builder(this); alerta.SetTitle("Alerta!"); alerta.SetIcon(Android.Resource.Drawable.IcDialogInfo); alerta.SetMessage("Deseja alterar a nota"); alerta.SetPositiveButton("Editar", (senderAlert, args) => { Banco banco = new Banco(); string codNota = Intent.GetStringExtra("codigoNota"); string tituloNota = titulo.Text; string descricaoNota = descricao.Text; banco.EditarNota(codNota, tituloNota, descricaoNota); FuncoesAlerta funcoes = new FuncoesAlerta(); funcoes.LimparTextEdit(titulo, descricao); Toast.MakeText(this, "Salvo com sucesso!", ToastLength.Short).Show(); }); alerta.SetNegativeButton("Voltar", (senderAlert, args) => { var verNota = new Intent(this, typeof(AC_VerNotas)); verNota.PutExtra("codigoUsuario", Intent.GetStringExtra("codigoUsuario")); StartActivity(verNota); Toast.MakeText(this, "Cancelado !", ToastLength.Short).Show(); }); Dialog dialog = alerta.Create(); dialog.Show(); }; //Método para exibir uma alerta e confirmar se o usuário deseja //excluir a nota Button apagar_Nota = FindViewById <Button>(Resource.Id.BT_Ed_Apagar_Notar); apagar_Nota.Click += delegate { AlertDialog.Builder alerta = new AlertDialog.Builder(this); alerta.SetTitle("Alerta!"); alerta.SetIcon(Android.Resource.Drawable.AlertDarkFrame); alerta.SetMessage("Deseja apagar a nota"); alerta.SetPositiveButton("Apagar", (senderAlert, args) => { Banco banco = new Banco(); string codNota = Intent.GetStringExtra("codigoNota"); banco.ApagarNota(codNota); FuncoesAlerta funcoes = new FuncoesAlerta(); funcoes.LimparTextEdit(titulo, descricao); Toast.MakeText(this, "Nota apagada!", ToastLength.Short).Show(); }); alerta.SetNegativeButton("Voltar", (senderAlert, args) => { }); Dialog dialog = alerta.Create(); dialog.Show(); }; }