-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyeni_uye.java
399 lines (355 loc) · 14.4 KB
/
yeni_uye.java
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Scanner;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.filechooser.FileSystemView;
public class yeni_uye extends javax.swing.JFrame {
JLayeredPane layeredPane;
JTextField uye_no;
JTextField yeni_ad;
JTextField yeni_soyad;
JTextField yeni_cinsiyet;
JTextField yeni_bolum;
JTextField yeni_calısma;
JTextField yeni_mail;
JTextField yeni_tel;
JTextField yeni_adres;
JTextField yeni_il;
JTextField yeni_mezun_day;
JTextField yeni_uye_day;
JTextField yeni_durum;
JTextField txtTc;
JTextField yeni_mezun_month;
JTextField yeni_mezun_year;
JTextField yeni_uye_month;
JTextField yeni_uye_year;
int posX;
int posY;
Date date = new Date();
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
int year = localDate.getYear();
int month=localDate.getMonthValue();
int day=localDate.getDayOfMonth();
public yeni_uye(ArrayList<person> list) {
//move window
this.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
posX=e.getX();
posY=e.getY();
}
});
this.addMouseMotionListener(new MouseAdapter()
{
public void mouseDragged(MouseEvent evt)
{
setLocation (evt.getXOnScreen()-posX,evt.getYOnScreen()-posY);
}
});
//move window
int[] aidat_arr=new int[year-2010+1];
Arrays.fill(aidat_arr, 0);
int[] borc_arr=new int[year-2010+1];
Arrays.fill(borc_arr, 0);
borc_arr[borc_arr.length-1]=Integer.valueOf(AidatRead());
JPanel panel = new JPanel();
panel.setBackground(new java.awt.Color(211, 211, 211));
getContentPane().add(panel, BorderLayout.CENTER);
panel.setLayout(null);
JLabel uyeBilgileri_lbl = new JLabel("\u00DCye Bilgileri");
uyeBilgileri_lbl.setBounds(214, 15, 120, 30);
uyeBilgileri_lbl.setForeground(new java.awt.Color(139, 0, 0));
uyeBilgileri_lbl.setFont(new Font("Calibri", Font.BOLD, 24));
panel.add(uyeBilgileri_lbl);
JPanel panel_in = new JPanel();
panel_in.setBorder(new LineBorder(java.awt.Color.DARK_GRAY, 1, true));
panel_in.setBackground(new java.awt.Color(211, 211, 211));
panel_in.setBounds(25, 56, 519, 486);
panel.add(panel_in);
panel_in.setLayout(null);
JLabel uyeNo_lbl = new JLabel("\u00DCye No:");
uyeNo_lbl.setForeground(new java.awt.Color(128, 0, 0));
uyeNo_lbl.setBounds(10, 7, 56, 17);
uyeNo_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(uyeNo_lbl);
JLabel kimlikNo_lbl = new JLabel("T.C. Kimlik No:");
kimlikNo_lbl.setForeground(new Color(128, 0, 0));
kimlikNo_lbl.setBounds(249, 7, 112, 17);
kimlikNo_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(kimlikNo_lbl);
JLabel ad_lbl = new JLabel("Adı:");
ad_lbl.setForeground(new java.awt.Color(128, 0, 0));
ad_lbl.setBounds(10, 37, 99, 17);
ad_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(ad_lbl);
JLabel cinsiyet_lbl = new JLabel("Cinsiyet:");
cinsiyet_lbl.setForeground(new java.awt.Color(128, 0, 0));
cinsiyet_lbl.setBounds(10, 95, 65, 17);
cinsiyet_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(cinsiyet_lbl);
JLabel bolum_lbl = new JLabel("B\u00F6l\u00FCm\u00FC:");
bolum_lbl.setForeground(new java.awt.Color(128, 0, 0));
bolum_lbl.setBounds(10, 125, 89, 17);
bolum_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(bolum_lbl);
JLabel calismayer_lbl = new JLabel("\u00C7al\u015Ft\u0131\u011F\u0131 Yer:");
calismayer_lbl.setForeground(new java.awt.Color(128, 0, 0));
calismayer_lbl.setBounds(10, 155, 99, 17);
calismayer_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(calismayer_lbl);
JLabel mail_lbl = new JLabel("Mail:");
mail_lbl.setForeground(new java.awt.Color(128, 0, 0));
mail_lbl.setBounds(10, 185, 56, 17);
mail_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(mail_lbl);
JLabel tel_lbl = new JLabel("Telefon:");
tel_lbl.setForeground(new java.awt.Color(128, 0, 0));
tel_lbl.setBounds(10, 215, 66, 17);
tel_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(tel_lbl);
JLabel adres_lbl = new JLabel("Adres:");
adres_lbl.setForeground(new java.awt.Color(128, 0, 0));
adres_lbl.setBounds(10, 245, 56, 17);
adres_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(adres_lbl);
JLabel il_lbl = new JLabel("\u0130l:");
il_lbl.setForeground(new java.awt.Color(128, 0, 0));
il_lbl.setBounds(10, 295, 45, 17);
il_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(il_lbl);
JLabel mezTarihi_lbl = new JLabel("Mezuniyet Tarihi:");
mezTarihi_lbl.setForeground(new java.awt.Color(128, 0, 0));
mezTarihi_lbl.setBounds(10, 341, 120, 17);
mezTarihi_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(mezTarihi_lbl);
JLabel girisTarihi_lbl = new JLabel("\u00DCye Giri\u015F Tarihi:");
girisTarihi_lbl.setForeground(new java.awt.Color(128, 0, 0));
girisTarihi_lbl.setBounds(10, 371, 112, 17);
girisTarihi_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(girisTarihi_lbl);
JLabel uyeDurumu_lbl = new JLabel("\u00DCyelik Durumu:");
uyeDurumu_lbl.setForeground(new java.awt.Color(128, 0, 0));
uyeDurumu_lbl.setBounds(10, 401, 123, 17);
uyeDurumu_lbl.setFont(new Font("Calibri", Font.BOLD, 16));
panel_in.add(uyeDurumu_lbl);
JButton new_btn = new JButton("Yeni Üye Ekle");
new_btn.setForeground(new java.awt.Color(128, 0, 0));
new_btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int ID = Integer.parseInt(uye_no.getText());
String Gender=yeni_cinsiyet.getText();
String Name=yeni_ad.getText();
String Surname=yeni_soyad.getText();
String Work=yeni_calısma.getText();
String Mail=yeni_mail.getText();
long TC=Long.parseLong(txtTc.getText());
String Graduation=yeni_mezun_day.getText()+"-"+yeni_mezun_month.getText()+"-"+yeni_mezun_year.getText();
String Department=yeni_bolum.getText();
long Phone=Long.parseLong(yeni_tel.getText());
String Address=yeni_adres.getText();
String City=yeni_il.getText();
String Mood=yeni_durum.getText();
String Enter=yeni_uye_day.getText()+"-"+yeni_uye_month.getText()+"-"+yeni_uye_year.getText();
Database_methods dbmethods3 = new Database_methods();
dbmethods3.AddClient(ID, Gender, Name, Surname, Work, Mail, TC,
Graduation, Department, Phone, Address, City, Mood, Enter);
dbmethods3.AddAB(ID,aidat_arr,borc_arr);
person new_person=new person(ID, Gender, Name, Surname, Work, Mail, TC,
Graduation, Department, Phone, Address, City,null,null, Mood, Enter);
DBlog(addObject(new_person));
dispose();
}
});
new_btn.setFont(new Font("Calibri", Font.BOLD, 14));
new_btn.setBackground(new java.awt.Color(211, 211, 211));
new_btn.setBounds(249, 450, 180, 25);
panel_in.add(new_btn);
uye_no = new JTextField();
uye_no.setFont(new Font("Calibri", Font.PLAIN, 10));
uye_no.setBounds(76, 5, 163, 20);
panel_in.add(uye_no);
uye_no.setColumns(10);
JLabel lblSoyad = new JLabel("Soyadı:");
lblSoyad.setForeground(new Color(128, 0, 0));
lblSoyad.setFont(new Font("Calibri", Font.BOLD, 16));
lblSoyad.setBounds(10, 65, 99, 17);
panel_in.add(lblSoyad);
yeni_ad = new JTextField();
yeni_ad.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_ad.setColumns(10);
yeni_ad.setBounds(108, 35, 253, 20);
panel_in.add(yeni_ad);
yeni_soyad = new JTextField();
yeni_soyad.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_soyad.setColumns(10);
yeni_soyad.setBounds(108, 63, 253, 20);
panel_in.add(yeni_soyad);
yeni_cinsiyet = new JTextField();
yeni_cinsiyet.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_cinsiyet.setColumns(10);
yeni_cinsiyet.setBounds(108, 93, 253, 20);
panel_in.add(yeni_cinsiyet);
yeni_bolum = new JTextField();
yeni_bolum.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_bolum.setColumns(10);
yeni_bolum.setBounds(109, 123, 252, 20);
panel_in.add(yeni_bolum);
yeni_calısma = new JTextField();
yeni_calısma.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_calısma.setColumns(10);
yeni_calısma.setBounds(108, 153, 253, 20);
panel_in.add(yeni_calısma);
yeni_mail = new JTextField();
yeni_mail.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_mail.setColumns(10);
yeni_mail.setBounds(108, 183, 253, 20);
panel_in.add(yeni_mail);
yeni_tel = new JTextField();
yeni_tel.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_tel.setColumns(10);
yeni_tel.setBounds(108, 213, 253, 20);
panel_in.add(yeni_tel);
yeni_adres = new JTextField();
yeni_adres.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_adres.setColumns(10);
yeni_adres.setBounds(108, 243, 253, 39);
panel_in.add(yeni_adres);
yeni_il = new JTextField();
yeni_il.setFont(new Font("Calibri", Font.PLAIN, 10));
yeni_il.setColumns(10);
yeni_il.setBounds(108, 293, 253, 20);
panel_in.add(yeni_il);
yeni_mezun_day = new JTextField();
yeni_mezun_day.setText("GG");
yeni_mezun_day.setFont(new Font("Calibri", Font.PLAIN, 11));
yeni_mezun_day.setColumns(10);
yeni_mezun_day.setBounds(150, 339, 25, 20);
panel_in.add(yeni_mezun_day);
yeni_uye_day = new JTextField();
yeni_uye_day.setText(String.format("%02d", day));
yeni_uye_day.setFont(new Font("Calibri", Font.PLAIN, 11));
yeni_uye_day.setColumns(10);
yeni_uye_day.setBounds(150, 369, 25, 20);
panel_in.add(yeni_uye_day);
yeni_durum = new JTextField();
yeni_durum.setText("AKTİF");
yeni_durum.setFont(new Font("Calibri", Font.PLAIN, 11));
yeni_durum.setColumns(10);
yeni_durum.setBounds(150, 399, 163, 20);
panel_in.add(yeni_durum);
txtTc = new JTextField();
txtTc.setFont(new Font("Calibri", Font.PLAIN, 10));
txtTc.setColumns(10);
txtTc.setBounds(355, 5, 154, 20);
panel_in.add(txtTc);
JButton geri_btn = new JButton("İptal");
geri_btn.setFont(new Font("Calibri", Font.BOLD, 14));
geri_btn.setForeground(new Color(128, 0, 0));
geri_btn.setBounds(430, 450, 79, 25);
geri_btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
dispose();
}
});
panel_in.add(geri_btn);
yeni_mezun_month = new JTextField();
yeni_mezun_month.setFont(new Font("Calibri", Font.PLAIN, 11));
yeni_mezun_month.setText("MM");
yeni_mezun_month.setBounds(178, 339, 32, 20);
panel_in.add(yeni_mezun_month);
yeni_mezun_month.setColumns(10);
yeni_mezun_year = new JTextField();
yeni_mezun_year.setFont(new Font("Calibri", Font.PLAIN, 11));
yeni_mezun_year.setText("YYYY");
yeni_mezun_year.setBounds(214, 339, 45, 20);
panel_in.add(yeni_mezun_year);
yeni_mezun_year.setColumns(10);
yeni_uye_month = new JTextField();
yeni_uye_month.setFont(new Font("Calibri", Font.PLAIN, 11));
yeni_uye_month.setBounds(178, 369, 32, 20);
yeni_uye_month.setText(String.format("%02d", month));
panel_in.add(yeni_uye_month);
yeni_uye_month.setColumns(10);
yeni_uye_year = new JTextField();
yeni_uye_year.setFont(new Font("Calibri", Font.PLAIN, 11));
yeni_uye_year.setBounds(214, 369, 45, 20);
yeni_uye_year.setText(String.format("%04d", year));
panel_in.add(yeni_uye_year);
yeni_uye_year.setColumns(10);
JButton minimize_btn = new JButton("_");
minimize_btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
setState(JFrame.ICONIFIED);
}
});
minimize_btn.setBounds(529, 11, 39, 34);
panel.add(minimize_btn);
}
public static void centreWindow(JFrame frame) {
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2);
int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2);
frame.setLocation(x, y);
}
public String addObject(person new_person) {
String log="Tarih: "+day+"/"+month+"/"+year+" Kişi eklendi.\n"+
"İsim:"+new_person.getAd_lbl()+"\n"+
"Soyisim:"+new_person.getSoy_lbl()+"\n"+
"Kimlik numarası:"+new_person.getKimlikNo_lbl()+"\n"+
"Üye numarası:"+new_person.getUyeNo_lbl()+"\n"+
"Cinsiyet:"+new_person.getCinsiyet_lbl()+"\n"+
"Bölüm:"+new_person.getBolum_lbl()+"\n"+
"Çalışma yeri:"+new_person.getCalismayer_lbl()+"\n"+
"Mail:"+new_person.getMail_lbl()+"\n"+
"Telefon numarası:"+new_person.getTel_lbl()+"\n"+
"Adres:"+new_person.getAdres_lbl()+"\n"+
"İl:"+new_person.getIl_lbl()+"\n"+
"Mezuniyet Tarihi:"+new_person.getMezTarihi_lbl()+"\n"+
"Üyelik tarihi:"+new_person.getGirisTarihi_lbl()+"\n"+
"Üye durumu:"+new_person.getUyeDurumu_lbl()+"\n";
return log;
}
public void DBlog(String x) {
try{
String documentpath=FileSystemView.getFileSystemView().getDefaultDirectory().getPath()+"\\Donation Tracking";
File file = new File(documentpath+"\\logs.txt");
FileWriter fw = new FileWriter(file.getAbsoluteFile(),true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(x);
bw.close();
}
catch(Exception e){
System.out.println(e);
}
}
public String AidatRead() {
String documentpath=FileSystemView.getFileSystemView().getDefaultDirectory().getPath()+"\\Donation Tracking";
File file = new File(documentpath+"\\aidatlar.txt");
String new_borc="";
try(Scanner fileReader = new Scanner(file)) {
new_borc=fileReader.nextLine();
System.out.println(new_borc);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
return new_borc;
}
}