public void gridShow() { table = new DataTable(); table.Columns.Add("Ad", typeof(string)); table.Columns.Add("Soyad", typeof(string)); table.Columns.Add("ÖğrenciNo", typeof(string)); table.Columns.Add("Tc", typeof(string)); table.Columns.Add("Bölüm", typeof(string)); table.Columns.Add("AldığıDers", typeof(string)); table.Columns.Add("Öğretmen", typeof(string)); int sayac = 0; HelperLesson hl = new HelperLesson(); HelperStudent hs = new HelperStudent(); HelperDepartment hd = new HelperDepartment(); var list = hs.StudentList(Convert.ToInt32(active.aktif)); foreach (var item in list) { var list2 = hs.GetLessons(item.OgrId, Convert.ToInt32(style.ogrenci)); foreach (var item2 in list2) { var list3 = hl.GetLessonList(Convert.ToInt32(style.ogretmen), Convert.ToInt32(active.aktif), item2.Ders.DersId); foreach (var item3 in list3) { var b = hd.GetDepartment(item3.Ogretmen.BolumId.Value); table.Rows.Add(item.Ad, item.Soyad, item.OgrNo, item.Tc, b.BolumAdi, item2.Ders.DersAdi, item3.Ogretmen.OgretmenAdi); dataGridView1.DataSource = table; } sayac++; } } }
public void StudentgridShow() { DgOgrenci.Rows.Clear(); string cinsiyet; sayac = 0; var st = h.StudentList(Convert.ToInt32(active.aktif)); if (st != null) { foreach (var item in st) { var u = hu.GetUser(item.OgrId, Convert.ToInt32(style.ogrenci)); if (item.Cinsiyet == Convert.ToByte(gender.kız)) { cinsiyet = gender.kız.ToString(); } else { cinsiyet = gender.erkek.ToString(); } DgOgrenci.Rows.Add(); DgOgrenci.Rows[sayac].Cells[0].Value = item.OgrId; DgOgrenci.Rows[sayac].Cells[1].Value = item.OgrNo; DgOgrenci.Rows[sayac].Cells[2].Value = item.Ad; DgOgrenci.Rows[sayac].Cells[3].Value = item.Soyad; DgOgrenci.Rows[sayac].Cells[4].Value = item.Tc; DgOgrenci.Rows[sayac].Cells[5].Value = item.DogumTarih.Value.ToShortDateString(); DgOgrenci.Rows[sayac].Cells[6].Value = cinsiyet; DgOgrenci.Rows[sayac].Cells[7].Value = item.Email; DgOgrenci.Rows[sayac].Cells[8].Value = item.Bolum.FakulteAdi; DgOgrenci.Rows[sayac].Cells[9].Value = item.Bolum.BolumAdi; DgOgrenci.Rows[sayac].Cells[10].Value = u.Password; sayac++; } } else { MessageBox.Show("Listelenecek Öğrenci Mevcut Değil.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }