private void btnKaydet_Click(object sender, EventArgs e) { // Kira Kaydetme İşlemi Yapılacak if (RezerveKiraDurum == 0) { //normal kira işlemi çalışacak int ARABA_ID, MUSTERI_ID; DateTime ALIS_TARIHI, TESLIM_TARIHI; ARABA_ID = int.Parse(dataArac.Rows[dataArac.CurrentRow.Index].Cells[0].Value.ToString()); MUSTERI_ID = int.Parse(dataMusteri.Rows[dataMusteri.CurrentRow.Index].Cells[0].Value.ToString()); ALIS_TARIHI = Convert.ToDateTime(dateTimeAlıs.Text); TESLIM_TARIHI = Convert.ToDateTime(dateTimeTeslim.Text); VeriTabani vt = new VeriTabani(); vt.KiraEmriEkle(CALISAN_ID, ARABA_ID, MUSTERI_ID, ALIS_TARIHI, TESLIM_TARIHI, int.Parse(txtToplamGun.Text), false, int.Parse(TextKiloMetre.Text), 0, 0, int.Parse(textToplamTutar.Text), false); vt.AracDurumGuncelle(ARABA_ID, "KIRADA"); MessageBox.Show("Kiralama Emriniz Başarıyla Oluşturulmuştur...", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { // rezerve emir işlemi çalışacak int ARABA_ID, MUSTERI_ID; DateTime ALIS_TARIHI, TESLIM_TARIHI; ARABA_ID = int.Parse(dataArac.Rows[dataArac.CurrentRow.Index].Cells[0].Value.ToString()); MUSTERI_ID = int.Parse(dataMusteri.Rows[dataMusteri.CurrentRow.Index].Cells[0].Value.ToString()); ALIS_TARIHI = Convert.ToDateTime(dateTimeAlıs.Text); TESLIM_TARIHI = Convert.ToDateTime(dateTimeTeslim.Text); VeriTabani vt = new VeriTabani(); vt.RezerveEkle(CALISAN_ID, ARABA_ID, MUSTERI_ID, ALIS_TARIHI, TESLIM_TARIHI, false); vt.AracDurumGuncelle(ARABA_ID, "REZERVE"); MessageBox.Show("Araç Rezerve İşleminiz Başarıyla Oluşturulmuştur...", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
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); } }