public string Guncelle(int Dokbilgid, DoktorBilgileri tablo) { try { if (!string.IsNullOrWhiteSpace(tablo.DoktorID.ToString()) && !string.IsNullOrWhiteSpace(tablo.GirisTarihi.ToString())) { DoktorBilgileri Guncelle = rep_dokbilg.Bul(k => k.DoktorBilgileriID == Dokbilgid); DialogResult onayguncelle = MessageBox.Show("Güncellemek istediğiniziden Emin misiniz?", "Güncelleme Penceresi", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (onayguncelle == DialogResult.Yes) { if (Guncelle != null) { Guncelle.DoktorID = tablo.DoktorID; Guncelle.GirisTarihi = tablo.GirisTarihi; Guncelle.CikisTarihi = tablo.CikisTarihi; Guncelle.AktifMi = tablo.AktifMi; } if (rep_dokbilg.Guncelle(tablo) > 0) { return("Guncelleme Başarılı"); } return("Guncelleme Başarısız"); } return("İşlem İptal Edildi"); } return("Lütfen doktor,giris tarihi ve çıkış tarihi giriniz"); } catch (Exception) { return("Hata Vardır Yetkiliye Bildirin"); } }
//DoktorID'si ne göre görüntüleyen fonksiyon public DoktorBilgileri GetByIdDoktorBilgileri(int DoktorID) { cmd = new SqlCommand("select * from DoktorBilgileri where DoktorID=@DoktorId", cnn); cmd.Parameters.AddWithValue("@DoktorId", DoktorID); DoktorBilgileri db = null; try { cnn.Open(); SqlDataReader reader = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); reader.Read(); db = new DoktorBilgileri() { DoktorID = Convert.ToInt32(reader["DoktorID"]), Ad = reader["Ad"].ToString(), Soyad = reader["Soyad"].ToString(), BolumID = Convert.ToInt32(reader["BolumID"]), Cinsiyet = bool.Parse(reader["Cinsiyet"].ToString()), Email = reader["Email"].ToString(), Parola = reader["Parola"].ToString(), Telefon = reader["Telefon"].ToString() }; reader.Close(); return(db); } catch (Exception) { return(db); } }
private void simpleButton_Guncel_Click(object sender, EventArgs e) { DoktorBilgileri nesnetablo = new DoktorBilgileri(); nesnetablo.DoktorID = (int)comboBox_Doktor.SelectedValue; nesnetablo.GirisTarihi = dateTimePicker_girtar.Value; nesnetablo.CikisTarihi = dateTimePicker_ciktar.Value; nesnetablo.AktifMi = Convert.ToBoolean(dokbilg_man.aktifmiE(comboBox_aktif.Text)); FrmDoktorlar frm_dok = (FrmDoktorlar)Application.OpenForms["FrmDoktorlar"]; string GuncelleSonuc = dokbilg_man.Guncelle(frm_dok.Dok_BilgID, nesnetablo); frm_dok.gridControl_DokBilg.DataSource = dokbilg_man.Listele(); MessageBox.Show(GuncelleSonuc.ToString()); Close(); }
public string Sil(int Dokbilgid) { try { DoktorBilgileri doktorsil = rep_dokbilg.Bul(k => k.DoktorBilgileriID == Dokbilgid); DialogResult silmesaj = MessageBox.Show("Silmek İstediğinizden Emin misiniz?", "Silme Penceresi", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (silmesaj == DialogResult.Yes) { if (rep_dokbilg.Sil(doktorsil) > 0) { return("Silme Başarılı"); } return("Silme Başarısız"); } return("İşlem İptal Edildi"); } catch (Exception) { return("Hata Vardır Yetkiliye Bildirin"); } }