public bool Add(HastaKayitDTO hastaKayit) { CheckHastaVarMi(hastaKayit.HastaBilgileri); CheckKullaniciAdiVarMi(hastaKayit.GirisBilgileri.KullaniciAdi); CheckSifreGecerliMi(hastaKayit.GirisBilgileri.Sifre); bool hastaKaydedildi = false; bool userKaydedildi = _userDAL.Add(hastaKayit.GirisBilgileri) > 0; int userID = 0; if (userKaydedildi) { userID = _userDAL.GetUserID(hastaKayit.GirisBilgileri); hastaKayit.HastaBilgileri.UserID = userID; hastaKaydedildi = _hastaDAL.Add(hastaKayit.HastaBilgileri) > 0; } return(hastaKaydedildi); }
private void btnUyeOl_Click(object sender, EventArgs e) { bool check = false; try { if (NullorEmpty(txtTckn.Text, txtSoyad.Text, txtAd.Text, txtEmail.Text, txtCom.Text, txtSifre.Text, txtSifreTekrar.Text)) { if (txtTckn.Text.Length != 11) { MessageBox.Show("TC 11 haneli olmalıdır."); return; } if (txtSifre.Text != txtSifreTekrar.Text) { MessageBox.Show("Şifreler uyuşmuyor", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } _hastaBLL.CheckSifreGecerliMi(txtSifre.Text); _hkDTO = new HastaKayitDTO(txtTckn.Text, txtAd.Text, txtSoyad.Text, txtEmail.Text + "@" + txtCom.Text, txtSifre.Text); check = _hastaBLL.Add(_hkDTO); if (check) { MessageBox.Show("Kaydınız başarıyla gerçekleşti!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("Boş alan geçilemez", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message);; } }