コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (validateentry())
                {
                    clsmodule.Coursecode   = txtCourseCode.Text.ToUpper();
                    clsmodule.CourseTitle  = txtTitle.Text.ToUpper();
                    clsmodule.Semester     = int.Parse(cmbSemester.SelectedValue.ToString());
                    clsmodule.FacultyID    = int.Parse(cmbFaculty.SelectedValue.ToString());
                    clsmodule.Level        = int.Parse(cmbLevel.SelectedValue.ToString());
                    clsmodule.Description  = txtDescription.Text;
                    clsmodule.Created_By   = ClsUserSetting.Usersetting;
                    clsmodule.DepartmentId = int.Parse(cmbDepartment.SelectedValue.ToString());
                    clsmodule.courseunit   = int.Parse(cmbcourseunit.SelectedValue.ToString());
                    clsmodule.coursetype   = int.Parse(cmbcoursetype.SelectedValue.ToString());

                    clsmodule.newCourse();

                    message = txtCourseCode.Text + " Successfully saved";
                    //MessageBox.Show(message);
                    //clearentry();
                    if (clsmodule.Status == 1)
                    {
                        MessageBox.Show(message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        clearentry();
                    }
                    else
                    {
                        MessageBox.Show(txtCourseCode.Text + " 0r" + txtTitle.Text + "already exists", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }