public bool RandevuKaydet(Randevular r) { bool Sonuc = false; SqlCommand comm = new SqlCommand("Insert into Randevular(tarih,saat,personelID,hastaID) values(@tarih,@saat,@personelID,@hastaID)", conn); comm.Parameters.Add("@hastaID", SqlDbType.Int).Value = r._hastaID; comm.Parameters.Add("@personelID", SqlDbType.Int).Value = r._personelID; comm.Parameters.Add("@saat", SqlDbType.VarChar).Value = r._saat; comm.Parameters.Add("@tarih", SqlDbType.DateTime).Value = r._tarih; if (conn.State == ConnectionState.Closed) { conn.Open(); } try { Sonuc = Convert.ToBoolean(comm.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(Sonuc); }
public bool RandevuAyniGunMu(Randevular r) { bool Sonuc = false; SqlCommand comm = new SqlCommand("Select * from Randevular where hastaID=@hastaID and personelID=@personelID and tarih=@tarih", conn); comm.Parameters.Add("@hastaID", SqlDbType.Int).Value = r._hastaID; comm.Parameters.Add("@personelID", SqlDbType.Int).Value = r._personelID; comm.Parameters.Add("@tarih", SqlDbType.DateTime).Value = r._tarih; if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlDataReader dr; try { dr = comm.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { Sonuc = true; } } } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(Sonuc); }