NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Collections;

namespace _666
{
public partial class arac_kirala : Form
{
public arac_kirala()
{
InitializeComponent();
}

OleDbConnection baglan = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:kiralama.accdb");
OleDbCommand komut;
OleDbDataReader oku;
string sorgu;
ArrayList dolu_arac_id = new ArrayList();
int gün,günlük_ücret;

private void arac_kirala_Load(object sender, EventArgs e)
{
sorgu = "select distinct arac_vites from araclar";
baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
oku = komut.ExecuteReader();
while (oku.Read())
{
comboBox1.Items.Add("arac_vites");
}

sorgu = "select distinct yakit_turu from yakitlar";
baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
oku = komut.ExecuteReader();
while (oku.Read())
{
comboBox2.Items.Add("yakit_turu");
}

sorgu = "select distinct arac_marka from markalar";
baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
oku = komut.ExecuteReader();
while (oku.Read())
{
comboBox3.Items.Add("arac_marka");
}

sorgu = "select distinct arac_renk from araclar";
baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
oku = komut.ExecuteReader();
while (oku.Read())
{
comboBox4.Items.Add("arac_renk");
}
}

private void textBox3_TextChanged(object sender, EventArgs e)
{
dataGridView2.Rows.Clear();
sorgu = "select * from musteriler inner join iller on musteriler.musteri_ili=iller.il_id where musteri_telefon like '"+textBox3.Text+"%'";
baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
oku = komut.ExecuteReader();
while (oku.Read())
{
dataGridView2.Rows.Add(oku["musteri_id"], oku["musteri_tc_kimlik"], oku["musteri_ad"], oku["musteri_soyad"], oku["musteri_cinsiyet"], oku["musteri_telefon"], oku["il_adi"]);
}
baglan.Close();

}

private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
{
label1.Text= dataGridView2.SelectedCells[2].Value.ToString();


label3.Text= dataGridView2.SelectedCells[3].Value.ToString();
textBox3.Enabled = false;
dataGridView2.Enabled = false;
}

private void button1_Click(object sender, EventArgs e)
{
DateTime t1 = dateTimePicker1.Value;
DateTime t2 = dateTimePicker2.Value;
if (t2<=t1)
{
MessageBox.Show("Yanlış tarih aralığı seçtiniz. Lütfen doğru tarihler seçiniz.");
return; // yanlış tarih seçtiyse olayı bitir.
}

TimeSpan fark = t2 - t1;
gün = fark.Days + 1;
label16.Text = gün.ToString();

dataGridView1.Rows.Clear();


dolu_arac_id.Clear();

string tarih_basla = dateTimePicker1.Value.Month.ToString() + "/" + dateTimePicker1.Value.Day.ToString() + "/" + dateTimePicker1.Value.Year.ToString();
string tarih_bitis = dateTimePicker2.Value.Month.ToString() + "/" + dateTimePicker2.Value.Day.ToString() + "/" + dateTimePicker2.Value.Year.ToString();



sorgu = "select distinct arac_id from kiralama where not (#" + tarih_bitis + "# <= kira_baslama or #" + tarih_basla + "# >= kira_bitis)";
baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
oku = komut.ExecuteReader();
while (oku.Read())
{
dolu_arac_id.Add(oku["arac_id"].ToString());
}
baglan.Close();

string filtre;
filtre = "where arac_id<>0";

if (comboBox1.SelectedIndex != -1) filtre = filtre + " and arac_vites = '" + comboBox1.Text + "' ";
if (comboBox2.SelectedIndex != -1) filtre = filtre + " and yakit_turu = '" + comboBox2.Text + "' ";
if (comboBox3.SelectedIndex != -1) filtre = filtre + " and arac_marka = '" + comboBox3.Text + "' ";
if (comboBox4.SelectedIndex != -1) filtre = filtre + " and arac_renk = '" + comboBox4.Text + "' ";
if (textBox1.Text != "") filtre = filtre + " and arac_kira_ucreti >= " + textBox1.Text + " ";
if (textBox2.Text != "") filtre = filtre + " and arac_kira_ucreti <= " + textBox2.Text + " ";
sorgu = "select * from ((araclar inner join markalar on araclar.marka_id = markalar.marka_id) inner join yakitlar on araclar.arac_yakit=yakitlar.yakit_id) " + filtre + " order by arac_id";




bool yaz;
baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
oku = komut.ExecuteReader();
while (oku.Read())
{
yaz = true;
foreach (var id in dolu_arac_id)
{
if (oku["arac_id"].ToString() == id.ToString())
{
yaz = false;
}
}
if (yaz == true) dataGridView1.Rows.Add(oku["arac_id"], oku["arac_plaka"], oku["arac_marka"], oku["arac_vites"], oku["yakit_turu"], oku["arac_renk"], oku["arac_kira_ucreti"]);
}
baglan.Close();

// ****** yazılan sorguya göre araçlar datagride getirildi. ******

}

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
günlük_ücret = int.Parse(dataGridView1.SelectedCells[6].Value.ToString());
label17.Text = (günlük_ücret * gün).ToString();
dataGridView1.Enabled = false;
comboBox1.Enabled = false;
comboBox2.Enabled = false;
comboBox3.Enabled = false;
comboBox4.Enabled = false;
textBox1.Enabled = false;
textBox2.Enabled = false;
dateTimePicker1.Enabled = false;
dateTimePicker2.Enabled = false;
button1.Enabled = false;
}

private void button2_Click(object sender, EventArgs e)
{
if (label1.Text=="" || label17.Text=="")
{
MessageBox.Show("Müşteri veya araç seçimi yapınız.");
}
else
{
DialogResult cevap = MessageBox.Show("Ücret ödendi mi?", "Kiralama", MessageBoxButtons.YesNo);
if (cevap==DialogResult.Yes)
{
sorgu = "insert into kiralama(musteri_id,arac_id,kira_baslama,kira_bitis,kira_ucreti) values (" + dataGridView2.SelectedCells[0].Value.ToString() + "," + dataGridView1.SelectedCells[0].Value.ToString() + ",'" + dateTimePicker1.Value.Date.ToString() +"','" + dateTimePicker2.Value.Date.ToString() + "'," + label17.Text + ")";

baglan.Open();
komut = new OleDbCommand(sorgu, baglan);
komut.ExecuteNonQuery();
baglan.Close();
MessageBox.Show("Araç kiralandı. Allah kaza bela vermesin. Hayırlı olsun.");
button2.Enabled = false;

}
else
{
MessageBox.Show("Ücretinizi ödeyiniz.");
}
}
}
}
}



     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.