private void BtnRandevuOnay_Click(object sender, EventArgs e)
        {
            Randevu randevu = new Randevu();

            randevu.BolumId   = bolum.Id;
            randevu.HastaneId = hastane.Id;
            randevu.DoktorId  = doktor.Id;
            randevu.Tarih     = randevuTarihi;
            randevu.HastaId   = hasta.Id;

            randevuService.Ekle(randevu);

            var intent = new Intent(this, typeof(RandevuOnaylandiActivity));

            intent.PutExtra("tc", Intent.GetStringExtra("hastaTc"));
            StartActivity(intent);

            string mesaj = "Sayın " + hasta.Ad + " " + hasta.Soyad + ", " + System.Environment.NewLine +
                           "Randevu detaylarınız aşağıda yer almaktadır;" + System.Environment.NewLine + System.Environment.NewLine +
                           "İl: " + hastane.Il + System.Environment.NewLine +
                           "İlçe: " + hastane.Ilce + System.Environment.NewLine +
                           "Hastane: " + hastane.Ad + System.Environment.NewLine +
                           "Bölüm: " + bolum.Ad + System.Environment.NewLine +
                           "Doktor: " + doktor.Ad + " " + doktor.Soyad + System.Environment.NewLine +
                           "Tarih: " + randevuTarihi.ToLongDateString() + " " + randevuTarihi.ToShortTimeString() + System.Environment.NewLine + System.Environment.NewLine +
                           "Sağlıklı günler dileriz.";

            randevuService.RandevuMailiGonder(hasta.Mail, mesaj);
        }
Пример #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+";
                }
            }
        }