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

            dgStudents.ItemsSource = courses;
        }
Exemple #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;
        }
Exemple #3
0
        private void LoadStudents()
        {
            CetDb          db       = new CetDb();
            List <Student> students = db.Students.ToList();

            dgStudents.ItemsSource = students;
        }
        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!");
            }
        }
Exemple #5
0
        private void LoadCourses()
        {
            CetDb         db     = new CetDb();
            List <Course> course = db.Courses.ToList();

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

            grdCourse.ItemsSource = courses;
        }
Exemple #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!");
            }
        }
        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!");
            }
        }
Exemple #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();
        }
Exemple #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!");
            }
        }
        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  = "";
        }
        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!");
            }
        }
Exemple #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!");
            }
        }
Exemple #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!");
            }
        }
Exemple #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();
        }
        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!");
            }
        }
Exemple #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();
        }