private void BtnGit_Click(object sender, EventArgs e) { try { BtnTaburcu.Enabled = true; btnSecSil.Enabled = true; int z = 0; lblFiyat.Text = ""; Hasta hastaBilgisi = Veritabani.TaburcuKontrol(txtOncekiIslem.Text, txtDosyaNo.Text); dataGridView1.DataSource = Veritabani.IslemAra("tblSevk", txtOncekiIslem.Text, txtDosyaNo.Text).Tables[0]; if (dataGridView1.Rows.Count > 0) { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { DataGridViewCellStyle renk = new DataGridViewCellStyle(); if (Convert.ToBoolean(dataGridView1.Rows[i].Cells["taburcu"].Value) == true) { renk.BackColor = Color.White; renk.ForeColor = Color.Black; } else { z++; renk.BackColor = Color.Red; renk.ForeColor = Color.Black; } dataGridView1.Rows[i].DefaultCellStyle = renk; } } if (z == 0) { MessageBox.Show("Hasta bu sevkten taburcu edilmiş.", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Information); BtnTaburcu.Enabled = false; } else { BtnTaburcu.Enabled = true; lblFiyat.Text = Veritabani.FiyatHesapla(txtDosyaNo.Text, txtOncekiIslem.Text).ToString(); } } catch (Exception a) { MessageBox.Show("Bir hata oluştu:" + a.Message, "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }