-
Notifications
You must be signed in to change notification settings - Fork 0
/
arac_kiralama.cs
184 lines (145 loc) · 7.27 KB
/
arac_kiralama.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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.Data.OleDb;
using System.Windows.Forms;
namespace projetasarım
{
public partial class arac_kiralama : Form
{
public arac_kiralama()
{
InitializeComponent();
}
OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OleDb.12.0;Data Source=" + Application.StartupPath + "\\musteri.accdb");
OleDbConnection baglanti2 = new OleDbConnection("Provider=Microsoft.ACE.OleDb.12.0;Data Source=" + Application.StartupPath + "\\kiralanan_araclar.accdb");
private void bunifuCards1_Paint(object sender, PaintEventArgs e)
{
kiralanan_araclari_listele();
}
private void bunifuThinButton21_Click(object sender, EventArgs e)
{
bool kayit_arama_durumu = false;
if (bunifuMaterialTextbox1.Text != "")
{
baglanti.Open();
OleDbCommand selectsorgu = new OleDbCommand("select * from musteriler where Tcno='" + bunifuMaterialTextbox1.Text + "'", baglanti);
OleDbDataReader kayitokuma = selectsorgu.ExecuteReader();
while (kayitokuma.Read())
{
kayit_arama_durumu = true;
bunifuMaterialTextbox2.Text = kayitokuma.GetValue(1).ToString();
bunifuMaterialTextbox3.Text = kayitokuma.GetValue(2).ToString();
bunifuMaterialTextbox4.Text = kayitokuma.GetValue(3).ToString();
bunifuMaterialTextbox5.Text = kayitokuma.GetValue(4).ToString();
break;
}
if (bunifuMaterialTextbox1.Text.Length == 11)
{
if (kayit_arama_durumu == false)
MessageBox.Show("Aranan kayıt bulunamadı!", "ARAÇ TAKİP SİSTEMİ", MessageBoxButtons.OK, MessageBoxIcon.Error);
baglanti.Close();
}
else MessageBox.Show("Lütfen 11 haneli tc kimlik no giriniz!", "ARAÇ TAKİP SİSTEMİ", MessageBoxButtons.OK, MessageBoxIcon.Error);
baglanti.Close();
}
}
private void bunifuThinButton22_Click(object sender, EventArgs e)
{
bool kayit_arama_durumu = false;
if (bunifuMaterialTextbox6.Text != "")
{
baglanti.Open();
OleDbCommand selectsorgu = new OleDbCommand("select * from araclar where plaka='" + bunifuMaterialTextbox6.Text + "'", baglanti);
OleDbDataReader kayitokuma = selectsorgu.ExecuteReader();
while (kayitokuma.Read())
{
kayit_arama_durumu = true;
bunifuMaterialTextbox7.Text = kayitokuma.GetValue(1).ToString();
bunifuMaterialTextbox8.Text = kayitokuma.GetValue(2).ToString();
bunifuMaterialTextbox9.Text = kayitokuma.GetValue(3).ToString();
bunifuMaterialTextbox10.Text = kayitokuma.GetValue(4).ToString();
bunifuMaterialTextbox11.Text = kayitokuma.GetValue(6).ToString();
break;
}
}
else MessageBox.Show("Lütfen araç plakasını giriniz!", "ARAÇ TAKİP SİSTEMİ", MessageBoxButtons.OK, MessageBoxIcon.Error);
baglanti.Close();
if (kayit_arama_durumu == false)
MessageBox.Show("Aranan kayıt bulunamadı!", "ARAÇ TAKİP SİSTEMİ", MessageBoxButtons.OK, MessageBoxIcon.Error);
baglanti.Close();
}
private void kiralanan_araclari_listele()
{
try
{
baglanti2.Open();
OleDbDataAdapter listele = new OleDbDataAdapter("select tcno AS[TC KİMLİK NO],ad AS[AD],soyad AS[SOYAD],email AS[E-MAİL]," +
"telefon AS [TELEFON],plaka AS[PLAKA],marka AS[MARKA],seri AS[SERİ],model AS [MODEL],renk AS[RENK],kira AS[KİRA ÜCRETİ]" +
",kirabaslangic AS [KİRA BAŞLANGIÇ TARİHİ],kirabitis AS [KİRA BİTİŞ TARİHİ],toplamtutar AS[TOPLAM ÖDENECEK TUTAR],durumu AS [ARAÇ DURUMU] from kiralik_araclar where durumu='" + "kiralik" + "'", baglanti2);
DataSet dshafiza = new DataSet();
listele.Fill(dshafiza);
dataGridView1.DataSource = dshafiza.Tables[0];
baglanti2.Close();
dataGridView1.Columns[0].Width = 150;
dataGridView1.Columns[1].Width = 150;
dataGridView1.Columns[2].Width = 150;
dataGridView1.Columns[3].Width = 150;
dataGridView1.Columns[4].Width = 150;
dataGridView1.Columns[5].Width = 150;
dataGridView1.Columns[6].Width = 150;
dataGridView1.Columns[7].Width = 150;
dataGridView1.Columns[8].Width = 150;
dataGridView1.Columns[9].Width = 150;
dataGridView1.Columns[10].Width = 150;
dataGridView1.Columns[11].Width = 150;
dataGridView1.Columns[12].Width = 150;
dataGridView1.Columns[13].Width = 150;
dataGridView1.Columns[14].Width = 150;
}
catch (Exception hatamesaj)
{
MessageBox.Show(hatamesaj.Message);
baglanti2.Close();
}
}
private void bunifuMaterialTextbox11_OnValueChanged(object sender, EventArgs e)
{
}
private void bunifuMaterialTextbox12_OnValueChanged(object sender, EventArgs e)
{
}
private void groupBox2_Enter(object sender, EventArgs e)
{
}
private void bunifuThinButton23_Click(object sender, EventArgs e)
{
TimeSpan gun = DateTime.Parse(dateTimePicker2.Text) - DateTime.Parse(dateTimePicker1.Text);
int gun2 = gun.Days;
bunifuMaterialTextbox12.Text = (gun2 * int.Parse(bunifuMaterialTextbox11.Text)).ToString();
}
private void bunifuThinButton24_Click(object sender, EventArgs e)
{
try
{
baglanti2.Open();
OleDbCommand ekle_komutu = new OleDbCommand("insert into kiralik_araclar values('" + bunifuMaterialTextbox1.Text + "','" + bunifuMaterialTextbox2.Text + "','" + bunifuMaterialTextbox3.Text + "','" + bunifuMaterialTextbox4.Text + "','" + bunifuMaterialTextbox5.Text + "'" +
",'" + bunifuMaterialTextbox6.Text + "','" + bunifuMaterialTextbox7.Text + "','" + bunifuMaterialTextbox8.Text + "','" + bunifuMaterialTextbox9.Text + "','" + bunifuMaterialTextbox10.Text + "'" +
",'" + bunifuMaterialTextbox11.Text + "','" + dateTimePicker1.Text + "','" + dateTimePicker2.Text + "','" + bunifuMaterialTextbox12.Text + "','" + "kiralik" + "')", baglanti2);
ekle_komutu.ExecuteReader();
baglanti2.Close();
kiralanan_araclari_listele();
}
catch (Exception hatamesaji)
{
MessageBox.Show(hatamesaji.Message);
baglanti2.Close();
}
}
}
}