private void button12_Click(object sender, EventArgs e) { bool hataVar = false; try { Convert.ToInt64(textBox29.Text); } catch { MessageBox.Show("T.C. Numarasına yanlış karakterler girdiniz", "Hatalı Karakterler", MessageBoxButtons.OK, MessageBoxIcon.Error); hataVar = true; } if (hataVar == false) { YönetimDb db = new YönetimDb(); bool hastaVar = false; foreach (var hasta in db.Hastalar) { if (hasta.TCNo == Convert.ToInt64(textBox29.Text)) { hastaVar = true; break; } } if (hastaVar == false) { MessageBox.Show("Girdiğiniz T.C. Numarasında hasta bulunamadı", "Hasta Yok", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { textBox31.Text = textBox29.Text; } } }
private void button1_Click(object sender, EventArgs e) { string kullanıcıAdı = textBox1.Text; string şifre = textBox2.Text; bool hataVar = true; YönetimDb db = new YönetimDb(); foreach (var eleman in db.Kullanıcılar) { if (eleman.KullanıcıAdı == kullanıcıAdı) { if (eleman.Şifre == şifre) { hataVar = false; if (checkBox1.Checked == true) { Properties.Settings.Default.kullanıcıAdı = kullanıcıAdı; Properties.Settings.Default.şifre = şifre; Properties.Settings.Default.Save(); } Form3 f3 = new Form3(); f3.kullanıcıAdı = textBox1.Text; f3.Show(); this.Hide(); } } } if (hataVar == true) { label3.Location = new Point(178, 112); } }
private void button9_Click(object sender, EventArgs e) { if (MessageBox.Show(textBox4.Text + " T.C. Numaralı hastayı silmek istediğinize emin misiniz?", "Silmek İstiyor Musunuz?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { YönetimDb db = new YönetimDb(); foreach (var hasta in db.Hastalar) { if (hasta.TCNo == Convert.ToInt64(textBox4.Text)) { db.Hastalar.Remove(hasta); } } db.SaveChanges(); MessageBox.Show("Silme işlemi başarıyla tamamlandı", "Silme Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox11.Text = ""; textBox12.Text = ""; textBox13.Text = ""; textBox14.Text = ""; textBox15.Text = ""; textBox16.Text = ""; textBox17.Text = ""; textBox18.Text = ""; textBox19.Text = ""; textBox20.Text = ""; textBox21.Text = ""; textBox22.Text = ""; button10.Enabled = false; button9.Enabled = false; } }
private void button15_Click(object sender, EventArgs e) { bool hataVar = false; try { Convert.ToInt64(textBox34.Text); } catch { MessageBox.Show("T.C. Numarasına yanlış karakterler girdiniz", "Hatalı Karakterler", MessageBoxButtons.OK, MessageBoxIcon.Error); hataVar = true; } if (hataVar == false) { YönetimDb db = new YönetimDb(); bool hastaVar = false; foreach (var hasta in db.Hastalar) { if (hasta.TCNo == Convert.ToInt64(textBox34.Text)) { hastaVar = true; break; } } if (hastaVar == false) { MessageBox.Show("Girdiğiniz T.C. Numarasında hasta bulunamadı", "Hasta Yok", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { bool hataVar2 = false; File dosya = new File(); dosya.Path = Properties.Settings.Default.tahlilYolu; dosya.FileName = textBox34.Text; try { dosya.ReadFile(); } catch { hataVar2 = true; MessageBox.Show(textBox34.Text + " T.C. Numaralı hastanın tahlili bulunamadı veya Tahlil Yolu değişmiş olabilir", "Tahlil Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (hataVar2 == false) { foreach (string içerik in dosya.ReadFile().Split('\n')) { listBox2.Items.Add(içerik); } button17.Enabled = true; button16.Enabled = true; } } } }
public bool Hasta_Kayıtlımı(long tcNo) { bool kayıt = false; YönetimDb db = new YönetimDb(); foreach (var satır in db.Hastalar) { if (satır.TCNo == tcNo) { kayıt = true; } } return(kayıt); }
public bool Randevu_Kontrol() { bool doluluk = false; string saat; string dakika; YönetimDb db = new YönetimDb(); foreach (var eleman in db.Hastalar) { saat = eleman.RandevuSaati.Split(':')[0]; dakika = eleman.RandevuSaati.Split(':')[1]; if (eleman.RandevuTarihi == dateTimePicker2.Value && saat == comboBox8.Text && dakika == comboBox9.Text && eleman.Bölüm == comboBox10.Text) { doluluk = true; } } return(doluluk); }
private void button1_Click(object sender, EventArgs e) { string kullanıcıadı = Properties.Settings.Default.kullanıcıAdı; string eskik = Properties.Settings.Default.şifre; string eski = textBox1.Text; string yeni = textBox2.Text; string yenit = textBox3.Text; if (eski == "" || yeni == "" || yenit == "") { MessageBox.Show("Alanlardan birisi bile boş bırakılamaz", "Boş Alanlar", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (yeni != yenit) { MessageBox.Show("Şifre ve tekrarı uyuşmuyor", "Yanlış Şifre Tekrarı", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (eskik != eski) { MessageBox.Show("Eski şifrenizi yanlış girdiniz", "Yanlış Şifre", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { YönetimDb db = new YönetimDb(); foreach (var kullanıcı in db.Kullanıcılar) { if (kullanıcıadı == kullanıcı.KullanıcıAdı) { kullanıcı.Şifre = yeni; break; } } db.SaveChanges(); MessageBox.Show("Şifreniz başarıyla değiştirildi", "İşlem Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } }
private void Form1_Load(object sender, EventArgs e) { YönetimDb db = new YönetimDb(); db.Database.CreateIfNotExists(); label3.Location = new Point(178, 140); if (Properties.Settings.Default.kullanıcıAdı != "" && Properties.Settings.Default.şifre != "") { textBox1.Text = Properties.Settings.Default.kullanıcıAdı; textBox2.Text = Properties.Settings.Default.şifre; } if (Properties.Settings.Default.beniHatırla == true) { checkBox1.Checked = true; } else { checkBox1.Checked = false; } }
private void button4_Click(object sender, EventArgs e) { if (MessageBox.Show(Properties.Settings.Default.kullanıcıAdı + " kullanıcı adındaki hesabınızı silmek istediğinize emin misiniz?", "Emin Misiniz?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { YönetimDb db = new YönetimDb(); foreach (var kullanıcı in db.Kullanıcılar) { if (kullanıcı.KullanıcıAdı == Properties.Settings.Default.kullanıcıAdı) { db.Kullanıcılar.Remove(kullanıcı); Properties.Settings.Default.kullanıcıAdı = null; Properties.Settings.Default.şifre = null; Properties.Settings.Default.beniHatırla = false; Properties.Settings.Default.Save(); break; } } db.SaveChanges(); this.Close(); } }
private void button8_Click(object sender, EventArgs e) { button9.Enabled = false; button10.Enabled = false; long tcNo; bool hata = false; try { tcNo = Convert.ToInt64(textBox4.Text); } catch { MessageBox.Show("Hatalı T.C. Numarası girdisi", "Karakter Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); hata = true; } if (hata == false) { tcNo = Convert.ToInt64(textBox4.Text); YönetimDb db = new YönetimDb(); bool bulundu = false; foreach (var hasta in db.Hastalar) { if (hasta.TCNo == tcNo) { textBox11.Text = hasta.ID.ToString(); textBox12.Text = hasta.Ad; textBox13.Text = hasta.Soyad; textBox14.Text = hasta.Cinsiyet; textBox15.Text = hasta.DoğumTarihi.ToString().Substring(0, 10); textBox16.Text = hasta.TCNo.ToString(); textBox17.Text = hasta.RandevuTarihi.ToString().Substring(0, 10); textBox18.Text = hasta.RandevuSaati; textBox19.Text = hasta.Bölüm; textBox20.Text = hasta.Doktor; textBox21.Text = hasta.Ücret.ToString(); string kalan = (hasta.RandevuTarihi.Date - DateTime.Now.Date).Days.ToString(); if (kalan == "0") { textBox22.Text = "Randevu bugün"; } else if (kalan.StartsWith("-")) { textBox22.Text = "Randevu geçmiş"; } else { textBox22.Text = kalan + " gün kaldı"; } bulundu = true; button9.Enabled = true; button10.Enabled = true; } } if (bulundu == false) { MessageBox.Show("Hasta kayıtlarda bulunamadı", "Hasta Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox11.Text = ""; textBox12.Text = ""; textBox13.Text = ""; textBox14.Text = ""; textBox15.Text = ""; textBox16.Text = ""; textBox17.Text = ""; textBox18.Text = ""; textBox19.Text = ""; textBox20.Text = ""; textBox21.Text = ""; textBox22.Text = ""; } } }
private void button6_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Ad boş bırakılamaz", "Ad Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (textBox2.Text == "") { MessageBox.Show("Soyad boş bırakılamaz", "Soyad Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (comboBox1.Text == "") { MessageBox.Show("Cinsiyet boş bırakılamaz", "Cinsiyet Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (textBox3.Text == "") { MessageBox.Show("T.C. Numarası boş bırakılamaz", "T.C. Numara Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (comboBox8.Text == "" || comboBox9.Text == "") { MessageBox.Show("Randevu Saati boş bırakılamaz", "Randevu Saati Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (comboBox10.Text == "") { MessageBox.Show("Bölüm boş bırakılamaz", "Bölüm Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (comboBox11.Text == "") { MessageBox.Show("Doktor boş bırakılamaz", "Doktor Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (Hasta_Kayıtlımı(Convert.ToInt64(textBox3.Text)) == true) { MessageBox.Show("Hasta zaten kayıtlı", "Kayıtlı Hasta", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (Randevu_Kontrol() == true) { MessageBox.Show("Seçtiğiniz tarih ve bölüm için randevu alınmış", "Randevu Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { bool hatalı = false; if (dateTimePicker2.Value.Date == DateTime.Now.Date) { if (Convert.ToInt32(comboBox8.SelectedItem) <= DateTime.Now.Hour) { if (Convert.ToInt32(comboBox9.SelectedItem) <= DateTime.Now.Minute) { MessageBox.Show("Geçmişten randevu alamazsınız", "Randevu Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); hatalı = true; } } } if (hatalı == false) { // KAYIT KISMI YönetimDb db = new YönetimDb(); Hastalar hasta = new Hastalar(); hasta.Ad = textBox1.Text; hasta.Soyad = textBox2.Text; hasta.Cinsiyet = comboBox1.Text; hasta.TCNo = Convert.ToInt64(textBox3.Text); hasta.DoğumTarihi = dateTimePicker1.Value; hasta.RandevuTarihi = dateTimePicker2.Value; hasta.RandevuSaati = comboBox8.Text + ":" + comboBox9.Text; hasta.Bölüm = comboBox10.Text; hasta.Doktor = comboBox11.Text; hasta.Ücret = ücret; db.Hastalar.Add(hasta); db.SaveChanges(); // MAİL KISMI if (checkBox1.Checked == true) { MailMessage mail = new MailMessage(); mail.From = new MailAddress(Properties.Settings.Default.gönderenMail); mail.To.Add(Properties.Settings.Default.gönderilenMail); mail.Subject = "Hastane Otomasyonu Mert Balasar"; mail.Body = textBox3.Text + " T.C. Numaralı şahıs " + comboBox10.Text + " bölümünden " + dateTimePicker2.Value.ToString().Substring(0, 10) + " " + comboBox8.Text + ":" + comboBox9.Text + " tarihinde randevu almıştır."; SmtpClient istemci = new SmtpClient(); istemci.Credentials = new System.Net.NetworkCredential(Properties.Settings.Default.gönderenMail, Properties.Settings.Default.gönderenŞifre); istemci.Port = 587; istemci.Host = "smtp.gmail.com"; istemci.EnableSsl = true; try { istemci.SendAsync(mail, (object)mail); } catch { MessageBox.Show("Mail gönderme başarısız", "Mail Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); } } MessageBox.Show("Randevu Başarıyla Alındı", "Randevu Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } } } } } } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("Kullanıcı adı boş bırakılamaz", "Kullanıcı Adı Boş", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (textBox2.Text == "") { MessageBox.Show("Şifre boş bırakılamaz", "Şifre Boş", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (textBox3.Text == "") { MessageBox.Show("Şifre tekrar alanı boş bırakılamaz", "Şifre Tekrarı Boş", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (textBox4.Text == "") { MessageBox.Show("Onay kodu boş bırakılamaz", "Onay Kodu Boş", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (textBox2.Text != textBox3.Text) { MessageBox.Show("Şifre tekrarı eşleşmedi", "Şifreler Eşleşmiyor", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (Onay_Kodu_Kontrol(textBox4.Text) == false) { MessageBox.Show("Onay kodunuz yanlış", "Onay Kodu Hatalı", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // KULLANICI ADININ VAR OLUP OLMADIĞINI KONTROL ETTİR YönetimDb db = new YönetimDb(); bool varmı = false; foreach (var eleman in db.Kullanıcılar) { if (eleman.KullanıcıAdı == textBox1.Text) { MessageBox.Show("Kullanıcı adı kullanımda", "Kullanıcı Adı Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); varmı = true; break; } } if (varmı == false) { Kullanıcılar kullanıcı = new Kullanıcılar(); kullanıcı.KullanıcıAdı = textBox1.Text; kullanıcı.Şifre = textBox2.Text; db.Kullanıcılar.Add(kullanıcı); db.SaveChanges(); MessageBox.Show("Kayıt başarıyla tamamlandı", "Kayıt Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } /*bağlantı = new SqlConnection("Data Source=.\\SQLEXPRESS; Initial Catalog=" + veriTabanıİsmi + "; Integrated Security=True"); * bağlantı.Open(); * adaptör = new SqlDataAdapter("SELECT kullanıcıadı FROM kullanıcılar", bağlantı); * tablo = new DataTable(); * adaptör.Fill(tablo); * bool varmı = false; * for (int i = 0; i < tablo.Rows.Count; i++) * { * if (tablo.Rows[i]["kullanıcıadı"].ToString() == textBox1.Text) * { * MessageBox.Show("Kullanıcı adı kullanımda", "Kullanıcı Adı Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error); * varmı = true; * break; * } * } * bağlantı.Close(); * if (varmı == false) * { * bağlantı = new SqlConnection("Data Source=.\\SQLEXPRESS; Initial Catalog=" + veriTabanıİsmi + "; Integrated Security=True"); * bağlantı.Open(); * komut = new SqlCommand(); * komut.Connection = bağlantı; * komut.CommandText = "INSERT INTO kullanıcılar (kullanıcıadı, şifre) VALUES ('" + textBox1.Text + "','" + textBox2.Text + "')"; * komut.ExecuteNonQuery(); * bağlantı.Close(); * MessageBox.Show("Kayıt başarıyla tamamlandı", "Kayıt Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); * this.Close();*/ } } } } } } }