Exemplo n.º 1
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!");
            }
        }
Exemplo n.º 2
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!");
            }
        }
Exemplo n.º 3
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!");
            }
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
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!");
            }
        }
Exemplo n.º 6
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  = "";
        }
Exemplo n.º 7
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!");
            }
        }
Exemplo n.º 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();
                lblStudentId.Content      = "";
                txtStudentName.Text       = "";
                txtStudentSurname.Text    = "";
                dtpBirthDate.SelectedDate = DateTime.Now;
            }
            else
            {
                MessageBox.Show("Silmek için öğrenci seçmelisin!");
            }
        }
Exemplo n.º 9
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!");
            }
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
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!");
            }
        }
Exemplo n.º 12
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();
        }