forked from saitorhan/OtobusOtomasyon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm_personelGuncelleIDAlma.cs
75 lines (69 loc) · 2.49 KB
/
Form_personelGuncelleIDAlma.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace otobus_otomasyon_linq
{
public partial class Form_personelGuncelleIDAlma : Form
{
public static bool form_acik_mi = false;
VeriTabaniIslemleriDataContext db;
public Form_personelGuncelleIDAlma()
{
InitializeComponent();
}
private void Form_personelGuncelleIDAlma_Load(object sender, EventArgs e)
{
form_acik_mi = true;
db = new VeriTabaniIslemleriDataContext();
}
private void Form_personelGuncelleIDAlma_FormClosing(object sender, FormClosingEventArgs e)
{
form_acik_mi = false;
}
private void button_kaydet_Click(object sender, EventArgs e)
{
foreach (Char item in textBox_calisan_ID.Text)
{
if (!Char.IsDigit(item))
{
toolStripStatusLabel_durum.Text = "Numara sadece rakamlardan oluşabilir.";
return;
}
}
int guncellenecekID = Convert.ToInt32(textBox_calisan_ID.Text);
Calisanlar calisan = null;
try
{
calisan = db.Calisanlars.Where(s => s.ID == guncellenecekID).Select(s => s).First();
}
catch (Exception ex)
{
Form_ana_ekran.HataKaydi(ex);
toolStripStatusLabel_durum.Text = "Çalışan bulunamadı.";
return;
}
Form_personel_guncelle_ekle frm_guncelle = new Form_personel_guncelle_ekle(calisan);
frm_guncelle.Text = "Personel Güncelle";
if (Form_personel_guncelle_ekle.form_acik_mi)
{
foreach (Form item in this.MdiParent.MdiChildren)
{
if (item.Text==frm_guncelle.Text)
{
MessageBox.Show("Lütfen açık olan güncelleme penceresini kapatıp tekrar deneyiniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Stop);
item.BringToFront();
return;
}
}
}
frm_guncelle.MdiParent = this.MdiParent;
frm_guncelle.Show();
this.Close();
}
}
}