コード例 #1
0
 private void btnPersonelEkle_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime selectedDate = Convert.ToDateTime(calendarControl2.SelectionStart.ToShortDateString());
         if (string.IsNullOrEmpty(cmbDepartmanSec.SelectedValue.ToString()))
         {
             throw new ValidationException("Lütfen Departman Bilgilerini Kontrol Ediniz !");
         }
         if (string.IsNullOrEmpty(cmbDepartmanSec.Text))
         {
             throw new ValidationException("Lütfen Departman Seçiniz !");
         }
         if (string.IsNullOrEmpty(txtPersonelAd.Text))
         {
             throw new ValidationException("Lütfen Ad Bilgisini Kontrol Ediniz !");
         }
         if (string.IsNullOrEmpty(txtPersonelSoyad.Text))
         {
             throw new ValidationException("Lütfen Soyad Bilgisini Kontrol Ediniz !");
         }
         if (string.IsNullOrEmpty(txtCepTelefonu.Text))
         {
             throw new ValidationException("Lütfen Cep Telefonu Bilgisini Kontrol Ediniz !");
         }
         if (selectedDate > DateTime.Now)
         {
             throw new ValidationException("İşe giriş tarihi bugünden daha sonraki bir tarih olamaz!");
         }
         Personeller personel = new Personeller
         {
             adi            = txtPersonelAd.Text,
             soyadi         = txtPersonelSoyad.Text,
             cepTelefonu    = txtCepTelefonu.Text,
             departmanID    = Convert.ToInt32(cmbDepartmanSec.SelectedValue),
             iseGirisTarihi = selectedDate
         };
         PersonelController.PersonelEkle(personel);
         MessageBox.Show("Personel Başarıyla Eklendi !", "Personel Eklendi !", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Giriş Bilgilerini Kontrol Ediniz !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
コード例 #2
0
        private void btn_PersonelEkle_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txt_PersonelAdi.Text) || string.IsNullOrEmpty(txt_PersonelSoyadi.Text))
                {
                    throw new ValidationException("Personel Bilgileri Boş Geçilemez !");
                }

                Kullanicilar kullanicilar = new Kullanicilar();
                kullanicilar.Personeller.Ad    = txt_PersonelAdi.Text;
                kullanicilar.Personeller.Soyad = txt_PersonelSoyadi.Text;
                PersonelController.PersonelEkle(kullanicilar);
                MessageBox.Show("Personel Bilgileri Başarıyla Eklendi !", "İşlem Başarılı !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Hata Meydana Geldi !", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }