public static bool Calisan_Update(ECALISAN item) { bool sonuc = false; try { FBAGLANTI.Baglan = new SqlConnection("Data Source=.;Initial Catalog=SINEMA;Integrated Security=True"); SqlCommand com = new SqlCommand("Calisan_Update", FBAGLANTI.Baglan); com.CommandType = CommandType.StoredProcedure; if (com.Connection.State != ConnectionState.Open) { com.Connection.Open(); } com.Parameters.AddWithValue("CalisanID", item.CalisanID); com.Parameters.AddWithValue("Ad", item.Ad); com.Parameters.AddWithValue("Soyad", item.Soyad); com.Parameters.AddWithValue("KullaniciAd", item.KullaniciAd); com.Parameters.AddWithValue("KullaniciParola", item.KullaniciParola); com.Parameters.AddWithValue("DogumTarih", item.DogumTarih); com.Parameters.AddWithValue("IseGirisTarih", item.IseGirisTarih); com.Parameters.AddWithValue("TCNO", item.TCNO); com.Parameters.AddWithValue("AdminYetki", item.AdminYetki); sonuc = com.ExecuteNonQuery() > 0; com.Dispose(); FBAGLANTI.Baglan.Close(); FBAGLANTI.Baglan.Dispose(); } catch { sonuc = false; } return(sonuc); }
public static bool Calisan_Update(ECALISAN item) { if (item.CalisanID > 0 && item.Ad != null && item.Ad.Trim().Length > 0 && item.Soyad != null && item.Soyad.Trim().Length > 0 && item.KullaniciAd != null && item.KullaniciAd.Trim().Length > 0 && item.KullaniciParola != null && item.KullaniciParola.Trim().Length > 0 && item.DogumTarih != null && item.IseGirisTarih != null && item.TCNO != null && item.TCNO.Trim().Length > 0) { return(FADMIN.Calisan_Update(item)); } return(false); }
//Çalışan verilerinin kontrolünün yapıldığı metotlar. public static int Calisan_Insert(ECALISAN item) { if (item.Ad != null && item.Ad.Trim().Length > 0 && item.Soyad != null && item.Soyad.Trim().Length > 0 && item.KullaniciAd != null && item.KullaniciAd.Trim().Length > 0 && item.KullaniciParola != null && item.KullaniciParola.Trim().Length > 0 && item.DogumTarih != null && item.IseGirisTarih != null && item.TCNO != null && item.TCNO.Trim().Length > 0) { return(FADMIN.Calisan_Insert(item)); } return(-1); }
private void btnCalisanGuncelle_Click(object sender, EventArgs e) { ECALISAN item = new ECALISAN(); //Eski çalışan bilgilerini aldık. item.CalisanID = Convert.ToInt32(dataGridViewCalisan.SelectedRows[0].Cells["CalisanID"].Value.ToString()); item.Ad = dataGridViewCalisan.SelectedRows[0].Cells["Ad"].Value.ToString(); item.Soyad = dataGridViewCalisan.SelectedRows[0].Cells["Soyad"].Value.ToString(); item.KullaniciAd = dataGridViewCalisan.SelectedRows[0].Cells["Kullanıcı Ad"].Value.ToString(); item.KullaniciParola = dataGridViewCalisan.SelectedRows[0].Cells["Kullanıcı Parolası"].Value.ToString(); item.TCNO = dataGridViewCalisan.SelectedRows[0].Cells["TC Kimlik Numarası"].Value.ToString(); item.DogumTarih = Convert.ToDateTime(dataGridViewCalisan.SelectedRows[0].Cells["Doğum Tarihi"].Value.ToString()); item.IseGirisTarih = Convert.ToDateTime(dataGridViewCalisan.SelectedRows[0].Cells["İşe Giriş Tarihi"].Value.ToString()); item.AdminYetki = Convert.ToBoolean(dataGridViewCalisan.SelectedRows[0].Cells["Admin Yetkisi"].Value.ToString()); //Güncellenen film bilgilerini alıyoruz. item.Ad = txtAd.Text; item.Soyad = txtSoyad.Text; item.KullaniciAd = txtKullaniciAd.Text; item.KullaniciParola = txtKullaniciParola.Text; item.TCNO = txtTC.Text; item.DogumTarih = Convert.ToDateTime(dateTimeDogumTarih.Text); item.IseGirisTarih = Convert.ToDateTime(dateTimeIseGirisTarih.Text); if (rdbAdmin.Checked) { item.AdminYetki = true; } else { item.AdminYetki = false; } if (BLLADMIN.Calisan_Update(item)) { calisanCek(); MessageBox.Show("Çalışan güncelleme işlemi gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); calisanTemizle(); lblUyariCalisan.Visible = false; } else { calisanCek(); MessageBox.Show("Çalışan güncelleme işlemi eksik bilgiler yada başka nedenlerden dolayı gerçekleştirilemedi.Tüm boş alanları doldurup tekrar deneyin. Sorunun devam etmesi halinde lütfen yöneticinize danışın.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error); lblUyariCalisan.Visible = true; lblUyariCalisan.ForeColor = Color.Red; calisanTemizle(); } }
public static List <ECALISAN> Calisan_SelectList() { List <ECALISAN> itemList = new List <ECALISAN>(); try { FBAGLANTI.Baglan = new SqlConnection("Data Source=.;Initial Catalog=SINEMA;Integrated Security=True"); SqlCommand com = new SqlCommand("Calisan_SelectList", FBAGLANTI.Baglan); com.CommandType = CommandType.StoredProcedure; if (com.Connection.State != ConnectionState.Open) { com.Connection.Open(); } SqlDataReader dr = com.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { ECALISAN item = new ECALISAN(); item.CalisanID = Convert.ToInt32(dr["CalisanID"]); item.Ad = dr["Ad"].ToString(); item.Soyad = dr["Soyad"].ToString(); item.KullaniciAd = dr["KullaniciAd"].ToString(); item.KullaniciParola = dr["KullaniciParola"].ToString(); item.DogumTarih = Convert.ToDateTime(dr["DogumTarih"]); item.IseGirisTarih = Convert.ToDateTime(dr["IseGirisTarih"]); item.TCNO = dr["TCNO"].ToString(); item.AdminYetki = Convert.ToBoolean(dr["AdminYetki"]); itemList.Add(item); } } dr.Close(); com.Dispose(); FBAGLANTI.Baglan.Close(); FBAGLANTI.Baglan.Dispose(); } catch { itemList = null; } return(itemList); }
private void btnCalisanSil_Click(object sender, EventArgs e) { ECALISAN item = new ECALISAN(); item.CalisanID = Convert.ToInt32(dataGridViewCalisan.SelectedRows[0].Cells["CalisanID"].Value.ToString()); if (BLLADMIN.Calisan_Delete(item.CalisanID)) { calisanCek(); MessageBox.Show("Çalışan silme işlemi gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); calisanTemizle(); } else { calisanCek(); MessageBox.Show("Çalışan silme işlemi gerçekleştirilemedi.Lütfen yöneticinize danışın.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error); calisanTemizle(); } }
private void btnCalisanEkle_Click(object sender, EventArgs e) { ECALISAN item = new ECALISAN(); item.Ad = txtAd.Text; item.Soyad = txtSoyad.Text; item.KullaniciAd = txtKullaniciAd.Text; item.KullaniciParola = txtKullaniciParola.Text; item.TCNO = txtTC.Text; item.DogumTarih = Convert.ToDateTime(dateTimeDogumTarih.Text); item.IseGirisTarih = Convert.ToDateTime(dateTimeIseGirisTarih.Text); if (rdbAdmin.Checked) { item.AdminYetki = true; } else { item.AdminYetki = false; } if (BLLADMIN.Calisan_Insert(item) > 0) { calisanCek(); MessageBox.Show("Çalışan ekleme işlemi gerçekleştirilmiştir.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); calisanTemizle(); lblUyariCalisan.Visible = false; } else { calisanCek(); MessageBox.Show("Çalışan ekleme işlemi eksik bilgiler yada başka nedenlerden dolayı gerçekleştirilemedi.Tüm boş alanları doldurup tekrar deneyin. Sorunun devam etmesi halinde lütfen yöneticinize danışın.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error); lblUyariCalisan.Visible = true; lblUyariCalisan.ForeColor = Color.Red; calisanTemizle(); } }