Ejemplo n.º 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (edtISBN.Text != "" && edtTitle.Text != "" && edtCod.Text != "" && edtPreview.Text != "" && edtAutor.Text != "" && Img != null)
            {
                var Guardar = Service.AddBook(edtCod.Text, edtTitle.Text, edtISBN.Text, edtAutor.Text, bitmapData, DateTime.Now, edtPreview.Text, cat.Id);
                if (Guardar.band)
                {
                    Toast.MakeText(this, Guardar.message, ToastLength.Long).Show();

                    //SE CREA EL POP UP DEL LIBRO
                    Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder(this)
                                                      .SetTitle("Atención")
                                                      .SetMessage("¿Desea agregar copias de este libro?")
                                                      .SetIcon(Android.Resource.Drawable.IcDialogInfo)
                                                      .SetNeutralButton("No", (IDialogInterfaceOnClickListener)null)
                                                      .SetPositiveButton("Sí", delegate {
                        Intent i = new Intent(this, typeof(AddCopyActivity));
                        i.PutExtra("libroId", edtISBN.Text);
                        StartActivity(i);
                        this.Finish();
                    })
                                                      .Create();
                    builder.Show();
                }
                else
                {
                    Toast.MakeText(this, Guardar.message, ToastLength.Long).Show();
                }
            }
            else
            {
                Toast.MakeText(this, "Llene los campos importantes", ToastLength.Long).Show();
            }
        }