-
Notifications
You must be signed in to change notification settings - Fork 0
/
arac_kayit.cs
133 lines (105 loc) · 5.1 KB
/
arac_kayit.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
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;
namespace projetasarım
{
public partial class arac_kayit : Form
{
public arac_kayit()
{
InitializeComponent();
}
OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OleDb.12.0;Data Source=" + Application.StartupPath + "\\musteri.accdb");
public string durum;
private void bunifuCards1_Paint(object sender, PaintEventArgs e)
{
}
private void bunifuThinButton23_Click(object sender, EventArgs e)
{
bool kayitkontrol = false;
baglanti.Open();
OleDbCommand selectsorgu = new OleDbCommand("select * from araclar where plaka='" + bunifuMetroTextbox1.Text + "'", baglanti);
OleDbDataReader kayitokuma = selectsorgu.ExecuteReader();
while (kayitokuma.Read())
{
kayitkontrol = true;
break;
}
baglanti.Close();
if (kayitkontrol == false)
{
if (bunifuMetroTextbox1.Text == "")
bunifuCustomLabel1.ForeColor = Color.Red;
else bunifuCustomLabel1.ForeColor = Color.Black;
if (bunifuMetroTextbox2.Text == "")
bunifuCustomLabel5.ForeColor = Color.Red;
else bunifuCustomLabel5.ForeColor = Color.Black;
if (bunifuMetroTextbox3.Text == "")
bunifuCustomLabel3.ForeColor = Color.Red;
else bunifuCustomLabel3.ForeColor = Color.Black;
if (bunifuMetroTextbox4.Text == "")
bunifuCustomLabel4.ForeColor = Color.Red;
else bunifuCustomLabel4.ForeColor = Color.Black;
if (bunifuMetroTextbox5.Text == "")
bunifuCustomLabel8.ForeColor = Color.Red;
else bunifuCustomLabel8.ForeColor = Color.Black;
if (bunifuMetroTextbox6.Text == "")
bunifuCustomLabel7.ForeColor = Color.Red;
else bunifuCustomLabel7.ForeColor = Color.Black;
if (bunifuMetroTextbox7.Text == "")
bunifuCustomLabel6.ForeColor = Color.Red;
else bunifuCustomLabel6.ForeColor = Color.Black;
if (pictureBox1.Image == null)
bunifuTileButton3.ForeColor = Color.Red;
else
bunifuTileButton3.ForeColor = Color.Black;
if (bunifuMetroTextbox1.Text != "" && bunifuMetroTextbox1.Text != "" && bunifuMetroTextbox2.Text != "" && bunifuMetroTextbox3.Text != "" && bunifuMetroTextbox4.Text
!= "" && bunifuMetroTextbox5.Text != "" && bunifuMetroTextbox6.Text != "" && pictureBox1.Image != null)
{
try
{
baglanti.Open();
durum = "kiralık";
OleDbCommand eklekomutu = new OleDbCommand("insert into araclar values ('" + bunifuMetroTextbox1.Text + "','" + bunifuMetroTextbox2.Text + "','" + bunifuMetroTextbox3.Text + "','" + bunifuMetroTextbox4.Text + "'," +
"'" + bunifuMetroTextbox5.Text + "','" + bunifuMetroTextbox6.Text + "','" + bunifuMetroTextbox7.Text + "','" + "kiralık" + "')", baglanti);
eklekomutu.ExecuteReader();
baglanti.Close();
pictureBox1.Image.Save(Application.StartupPath + "\\arac.resimler\\" + bunifuMetroTextbox1.Text + ".jpg");
MessageBox.Show("Yeni araç kaydı tamamlandı!", "ARAÇ TAKİP SİSTEMİ");
bunifuMetroTextbox1.Text = ""; bunifuMetroTextbox2.Text = ""; bunifuMetroTextbox3.Text = ""; bunifuMetroTextbox4.Text = ""; bunifuMetroTextbox5.Text = "";
bunifuMetroTextbox6.Text = ""; bunifuMetroTextbox7.Text = "";
pictureBox1.Image = null;
}
catch (Exception hatamesaji)
{
MessageBox.Show(hatamesaji.Message);
baglanti.Close();
}
}
else MessageBox.Show("Yazı rengi kırmızı olan alanları yeniden gözden geçiriniz: ");
}
else MessageBox.Show("Girilen plaka daha önceden kayıt edilmiştir.");
}
private void bunifuTileButton3_Click(object sender, EventArgs e)
{
OpenFileDialog resimsec = new OpenFileDialog();
resimsec.Title = "Resminizi seçiniz";
resimsec.Filter = "JPG dosyalar(*jpg) | *.jpg";
if (resimsec.ShowDialog() == DialogResult.OK)
{
this.pictureBox1.Image = new Bitmap(resimsec.OpenFile());
}
}
private void bunifuThinButton21_Click(object sender, EventArgs e)
{
this.Close();
}
}
}