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 btnKaydet_Click(object sender, EventArgs e) { if (textKmEnd.Text == "") { MessageBox.Show("Aracın Teslim Kilometresini Giriniz !", "UYARI", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { TimeSpan b = Convert.ToDateTime(dateTimeTeslimTar.Text) - Convert.ToDateTime(textAlisTar.Text); TOPLAM_GUN = Convert.ToInt32(Math.Abs(b.TotalDays)); //Araç Telim İşlemi Yapılacak !! VeriTabani vt = new VeriTabani(); vt.KiraDurumGuncelle(KIRA_ID, true, Convert.ToDateTime(dateTimeTeslimTar.Text), TOPLAM_GUN, int.Parse(textKmEnd.Text), int.Parse(textKmFark.Text), int.Parse(textTopTutar.Text));//bazı alanlar daha güncellenecek ! vt.AracDurumGuncelle(ARABA_ID, "BOŞTA"); vt.AracKmGuncelle(ARABA_ID, Convert.ToInt32(textKmEnd.Text)); int ODENME_DURUM = vt.KiraOdenmeDurumCek(KIRA_ID); if (ODENME_DURUM == 0) { MessageBox.Show("Sistemde Kira Ödemesi Gözükmemektedir. \nSizi Ödeme Sayfasına Yönlendiriyorz.", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); OdemeYap form = new OdemeYap(); form.KIRA_ID = KIRA_ID; form.CALISAN_ID = CALISAN_ID; form.Show(); this.Close(); } else { MessageBox.Show("Araç Tesliminiz Başarıyla Gerçekleşmiştir.", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
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); } }
private void button1_Click(object sender, EventArgs e) { VeriTabani vt = new VeriTabani(); int ARABA_ID, REZERVE_ID; 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()); vt.RezerveSil(REZERVE_ID); vt.AracDurumGuncelle(ARABA_ID, "BOŞTA"); MessageBox.Show("Kayıt Silme İşleminiz Onaylanmıştır !!", "BİLGİ", MessageBoxButtons.OK, MessageBoxIcon.Information); string sorgu = "select A.ARABA_ID,R.REZERVE_ID,M.MUSTERI_ID,M.TC_NO,M.ADI,M.SOYADI,R.ALIS_TAR,R.TESLIM_TAR from MUSTERI M,REZERVE R,ARABALAR A where M.MUSTERI_ID=r.MUSTERI_ID and A.ARABA_ID=R.ARABA_ID and R.REZERVE_DURUM=0"; vt.baglan(sorgu, dataRezList, "REZERVE"); dataRezList.Columns[0].Visible = false; dataRezList.Columns[1].Visible = false; dataRezList.Columns[2].Visible = false; }