예제 #1
0
        private void LoadStudents()
        {
            CetDb         db      = new CetDb();
            List <Course> courses = db.Courses.ToList();

            dgStudents.ItemsSource = courses;
        }
예제 #2
0
        private void LoadStudents()
        {
            CetDb          db       = new CetDb();
            List <Student> students = db.Students.ToList();  //tüm öğrencilerin hepsini görüyorum

            dgStudents.ItemsSource = students;
        }
예제 #3
0
        private void LoadStudents()
        {
            CetDb          db       = new CetDb();
            List <Student> students = db.Students.ToList();

            dgStudents.ItemsSource = students;
        }
예제 #4
0
        private void btnCourseUpdate_Click(object sender, RoutedEventArgs e)
        {
            Course course = grdCourse.SelectedItem as Course;

            if (course != null)
            {
                CetDb db        = new CetDb();
                var   coursenew = db.Courses.Find(course.Id);
                coursenew.Name       = txtCourseName.Text;
                coursenew.Code       = txtCourseCode.Text;
                coursenew.Credit     = Int32.Parse(txtCourseCredit.Text);
                coursenew.MaxStudent = Int32.Parse(txtMaxStudents.Text);
                db.SaveChanges();
                LoadCourses();
                MessageBox.Show(coursenew.Id + "Id'li ders güncellendi.");
                txtCourseCode.Text   = "";
                txtCourseCredit.Text = "";
                txtCourseName.Text   = "";
                txtMaxStudents.Text  = "";
            }
            else
            {
                MessageBox.Show("Güncellemek için Ders seçmelisin!");
            }
        }
예제 #5
0
        private void LoadCourses()
        {
            CetDb         db     = new CetDb();
            List <Course> course = db.Courses.ToList();

            dgCourses.ItemsSource = course;
        }
예제 #6
0
        private void LoadCourses()
        {
            CetDb         db      = new CetDb();
            List <Course> courses = db.Courses.ToList();

            grdCourse.ItemsSource = courses;
        }
예제 #7
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Course course = dgCourses.SelectedItem as Course;

            if (course != null)
            {
                CetDb db = new CetDb();
                db.Courses.Remove(course);
                db.SaveChanges();
                MessageBox.Show("Ders Silindi!");
                LoadCourses();
            }
            else
            {
                MessageBox.Show("Silmek için ders seçmelisin!");
            }
        }
예제 #8
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Student student = dgStudents.SelectedItem as Student;

            if (student != null)
            {
                CetDb db = new CetDb();
                db.Students.Remove(student);
                db.SaveChanges();
                MessageBox.Show("Öğrenci Silindi!");
                LoadStudents();
            }
            else
            {
                MessageBox.Show("Silmek için öğrenci seçmelisin!");
            }
        }
예제 #9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Student student = new Student();

            student.Name      = txtStudentName.Text;
            student.Surname   = txtStudentSurname.Text;
            student.BirthDate = dtpBirthDate.SelectedDate.Value;

            CetDb db = new CetDb();

            db.Students.Add(student);

            db.SaveChanges();
            MessageBox.Show("Öğrenci Kaydedildi.");
            lblStudentId.Content      = "";
            txtStudentName.Text       = "";
            txtStudentSurname.Text    = "";
            dtpBirthDate.SelectedDate = DateTime.Now;
            LoadStudents();
        }
예제 #10
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            Course course = dgStudents.SelectedItem as Course;

            if (course != null)
            {
                CetDb db        = new CetDb();
                var   coursenew = db.Courses.Find(course.Id);
                coursenew.Name   = txtCourseName.Text;
                coursenew.Quota  = txtCourseQuota.Text;
                coursenew.Credit = Convert.ToInt32(txtCourseId.Text);
                db.SaveChanges();
                LoadStudents();
                MessageBox.Show("Güncellendi.");
            }
            else
            {
                MessageBox.Show("güncellemek için ders seçmelisin!");
            }
        }
예제 #11
0
        private void btnCourseInsert_Click(object sender, RoutedEventArgs e)
        {
            Course course = new Course();

            course.Name       = txtCourseName.Text;
            course.Code       = txtCourseCode.Text;
            course.Credit     = Int32.Parse(txtCourseCredit.Text);
            course.MaxStudent = Int32.Parse(txtMaxStudents.Text);
            CetDb db = new CetDb();

            db.Courses.Add(course);

            db.SaveChanges();
            MessageBox.Show("Ders Kaydedildi");
            LoadCourses();
            txtCourseCode.Text   = "";
            txtCourseCredit.Text = "";
            txtCourseName.Text   = "";
            txtMaxStudents.Text  = "";
        }
예제 #12
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            Student student = dgStudents.SelectedItem as Student;

            if (student != null)
            {
                CetDb db         = new CetDb();
                var   studentnew = db.Students.Find(student.Id);
                studentnew.Name      = txtStudentName.Text;
                studentnew.Surname   = txtStudentSurname.Text;
                studentnew.BirthDate = dtpBirthDate.SelectedDate.Value;
                db.SaveChanges();
                LoadStudents();
                MessageBox.Show("Güncellendi.");
            }
            else
            {
                MessageBox.Show("güncellemek için öğrenci seçmelisin!");
            }
        }
예제 #13
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Student student = dgStudents.SelectedItem as Student;

            if (student != null)
            {
                CetDb db = new CetDb();
                db.Students.Remove(student);
                db.SaveChanges();
                MessageBox.Show("Öğrenci Silindi!");
                LoadStudents();
                lblStudentId.Content      = "";
                txtStudentName.Text       = "";
                txtStudentSurname.Text    = "";
                dtpBirthDate.SelectedDate = DateTime.Now;
            }
            else
            {
                MessageBox.Show("Silmek için öğrenci seçmelisin!");
            }
        }
예제 #14
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            Course course = dgCourses.SelectedItem as Course;

            if (course != null)
            {
                CetDb db        = new CetDb();
                var   coursenew = db.Courses.Find(course.Id);
                coursenew.Code   = txtCourseCode.Text;
                coursenew.Credit = Int32.Parse(txtCourseCredit.Text);
                coursenew.Quota  = Int32.Parse(txtCourseQuota.Text);

                db.SaveChanges();
                LoadCourses();
                MessageBox.Show("Güncellendi.");
            }
            else
            {
                MessageBox.Show("güncellemek için dersi seçmelisin!");
            }
        }
예제 #15
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Course course = new Course();

            course.Code   = txtCourseCode.Text;
            course.Credit = Int32.Parse(txtCourseCredit.Text);
            course.Quota  = Int32.Parse(txtCourseQuota.Text);

            CetDb db = new CetDb();

            db.Courses.Add(course);

            db.SaveChanges();
            MessageBox.Show("Ders Kaydedildi.");
            lblCourseId.Content  = "";
            txtCourseCode.Text   = "";
            txtCourseCredit.Text = "";
            txtCourseQuota.Text  = "";

            LoadCourses();
        }
예제 #16
0
        private void btnCourseDelete_Click(object sender, RoutedEventArgs e)
        {
            Course course = grdCourse.SelectedItem as Course;

            if (course != null)
            {
                CetDb db = new CetDb();
                db.Courses.Remove(course);
                db.SaveChanges();
                MessageBox.Show(course.Id + "Id'li Ders Silindi!");
                LoadCourses();
                txtCourseCode.Text   = "";
                txtCourseCredit.Text = "";
                txtCourseName.Text   = "";
                txtMaxStudents.Text  = "";
            }
            else
            {
                MessageBox.Show("Silmek için Ders seçmelisin!");
            }
        }
예제 #17
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Random random = new Random();
            Course Course = new Course();

            Course.Id     = Convert.ToInt32(txtCourseId.Text);
            Course.Name   = txtCourseName.Text;
            Course.Quota  = txtCourseQuota.Text;
            Course.Credit = Convert.ToInt32(txtCourseCredit.Text);

            CetDb db = new CetDb();

            db.Courses.Add(Course);

            db.SaveChanges();
            MessageBox.Show("Ders Eklendi.");
            txtCourseId.Text     = "";
            txtCourseName.Text   = "";
            txtCourseQuota.Text  = "";
            txtCourseCredit.Text = "";
            LoadStudents();
        }