private void btn_Click(object sender, EventArgs e)
        {
            if (cCalisan.islem == Convert.ToInt32(cCalisan.islemler.frmCalisan_CalisanEkle))
            {
                #region Ekleme
                bool sonuc = false;
                if (txtAd.Text.Trim() == "" || txtSoyad.Text.Trim() == "" || mtbTckno.Text != "")
                {
                    if (txtSehirID.Text != "" && txtIlceID.Text != "" && txtMahalleID.Text != "")
                    {
                        cAdres a = new cAdres();
                        a.SehirID   = Convert.ToInt32(txtSehirID.Text);
                        a.IlceID    = Convert.ToInt32(txtIlceID.Text);
                        a.MahalleID = Convert.ToInt32(txtMahalleID.Text);
                        a.Aciklama  = txtAciklama.Text;
                        int adresID = a.InsertAdres(a);
                        txtAdresID.Text = Convert.ToString(adresID);

                        if (txtPozisyonID.Text != "" && txtSubeID.Text != "")
                        {
                            if (adresID > 0)
                            {
                                cCalisan c = new cCalisan();
                                c.CalisanPozisyonID = Convert.ToInt32(txtPozisyonID.Text);
                                c.CalisanTCKNO      = mtbTckno.Text;
                                c.SubeID            = Convert.ToInt32(txtSubeID.Text);
                                c.Ad    = txtAd.Text;
                                c.Soyad = txtSoyad.Text;
                                if (rbBay.Checked == true)
                                {
                                    c.Cinsiyet = "Bay";
                                }
                                else
                                {
                                    c.Cinsiyet = "Bayan";
                                }
                                c.DogumTarihi = dtpDogumTarihi.Value;
                                if (rbEhVar.Checked == true)
                                {
                                    c.EhliyetSinifi     = cbEhliyetSinifi.Text;
                                    c.EhliyetAlisTarihi = dtpAlisTarihi.Value;
                                }
                                else if (rbEhYok.Checked == true)
                                {
                                    c.EhliyetSinifi     = "";
                                    c.EhliyetAlisTarihi = Convert.ToDateTime("01/01/1800 00:00:00");
                                }
                                Regex reg = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
                                if (txtEposta.Text != "")
                                {
                                    if (!reg.IsMatch(txtEposta.Text))
                                    {
                                        MessageBox.Show("Email Geçersiz!");
                                        txtEposta.Focus(); txtEposta.Clear();
                                        return;
                                    }
                                    else
                                    {
                                        c.Mail = txtEposta.Text;
                                    }
                                }
                                else
                                {
                                    c.Mail = "";
                                }
                                if (txtTelefon.Text.Trim() != "")
                                {
                                    c.Telefon = txtTelefon.Text;
                                }
                                else
                                {
                                    MessageBox.Show("Telefon Numarasını Kontrol Ediniz"); txtTelefon.Focus(); return;
                                }
                                c.AdresID     = adresID;
                                c.GirisTarihi = dtpGiris.Value;
                                if (txtMaas.Text == "")
                                {
                                    MessageBox.Show("Maaş bilgisi Giriniz"); txtMaas.Focus(); return;
                                }
                                else
                                {
                                    c.Maas = Convert.ToDecimal(txtMaas.Text);
                                }
                                sonuc = c.CalisanEkle(c);
                                if (sonuc)
                                {
                                    if (c.CalisanPozisyonID < 4)
                                    {
                                        cCalisan ca = new cCalisan();
                                        ca.CalisanID = Convert.ToInt32(txtCalisanNO.Text);
                                        ca.Kadi      = txtSoyad.Text + txtPozisyonID.Text;
                                        ca.Sifre     = "12345";
                                        sonuc        = ca.InsertKullanici(ca);
                                        MessageBox.Show("Kayıt Başarılı", "Bilgi");
                                        this.Close();
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("kayıt hatalı!!", "Hata");
                                    Temizle();
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Departman Bilgileri Boş Bırakılamaz !!", "Hata");
                        }
                    }
                    else
                    {
                        MessageBox.Show(" Adres Boş Bırakılamaz!!", "Hata");
                    }
                }
                else
                {
                    MessageBox.Show("Kişisel Bilgiler Boş Bırakılamaz");
                    Temizle();
                }
                #endregion
            }

            else if (cCalisan.islem == Convert.ToInt32(cCalisan.islemler.frmCalisan_CalisanBilgileriDegistir))
            {
                #region Güncelleme
                bool sonuc = false;
                if (txtAd.Text.Trim() != "" && txtSoyad.Text.Trim() != "" && mtbTckno.Text != "")
                {
                    if (txtSehirID.Text != "" && txtIlceID.Text != "" && txtMahalleID.Text != "")
                    {
                        cAdres a = new cAdres();
                        a.SehirID   = Convert.ToInt32(txtSehirID.Text);
                        a.IlceID    = Convert.ToInt32(txtIlceID.Text);
                        a.MahalleID = Convert.ToInt32(txtMahalleID.Text);
                        a.Aciklama  = txtAciklama.Text;
                        a.AdresID   = Convert.ToInt32(txtAdresID.Text);
                        if (a.UpdateAdres(a))
                        {
                            if (txtPozisyonID.Text != "" && txtSubeID.Text != "")
                            {
                                cCalisan c = new cCalisan();
                                c.CalisanID         = Convert.ToInt32(txtCalisanNO.Text);
                                c.CalisanPozisyonID = Convert.ToInt32(txtPozisyonID.Text);
                                c.SubeID            = Convert.ToInt32(txtSubeID.Text);
                                if (rbEhVar.Checked == true)
                                {
                                    c.EhliyetSinifi     = cbEhliyetSinifi.Text;
                                    c.EhliyetAlisTarihi = dtpAlisTarihi.Value;
                                }
                                else if (rbEhYok.Checked == true)
                                {
                                    c.EhliyetSinifi     = "";
                                    c.EhliyetAlisTarihi = Convert.ToDateTime("01/01/1800 00:00:00");
                                }
                                if (txtTelefon.Text.Trim() != "")
                                {
                                    c.Telefon = txtTelefon.Text;
                                }
                                else
                                {
                                    MessageBox.Show("Telefon Numarasını Kontrol Ediniz"); txtTelefon.Focus(); return;
                                }
                                Regex reg = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
                                if (txtEposta.Text != "")
                                {
                                    if (!reg.IsMatch(txtEposta.Text))
                                    {
                                        MessageBox.Show("Hatalı email girişi!");
                                        txtEposta.Focus(); txtEposta.Clear();
                                        return;
                                    }
                                    else
                                    {
                                        c.Mail = txtEposta.Text;
                                    }
                                }
                                else
                                {
                                    c.Mail = "";
                                }
                                c.AdresID = Convert.ToInt32(txtAdresID.Text);
                                if (txtMaas.Text == "")
                                {
                                    MessageBox.Show("Maaş bilgisi Giriniz"); txtMaas.Focus(); return;
                                }
                                else
                                {
                                    c.Maas = Convert.ToDecimal(txtMaas.Text);
                                }
                                sonuc = c.CalisanBilgileriGuncelle(c);

                                if (sonuc)
                                {
                                    MessageBox.Show("Güncelleme İşlemi Başarılı", "Bilgi");
                                    this.Close();
                                }
                                else
                                {
                                    MessageBox.Show("Güncelleme Başarısız", "Hata");
                                    this.Close();
                                }
                            }
                            else
                            {
                                MessageBox.Show("Departman Bilgileri Boş Bırakılamaz!!");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(" Adres Boş Bırakılamaz!!", "Hata");
                    }
                }
                else
                {
                    MessageBox.Show("Kişisel Bilgiler Boş Bırakılamaz");
                    Temizle();
                }
                #endregion
            }
            else if (cCalisan.islem == Convert.ToInt32(cCalisan.islemler.frmCalisan_CalisanSil))
            {
                #region Silme
                bool sonuc = false;
                if (txtCalisanNO.Text != "" && txtAd.Text.Trim() != "")
                {
                    if (MessageBox.Show(txtAd.Text + " " + txtSoyad.Text + " " + "adlı Calışanı Silmek İstiyormusunz?", "SİLİNSİN Mİ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        cCalisan c = new cCalisan();
                        txtCikis.Text = DateTime.Now.ToShortDateString();
                        sonuc         = c.CalisanSil(Convert.ToInt32(txtCalisanNO.Text));
                        if (sonuc)
                        {
                            if (Convert.ToInt32(txtPozisyonID.Text) < 4)
                            {
                                cCalisan ca = new cCalisan();
                                ca.CalisanID = Convert.ToInt32(txtCalisanNO.Text);
                                ca.Kadi      = txtUser.Text;
                                ca.Sifre     = txtUserPswd.Text;
                                sonuc        = ca.KullaniciSil(Convert.ToInt32(txtCalisanNO.Text));
                                MessageBox.Show("Çalışan Bilgileri Silindi!", "Bilgi");
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Çalışan Bilgileri Silinemedi", "Hata");
                            this.Close();
                        }
                    }
                }
                #endregion
            }

            else if (cCalisan.islem == Convert.ToInt32(cCalisan.islemler.frmCalisan_Profil))
            {
                #region Profil
                bool sonuc = false;
                if (txtAd.Text.Trim() != "" && txtSoyad.Text.Trim() != "" && mtbTckno.Text != "")
                {
                    if (txtSehirID.Text != "" && txtIlceID.Text != "" && txtMahalleID.Text != "")
                    {
                        cAdres a = new cAdres();
                        a.SehirID   = Convert.ToInt32(txtSehirID.Text);
                        a.IlceID    = Convert.ToInt32(txtIlceID.Text);
                        a.MahalleID = Convert.ToInt32(txtMahalleID.Text);
                        a.Aciklama  = txtAciklama.Text;
                        a.AdresID   = Convert.ToInt32(txtAdresID.Text);
                        if (a.UpdateAdres(a))
                        {
                            cCalisan c = new cCalisan();
                            c.CalisanID         = Convert.ToInt32(txtCalisanNO.Text);
                            c.CalisanPozisyonID = Convert.ToInt32(txtPozisyonID.Text);
                            c.SubeID            = Convert.ToInt32(txtSubeID.Text);
                            if (rbEhVar.Checked == true)
                            {
                                c.EhliyetSinifi     = cbEhliyetSinifi.Text;
                                c.EhliyetAlisTarihi = dtpAlisTarihi.Value;
                            }
                            else if (rbEhYok.Checked == true)
                            {
                                c.EhliyetSinifi     = "";
                                c.EhliyetAlisTarihi = Convert.ToDateTime("01/01/1800 00:00:00");
                            }
                            if (txtTelefon.Text.Trim() != "")
                            {
                                c.Telefon = txtTelefon.Text;
                            }
                            else
                            {
                                MessageBox.Show("Telefon Numarasını Kontrol Ediniz"); txtTelefon.Focus(); return;
                            }
                            Regex reg = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
                            if (txtEposta.Text != "")
                            {
                                if (!reg.IsMatch(txtEposta.Text))
                                {
                                    MessageBox.Show("Hatalı email girişi!");
                                    txtEposta.Focus(); txtEposta.Clear();
                                    return;
                                }
                                else
                                {
                                    c.Mail = txtEposta.Text;
                                }
                            }
                            else
                            {
                                c.Mail = "";
                            }
                            c.AdresID = Convert.ToInt32(txtAdresID.Text);
                            if (txtMaas.Text == "")
                            {
                                MessageBox.Show("Maaş bilgisi Giriniz"); txtMaas.Focus(); return;
                            }
                            else
                            {
                                c.Maas = Convert.ToDecimal(txtMaas.Text);
                            }
                            sonuc = c.CalisanBilgileriGuncelle(c);
                            if (sonuc)
                            {
                                cCalisan ca = new cCalisan();
                                ca.CalisanID = Convert.ToInt32(txtCalisanNO.Text);
                                ca.Kadi      = txtUser.Text;
                                ca.Sifre     = txtUserPswd.Text;
                                sonuc        = ca.UpdateKullanici(ca);
                                MessageBox.Show("Güncelleme İşlemi Başarılı", "Bilgi");
                                this.Close();
                            }
                            else
                            {
                                MessageBox.Show("Güncelleme Başarısız", "Hata");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(" Adres Boş Bırakılamaz!!", "Hata");
                    }
                }
                else
                {
                    MessageBox.Show("Kişisel Bilgiler Boş Bırakılamaz");
                    Temizle();
                }
                #endregion
            }
        }