private void txtFavorilerimDoktorSil_Click(object sender, EventArgs e, Favori favori)
        {
            favoriService.Sil(favori.Id);

            Intent intent = new Intent(context, typeof(HastaFavoriSilActivity));

            intent.PutExtra("tc", hasta.TC);
            context.StartActivity(intent);
        }
예제 #2
0
        private void TxtHastaRandevularimIslem_Click(object sender, EventArgs e, Randevu randevu, Doktor doktor)
        {
            TextView thisButton = (TextView)sender;

            if (randevu.Tarih > DateTime.Now)
            {
                randevuService.Sil(randevu.Id);

                Intent intent = new Intent(context, typeof(HastaRandevularimIptalActivity));
                intent.PutExtra("tc", hasta.TC);
                context.StartActivity(intent);

                string mesaj = "Sayın " + hasta.Ad + " " + hasta.Soyad + ", " + System.Environment.NewLine + System.Environment.NewLine +
                               randevu.Tarih.Value.ToLongDateString() + " " + randevu.Tarih.Value.ToShortTimeString() +
                               " tarihli randevunuz iptal edilmiştir." + System.Environment.NewLine + System.Environment.NewLine +
                               "Sağlıklı günler dileriz.";

                randevuService.RandevuMailiGonder(hasta.Mail, mesaj);
            }
            else
            {
                //favori sorgula. Yoksa ekle, varsa çıkart.
                Favori favori = favoriService.Getir(hasta.Id, doktor.Id);
                if (favori == null)
                {
                    favori                   = new Favori();
                    favori.DoktorId          = doktor.Id;
                    favori.HastaId           = hasta.Id;
                    favori.OlusturulmaTarihi = DateTime.Now;

                    favoriService.Ekle(favori);

                    Toast.MakeText(Application.Context, doktor.Unvan + " " + doktor.Ad + " " + doktor.Soyad + " favorilere eklendi.", ToastLength.Short).Show();
                    thisButton.Text = "FAV-";
                }
                else
                {
                    favoriService.Sil(favori.Id);
                    Toast.MakeText(Application.Context, doktor.Unvan + " " + doktor.Ad + " " + doktor.Soyad + " favorilerden çıkarıldı.", ToastLength.Short).Show();
                    thisButton.Text = "FAV+";
                }
            }
        }