private void cbIlce_SelectedIndexChanged(object sender, EventArgs e) { cAdres a = (cAdres)cbIlce.SelectedItem; txtIlceID.Text = Convert.ToString(a.IlceID); a.mahalleGetir(cbMahalle, Convert.ToInt32(txtIlceID)); }
private void cbIlce_SelectedIndexChanged(object sender, EventArgs e) { cAdres a = (cAdres)cbIlce.SelectedItem; tutIlceID = a.IlceID; a.mahalleGetir(cbMahalle, tutIlceID); }
private void cbSehir_SelectedIndexChanged(object sender, EventArgs e) { cAdres a = (cAdres)cbSehir.SelectedItem; txtSehirID.Text = Convert.ToString(a.SehirID); a.ilceGetir(cbIlce, Convert.ToInt32(txtSehirID)); }
private void cbSehir_SelectedIndexChanged(object sender, EventArgs e) { cAdres a = (cAdres)cbSehir.SelectedItem; tutSehirID = a.SehirID; a.ilceGetir(cbIlce, tutSehirID); }
public bool UpdateAdres(cAdres a) { bool sonuc = false; SqlConnection conn = new SqlConnection(cGenel.connStr); SqlCommand comm = new SqlCommand("update adres set sehirID=@sehirID,ilceID=@ilceID,mahalleID=@mahalleID,aciklama=@aciklama where adresID=@adresID", conn); comm.Parameters.AddWithValue("@sehirID", a._sehirID); comm.Parameters.AddWithValue("@ilceID", a._ilceID); comm.Parameters.AddWithValue("@mahalleID", a._mahalleID); comm.Parameters.AddWithValue("@aciklama", a._aciklama); comm.Parameters.AddWithValue("@adresID", a._adresID); if (conn.State == ConnectionState.Closed) { conn.Open(); } try { sonuc = Convert.ToBoolean(comm.ExecuteNonQuery()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(sonuc); }
public int InsertAdres(cAdres a) { int adresID = 0; SqlConnection conn = new SqlConnection(cGenel.connStr); SqlCommand comm = new SqlCommand("insert into adres(sehirID,ilceID,mahalleID,aciklama) Values(@sehirID,@ilceID,@mahalleID,@aciklama);Select Scope_IDENTITY() ", conn); comm.Parameters.AddWithValue("@sehirID", a._sehirID); comm.Parameters.AddWithValue("@ilceID", a._ilceID); comm.Parameters.AddWithValue("@mahalleID", a._mahalleID); comm.Parameters.AddWithValue("@aciklama", a._aciklama); if (conn.State == ConnectionState.Closed) { conn.Open(); } try { adresID = Convert.ToInt32(comm.ExecuteScalar()); } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(adresID); }
public void mahalleGetir(ComboBox mahalle, int ilceID) { islem = Convert.ToInt32(cAdres.islemler.mahalle); mahalle.Items.Clear(); SqlConnection conn = new SqlConnection(cGenel.connStr); SqlCommand comm = new SqlCommand("select * from mahalle where ilceID=@ilceID order by ad asc", conn); comm.Parameters.AddWithValue("@ilceID", ilceID); if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlDataReader dr = comm.ExecuteReader(); while (dr.Read()) { cAdres a = new cAdres(); a._mahalleAd = Convert.ToString(dr["ad"]); a._mahalleID = Convert.ToInt32(dr["mahalleID"]); mahalle.Items.Add(a); } dr.Close(); conn.Close(); islem = 0; }
public void sehirGetir(ComboBox iller) { islem = Convert.ToInt32(cAdres.islemler.sehir); iller.Items.Clear(); SqlConnection conn = new SqlConnection(cGenel.connStr); SqlCommand comm = new SqlCommand("select * from sehir order by ad asc", conn); if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlDataReader dr = comm.ExecuteReader(); while (dr.Read()) { cAdres a = new cAdres(); a._sehirAd = Convert.ToString(dr["ad"]); a._sehirID = Convert.ToInt32(dr["sehirID"]); iller.Items.Add(a); } dr.Close(); conn.Close(); islem = 0; }
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 } }
private void cbMahalle_SelectedIndexChanged(object sender, EventArgs e) { cAdres a = (cAdres)cbMahalle.SelectedItem; txtMahalleID.Text = Convert.ToString(a.MahalleID); }
private void btn_Click(object sender, EventArgs e) { if (cMusteri.islem == Convert.ToInt32(cMusteri.islemler.frmMusteri_Detay)) { } else if (cMusteri.islem == Convert.ToInt32(cMusteri.islemler.frmMusteri_musteriEkle)) { if (txtAd.Text.Trim() != "" && txtSoyad.Text.Trim() != "") { cAdres a = new cAdres(); a.SehirID = Convert.ToInt32(tutSehirID); a.IlceID = Convert.ToInt32(tutIlceID); a.MahalleID = Convert.ToInt32(tutMahalleID); a.Aciklama = txtAciklama.Text; int adresID = a.InsertAdres(a); txtAdresID.Text = Convert.ToString(adresID); cMusteri m = new cMusteri(); m.Ad = txtAd.Text; m.Soyad = txtSoyad.Text; m.Ceptel = txtCepTelefon.Text; m.Evtel = txtEvTelefon.Text; m.Tckn = txtTckn.Text; m.Email = txtEmail.Text; m.AdresID = Convert.ToInt32(txtAdresID.Text); m.DogumTarih = Convert.ToDateTime(txtDogumTarihi.Text); if (rbBay.Checked == true) { m.Cinsiyet = rbBay.Text; } else { m.Cinsiyet = rbBayan.Text; } bool sonuc = m.InsertMusteri(m); if (sonuc) { MessageBox.Show("Bilgiler Kaydedildi"); //btnKaydet.Enabled = false; //m.MusterilerGoster(lvMusteriler); } else { MessageBox.Show("kayıt işlemi gerçekleşmedi"); //txtAdres.Focus(); } } else { MessageBox.Show("Ad ve Soyad alanlarını boş bırakmayınız"); } } else if (cMusteri.islem == Convert.ToInt32(cMusteri.islemler.frmMusteri_MusteriBilgileriDegistir)) { if (txtAd.Text.Trim() != "" && txtSoyad.Text.Trim() != "") { cAdres a = new cAdres(); a.SehirID = Convert.ToInt32(tutSehirID); a.IlceID = Convert.ToInt32(tutIlceID); a.MahalleID = Convert.ToInt32(tutMahalleID); a.Aciklama = txtAciklama.Text; a.AdresID = Convert.ToInt32(txtAdresID.Text); if (a.UpdateAdres(a)) { MessageBox.Show("Adres degistirilmiştir"); } cMusteri m = new cMusteri(); m.Ad = txtAd.Text; m.Soyad = txtSoyad.Text; m.Ceptel = txtCepTelefon.Text; m.Evtel = txtEvTelefon.Text; m.Tckn = txtTckn.Text; m.Email = txtEmail.Text; m.AdresID = Convert.ToInt32(txtAdresID.Text); m.DogumTarih = Convert.ToDateTime(txtDogumTarihi.Text); m.MusteriID = Convert.ToInt32(tutMusteriID); if (rbBay.Checked == true) { m.Cinsiyet = rbBay.Text; } else { m.Cinsiyet = rbBayan.Text; } bool sonuc = m.MusteriDegistir(m); if (sonuc) { MessageBox.Show("Bilgiler Degistirildi"); //btnKaydet.Enabled = false; //m.MusterilerGoster(lvMusteriler); } else { MessageBox.Show("degistirme işlemi gerçekleşmedi"); //txtAdres.Focus(); } } else { MessageBox.Show("Ad ve Soyad alanlarını boş bırakmayınız"); } } else if (cMusteri.islem == Convert.ToInt32(cMusteri.islemler.frmMusteri_Sil)) { if (txtAd.Text.Trim() != "" && txtSoyad.Text.Trim() != "") { cMusteri m = new cMusteri(); m.MusteriID = Convert.ToInt32(tutMusteriID); if (Convert.ToBoolean(m.MusteriSil(m))) { MessageBox.Show("Bilgiler Silindi"); } else { MessageBox.Show("silmeişlemi gerçekleşmedi"); } } else { MessageBox.Show("Ad ve Soyad alanlarını boş bırakmayınız"); } } }
private void cbMahalle_SelectedIndexChanged(object sender, EventArgs e) { cAdres a = (cAdres)cbMahalle.SelectedItem; tutMahalleID = a.MahalleID; }