public void BolumBilgileriniGetir()
        {
            vtys6Entities db = new vtys6Entities();

            GridViewBolum.DataSource = db.tBolums.ToList();
            GridViewBolum.DataBind();
        }
        public void FakulteBilgileriniGetir()
        {
            vtys6Entities db = new vtys6Entities();

            GridViewFakulte.DataSource = db.tFakultes.ToList();
            GridViewFakulte.DataBind();
        }
        public void OgrenciBilgileriniGetir()
        {
            vtys6Entities db = new vtys6Entities();

            GridViewOgrenci.DataSource = db.tOgrencis.ToList();
            GridViewOgrenci.DataBind();
        }
Beispiel #4
0
 protected void ButtonFakulteEkle_Click(object sender, EventArgs e)
 {
     try
     {
         vtys6Entities db      = new vtys6Entities();
         tFakulte      fakulte = new tFakulte();
         fakulte.fakulteAd = TextBoxFakulteAdi.Text.ToString();
         db.tFakultes.Add(fakulte);
         db.SaveChanges();
         errorLabel.Text = "Kayıt Başarılı";
         FakulteBilgileriniGetir();
     }
     catch (Exception) {
         errorLabel.Text = "Kayıt Başarısız.";
     }
 }
 protected void ButtonFakulteSil_Click(object sender, EventArgs e)
 {
     try
     {
         vtys6Entities db      = new vtys6Entities();
         tFakulte      fakulte = new tFakulte();
         int           id      = Convert.ToInt32(TextBoxFakulteId.Text);
         var           sorgu   = db.tFakultes.Where(w => w.fakulteID == id).FirstOrDefault();
         db.tFakultes.Remove(sorgu);
         db.SaveChanges();
         errorLabel.Text = "Başarılı";
         FakulteBilgileriniGetir();
     }
     catch (Exception)
     {
         errorLabel.Text = " Başarısız.";
     }
 }
 protected void ButtonBolumEkle_Click(object sender, EventArgs e)
 {
     try
     {
         vtys6Entities db    = new vtys6Entities();
         tBolum        bolum = new tBolum();
         bolum.bolumAd   = TextBoxBolumAdi.Text;
         bolum.fakulteID = Int32.Parse(DropDownListFakulte.SelectedValue);
         db.tBolums.Add(bolum);
         db.SaveChanges();
         errorLabel.Text = "Kayıt Başarılı";
         BolumBilgileriniGetir();
     }
     catch (Exception)
     {
         errorLabel.Text = "Kayıt Başarısız.";
     }
 }
        protected void ButtonFakulteGuncelle_Click(object sender, EventArgs e)
        {
            try
            {
                vtys6Entities db      = new vtys6Entities();
                tFakulte      fakulte = new tFakulte();

                int      id    = Convert.ToInt32(TextBoxFakulteId.Text);
                tFakulte sorgu = (from f in db.tFakultes where f.fakulteID == id select f).First();
                sorgu.fakulteAd = TextBoxFakulteAd.Text;
                db.SaveChanges();
                errorLabel.Text = "Başarılı";
                FakulteBilgileriniGetir();
            }
            catch (Exception)
            {
                errorLabel.Text = " Başarısız.";
            }
        }
Beispiel #8
0
 protected void ButtonOgrenciSorgula_Click(object sender, EventArgs e)
 {
     try
     {
         vtys6Entities db         = new vtys6Entities();
         int           ogrenciKey = int.Parse(TextBoxOgrenciID.Text.ToString());
         var           query      = from o in db.tOgrencis
                                    join b in db.tBolums on o.bolumID equals b.bolumID
                                    join f in db.tFakultes on b.fakulteID equals f.fakulteID
                                    where o.ogrenciID == ogrenciKey
                                    select new { o.ogrenciID, o.ad, o.soyad, b.bolumAd, f.fakulteAd };
         GridViewOgrenci.DataSource = query.ToList();
         GridViewOgrenci.DataBind();
     }
     catch (Exception)
     {
         errorLabel.Text = "Hata Oluştu";
     }
 }
 protected void ButtonOgrenciEkle_Click(object sender, EventArgs e)
 {
     try
     {
         vtys6Entities db      = new vtys6Entities();
         tOgrenci      ogrenci = new tOgrenci();
         ogrenci.ad      = TextBoxOgrenciAd.Text;
         ogrenci.soyad   = TextBoxOgrenciSoyad.Text;
         ogrenci.bolumID = Int32.Parse(DropDownListBolum.SelectedValue);
         db.tOgrencis.Add(ogrenci);
         db.SaveChanges();
         errorLabel.Text = "Kayıt Başarılı";
         OgrenciBilgileriniGetir();
     }
     catch (Exception)
     {
         errorLabel.Text = "Kayıt Başarısız.";
     }
 }