Example #1
0
        //Bu methodda kayıtları listeleyeceğimiz için list türünde tanımlama yapıyoruz.
        public static List <ENTITYOGRENCI> OGRENCILISTESI()
        {
            //list türünde bir nesne oluşturuyoruz.
            List <ENTITYOGRENCI> degerler = new List <ENTITYOGRENCI>();
            //SqlCommand sınıfından komut isimli bir nesne tanımlıyoruz.
            SqlCommand komut = new SqlCommand("OGRENCILISTESI", SQLBAGLANTISI.Baglanti);

            //tanımlanan komutun prosedür olduğunu tanıtıyoruz.
            komut.CommandType = CommandType.StoredProcedure;
            //Baglantı durumunu sorgulayıp sql bağlantısını tamamlıyoruz.
            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }
            //Bu sınıf verileri okumak için kullandığımız bir sınıftır.Komut nesnesinin özellikleri ile beraber kullanıyoruz.
            SqlDataReader dr = komut.ExecuteReader();

            while (dr.Read())
            {
                //Ogrenci verilerine ulaşabilmek için ENTITYOGRENCI sınıfından bir nesne oluşturuyoruz.
                ENTITYOGRENCI ent = new ENTITYOGRENCI();
                ent.AD       = dr["AD"].ToString();
                ent.SOYAD    = dr["SOYAD"].ToString();
                ent.FOTOGRAF = dr["FOTOGRAF"].ToString();
                ent.KULUPID  = Convert.ToInt16(dr["KULUPID"]);
                ent.ID       = Convert.ToInt16(dr["ID"]);
                //ent nesnesinden aldığımız değerleri degerler nesnesine ekliyor.
                degerler.Add(ent);
            }
            //okuma işlemini bitir.
            dr.Close();
            //Degerleri geri döndürüyor.
            return(degerler);
        }
        public static List <ENTITYOGRENCI> OGRENCILISTESI()
        {
            List <ENTITYOGRENCI> deger = new List <ENTITYOGRENCI>();
            SqlCommand           komut = new SqlCommand("OGRENCILISTESI", SQLBAGLANTISI.BAGLANTI);

            komut.CommandType = CommandType.StoredProcedure;

            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }

            SqlDataReader dr = komut.ExecuteReader();

            while (dr.Read())
            {
                ENTITYOGRENCI ent = new ENTITYOGRENCI();
                ent.AD       = dr["AD"].ToString();
                ent.SOYAD    = dr["SOYAD"].ToString();
                ent.FOTOGRAF = dr["FOTOGRAF"].ToString();
                ent.KULUPID  = Convert.ToInt16(dr["KULUPID"]);
                ent.ID       = Convert.ToInt16(dr["ID"]);
                deger.Add(ent);
            }

            dr.Close();

            return(deger);
        }
Example #3
0
 public static int EKLE(ENTITYOGRENCI deger)
 {
     if (deger.AD != null)
     {
         return(FACADEOGRENCI.EKLE(deger));
     }
     return(-1);
 }
Example #4
0
 public static bool GUNCELLE(ENTITYOGRENCI deger)
 {
     if (deger.AD != null && deger.ID != null)
     {
         FACADEOGRENCI.GUNCELLE(deger);
     }
     return(false);
 }
 public static int EKLE(ENTITYOGRENCI deger)
 {
     if (deger.AD != null && deger.SOYAD != null && deger.KULUPID > 0 && deger.FOTOGRAF != null && deger.KULUPID > 0 && deger.FOTOGRAF.Length > 1)
     {
         return(FACADEOGRENCI.EKLE(deger));
     }
     return(-1);
 }
 public static bool GUNCELLE(ENTITYOGRENCI deger)
 {
     if (deger.AD != null && deger.SOYAD != null && deger.KULUPID > 0 && deger.FOTOGRAF != null && deger.KULUPID > 0 && deger.ID > 0)
     {
         return(FACADEOGRENCI.GUNCELLE(deger));
     }
     return(false);
 }
Example #7
0
 public static bool GUNCELLE(ENTITYOGRENCI deger)
 {
     //Öğrenci güncelleme için girilen değerler, istenilen aralıkta olduğu zaman güncellenecek değeri FACADEOGRENCI katmanına göndererek günccelleme işlemini tamamlıyor.
     if (deger.AD != null && deger.SOYAD != null && deger.KULUPID > 0 && deger.FOTOGRAF != null && deger.KULUPID > 0 && deger.ID > 0)
     {
         return(FACADEOGRENCI.GUNCELLE(deger));
     }
     //Güncellenecek değerlerden herhangi birisi boş ise işlemi gerçekleştirmeyecektir.
     return(false);
 }
Example #8
0
 public static int EKLE(ENTITYOGRENCI deger)
 {
     //Öğrenci ekleme için girilen değerler, istenilen aralıkta olduğu zaman eklenecek değeri FACADEOGRENCI katmanına göndererek ekleme işlemini tamamlıyor.
     if (deger.AD != null && deger.SOYAD != null && deger.KULUPID > 0 && deger.FOTOGRAF != null && deger.KULUPID > 0 && deger.FOTOGRAF.Length > 1)
     {
         return(FACADEOGRENCI.EKLE(deger));
     }
     //Eklenecek değerlerden herhangi birisi boş ise işlemi gerçekleştirme.
     return(-1);
 }
Example #9
0
        public static int EKLE(ENTITYOGRENCI deger)
        {
            SqlCommand komut = MyExtensions.CommandOlustur(ResourceStoredProcedure.OGRENCI_EKLE, SQLBAGLANTI.Baglanti);

            komut.Parameters.AddWithValue(ResourceTblOgrenci.AD, deger.AD);
            komut.Parameters.AddWithValue(ResourceTblOgrenci.SOYAD, deger.SOYAD);
            komut.Parameters.AddWithValue(ResourceTblOgrenci.FOTOGRAF, deger.FOTOGRAF);
            komut.Parameters.AddWithValue(ResourceTblOgrenci.KULUP_ID, deger.KULUPID);

            return(komut.ExecuteNonQuery());
        }
Example #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            ENTITYOGRENCI ent = new ENTITYOGRENCI();

            ent.AD       = txtad.Text;
            ent.SOYAD    = txtsoyad.Text;
            ent.FOTOGRAF = txtfotograf.Text;
            ent.KULUPID  = Convert.ToInt16(txts1.Text);
            BLLOGRENCII.EKLE(ent);
            OGRENCILISTESI();
        }
Example #11
0
        private void BtnKaydet_Click(object sender, EventArgs e)
        {
            ENTITYOGRENCI ent = new ENTITYOGRENCI();

            ent.AD       = TxtAd.Text;
            ent.SOYAD    = TxtSoyad.Text;
            ent.FOTOGRAF = TxtFotoğraf.Text;
            ent.KULUPID  = Convert.ToInt32(CmbKulup.SelectedValue);
            BLLOGRENCI.EKLE(ent);
            MessageBox.Show("Öğrenci Kaydı Yapıldı");
            OgrenciListesi();
        }
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            ENTITYOGRENCI ent = new ENTITYOGRENCI();

            ent.AD       = txtAd.Text;
            ent.SOYAD    = txtSoyad.Text;
            ent.FOTOGRAF = txtFoto.Text;
            ent.KULUPID  = Convert.ToInt16(cbKulüp.SelectedValue);
            BLLOGRENCI.EKLE(ent);
            MessageBox.Show("Öğrenci Kayıt İşlemi Tamamlandı");
            OgrenciListesi();
        }
Example #13
0
        private void BtnGuncelle_Click(object sender, EventArgs e)
        {
            ENTITYOGRENCI ent = new ENTITYOGRENCI();

            ent.AD       = TxtAd.Text;
            ent.SOYAD    = TxtSoyad.Text;
            ent.FOTOGRAF = TxtFotoğraf.Text;
            ent.KULUPID  = Convert.ToInt32(CmbKulup.SelectedValue);
            ent.ID       = Convert.ToInt32(txtID.Text);
            BLLOGRENCI.GUNCELLE(ent);
            MessageBox.Show("Öğrenci Bilgileri Güncellendi");
            OgrenciListesi();
        }
Example #14
0
        private void BtnKaydet_Click_1(object sender, EventArgs e)
        {
            //ENTITYOGRENCI sınıfından oluşturduğumuz ent nesnesi, doldurulan ilgili alanlardaki verileri, hafızaya alıp veri tabanına işlenmesi için BLL katmanı üzerinden, gerekli koşulların sağlanması durumunda FACADE katmanına gönderiyor.
            ENTITYOGRENCI ent = new ENTITYOGRENCI();

            ent.AD       = txtad.Text;
            ent.SOYAD    = txtsoyad.Text;
            ent.FOTOGRAF = txtfotograf.Text;
            ent.KULUPID  = Convert.ToInt16(cmbkulup.SelectedValue);
            BLLOGRENCI.EKLE(ent);
            MessageBox.Show("Ogrenci Kaydi Yapildi");
            OgrenciListesi();
        }
        public static int EKLE(ENTITYOGRENCI deger)
        {
            SqlCommand komut = new SqlCommand("OGRENCIEKLE", SQLBAGLANTISI.Baglanti);

            komut.CommandType = CommandType.StoredProcedure;
            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }
            komut.Parameters.AddWithValue("AD", deger.AD);
            komut.Parameters.AddWithValue("SOYAD", deger.SOYAD);
            komut.Parameters.AddWithValue("FOTOGRAF", deger.FOTOGRAF);
            komut.Parameters.AddWithValue("KULUPID", deger.KULUPID);
            return(komut.ExecuteNonQuery());
        }
Example #16
0
        private void btnOgrenciKaydet_Click(object sender, EventArgs e)
        {
            ENTITYOGRENCI entOgrenci = new ENTITYOGRENCI
            {
                AD       = txtAd.Text,
                SOYAD    = txtSoyad.Text,
                FOTOGRAF = txtFotograf.Text,
                KULUPID  = Convert.ToInt16(cmbKulup.SelectedValue)
            };

            var islemSonucu = BLLOGRENCI.EKLE(entOgrenci);

            ShowMessage(ReturnTrueFalse(islemSonucu), ResourcePresentation.OgrenciKaydetTrue, ResourcePresentation.OgrenciKaydetFalse);

            OgrenciListesi();
        }
Example #17
0
        //bu method etkilenmiş olan kayıt sayısı döndüreceği için int türünde tanımlama yaptık.
        public static int EKLE(ENTITYOGRENCI deger)
        {
            //SqlCommand sınıfından komut isimli bir nesne tanımlıyoruz.
            SqlCommand komut = new SqlCommand("OGRENCIEKLE", SQLBAGLANTISI.Baglanti);

            //tanımlanan komutun prosedür olduğunu tanıtıyoruz.
            komut.CommandType = CommandType.StoredProcedure;
            //Baglantı durumunu sorgulayıp sql bağlantısını tamamlıyoruz.
            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }
            //Eklenecek olan tablonun bütün değerlerini parametre olarak gönderiyoruz.
            komut.Parameters.AddWithValue("AD", deger.AD);
            komut.Parameters.AddWithValue("SOYAD", deger.SOYAD);
            komut.Parameters.AddWithValue("FOTOGRAF", deger.FOTOGRAF);
            komut.Parameters.AddWithValue("KULUPID", deger.KULUPID);
            //Etkilenen kayıt sayısını döndürecektir.
            return(komut.ExecuteNonQuery());
        }
Example #18
0
        private void btnKAYDET_Click(object sender, EventArgs e)
        {
            ENTITYOGRENCI ogr = new ENTITYOGRENCI();

            ogr.AD       = txtOGRAD.Text;
            ogr.SOYAD    = txtOGRSOYAD.Text;
            ogr.FOTOGRAF = txtOGRFOTO.Text;
            ogr.KULUPID  = Convert.ToInt16(cmbKULUP.SelectedValue);

            int kaydet = BLLOGRENCI.EKLE(ogr);

            if (kaydet > -1)
            {
                MessageBox.Show(ogr.AD + " " + ogr.SOYAD + " isimli öğrenci eklendi");
            }
            else
            {
                MessageBox.Show("Hatalı veya eksik giriş sebebiyle öğrenci eklenemedi");
            }
            OgrenciListesi();
        }
Example #19
0
        private void btnOgrenciGuncelle_Click(object sender, EventArgs e)
        {
            var id = 0;

            if (txtId.Text != "")
            {
                id = Convert.ToInt16(txtId.Text);
            }
            ENTITYOGRENCI entOgrenci = new ENTITYOGRENCI
            {
                ID       = id,
                AD       = txtAd.Text,
                SOYAD    = txtSoyad.Text,
                FOTOGRAF = txtFotograf.Text,
                KULUPID  = Convert.ToInt16(cmbKulup.SelectedValue)
            };

            var islemSonucu = BLLOGRENCI.GUNCELLE(entOgrenci);

            ShowMessage(islemSonucu, ResourcePresentation.OgrenciGuncelleTrue, ResourcePresentation.OgrenciGuncelleFalse);

            OgrenciListesi();
        }
Example #20
0
        private void btnGUNCELLE_Click(object sender, EventArgs e)
        {
            ENTITYOGRENCI ogr = new ENTITYOGRENCI();

            ogr.ID       = Convert.ToInt16(txtOGRID.Text);
            ogr.AD       = txtOGRAD.Text;
            ogr.SOYAD    = txtOGRSOYAD.Text;
            ogr.FOTOGRAF = txtOGRFOTO.Text;
            ogr.KULUPID  = Convert.ToInt16(cmbKULUP.SelectedValue);

            bool kaydet = BLLOGRENCI.GUNCELLE(ogr);

            if (kaydet)
            {
                MessageBox.Show(ogr.AD + " " + ogr.SOYAD + " isimli öğrencinin bilgileri güncellendi");
            }
            else
            {
                MessageBox.Show("Hatalı veya eksik giriş sebebiyle öğrencinin bilgileri güncellenemedi");
            }

            OgrenciListesi();
        }