Exemplo n.º 1
0
        public void EliminarNota()
        {
            MisNotas objNota = new MisNotas()
            {
                IdNotas = idNota
            };

            AlertDialog.Builder dialogo = new AlertDialog.Builder(this);
            AlertDialog         alert   = dialogo.Create();

            alert.SetTitle("Advertencia");
            alert.SetMessage("Realmente quiere eliminar esta nota?");
            alert.SetIcon(Resource.Mipmap.ic_action_warning);
            alert.SetButton("SI", (c, ev) =>
            {
                int respuesta = MisNotasDb.EliminarNota(objNota);
                if (respuesta > 0)
                {
                    Toast.MakeText(this, "Nota Eliminada", ToastLength.Long).Show();
                    Intent intentBack = new Intent(this, typeof(ListaNotasActivity));
                    StartActivity(intentBack, ActivityOptions.MakeSceneTransitionAnimation(this).ToBundle());
                }
                else
                {
                    Toast.MakeText(this, "Se produjo un error", ToastLength.Short).Show();
                }
            });
            alert.SetButton2("NO", (c, ev) => {
                Toast.MakeText(this, "Cancelado", ToastLength.Long).Show();
            });
            alert.Show();
        }
Exemplo n.º 2
0
        public void EditarNota()
        {
            MisNotas objNota = new MisNotas()
            {
                IdNotas           = idNota,
                Titulo            = tituloDetalle.Text,
                Contenido         = detalleNota.Text,
                FechaNota         = Convert.ToDateTime(fechaNotaCreacion.ToString()),
                FechaModificacion = DateTime.Now,
                IdColor           = color,
                IdFont            = font
            };


            int respuesta = MisNotasDb.EditarNota(objNota);

            if (respuesta > 0)
            {
                Toast.MakeText(this, "Modificaciones Guardadas", ToastLength.Long).Show();
            }
            else
            {
                Toast.MakeText(this, "Se produjo un error", ToastLength.Short).Show();
            }
        }
Exemplo n.º 3
0
        public void listarNotas()
        {
            RecyclerView notasRecyclerView = FindViewById <RecyclerView>(Resource.Id.listaNotasRecycler);

            mLayoutManager = new LinearLayoutManager(this);
            notasRecyclerView.SetLayoutManager(mLayoutManager);
            listaNotas = MisNotasDb.ListarNotas();
            mAdapter   = new MyAdapter(listaNotas, listaRecycler, this);

            notasRecyclerView.SetAdapter(mAdapter);
        }
Exemplo n.º 4
0
        public void guardarNota()
        {
            objNotas                   = new MisNotas();
            objNotas.Titulo            = tituloNota.Text;
            objNotas.Contenido         = nuevaNota.Text;
            objNotas.FechaNota         = DateTime.Now;
            objNotas.FechaModificacion = DateTime.Now;
            objNotas.Recordatorio      = DateTime.Now;
            objNotas.IdColor           = color;
            objNotas.IdFont            = font;

            int i = MisNotasDb.GuardarNota(objNotas);

            if (i > 0)
            {
                Toast.MakeText(this, "Nota Registrada", ToastLength.Long).Show();
            }
            else
            {
                Toast.MakeText(this, "Error en Guardar", ToastLength.Long).Show();
            }
        }