示例#1
0
        private void materialFlatButton4_Click(object sender, EventArgs e)
        {
            Course course = new Course();

            course.name   = txtCourseName.Text;
            course.months = Convert.ToDecimal(txtCourseMont.Text);
            course.price  = Convert.ToDecimal(txtCoursePrice.Text);
            course.type   = Convert.ToInt32(cbbType.SelectedValue);

            courseDAO.create(course);
            cbbType.SelectedIndex = -1;
            GetSource.getTableSource(CourseDAO.READ_ALL, dgvCourse);
            MessageBox.Show("Created", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Diary dia = new Diary();

            dia.account     = curent.id;
            dia.date        = DateTime.Today;
            dia.description = "Create new course " + course.name;
            diaryDAO.create(dia);
            GetSource.getTableSource(DiaryDAO.READ_ALL, dgvLog);
        }