private void btnOnay_Click(object sender, EventArgs e) { try { VeriTabani vt = new VeriTabani(); DateTime ALIS_TAR, TESLIM_TAR; int ARABA_ID, MUSTERI_ID, TOPLAM_GUN, KM_START, REZERVE_ID, TOPLAM_TUTAR; ARABA_ID = int.Parse(dataRezList.Rows[dataRezList.CurrentRow.Index].Cells[0].Value.ToString()); REZERVE_ID = int.Parse(dataRezList.Rows[dataRezList.CurrentRow.Index].Cells[1].Value.ToString()); MUSTERI_ID = int.Parse(dataRezList.Rows[dataRezList.CurrentRow.Index].Cells[2].Value.ToString()); ALIS_TAR = DateTime.Parse(dataRezList.Rows[dataRezList.CurrentRow.Index].Cells[6].Value.ToString()); TESLIM_TAR = DateTime.Parse(dataRezList.Rows[dataRezList.CurrentRow.Index].Cells[7].Value.ToString()); TimeSpan fark = TESLIM_TAR - ALIS_TAR; TOPLAM_GUN = Convert.ToInt32(fark.TotalDays.ToString()); KM_START = vt.AracKMCek(ARABA_ID); TOPLAM_TUTAR = vt.AracUcretCek(ARABA_ID) * TOPLAM_GUN; vt.KiraEmriEkle(CALISAN_ID, ARABA_ID, MUSTERI_ID, ALIS_TAR, TESLIM_TAR, TOPLAM_GUN, false, KM_START, 0, 0, TOPLAM_TUTAR, false); vt.AracDurumGuncelle(ARABA_ID, "KIRADA"); vt.RezerveDurum(REZERVE_ID, true); MessageBox.Show("İşleminiz Onaylanmıştır !!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception) { MessageBox.Show("Listeden Kayıt Seçiniz !!", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }