コード例 #1
0
ファイル: InfoCourse.cs プロジェクト: Fortlock/CoursesDBApp
        private void CallDelForm_Click(object sender, EventArgs e)
        {
            string       name = ((Button)sender).Name;
            DialogResult res;

            Enabled = false;
            switch (name)
            {
            case "CallDTopicForm":
            {
                res = MessageBox.Show(
                    "Are you sure?",
                    "Delete topic",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning);
                if (res == DialogResult.Yes)
                {
                    CoursesRequests.DelTopic((int)(TopicsGridView.SelectedRows[0].Cells[0].Value));
                }
                break;
            }

            case "CallDBTeacherForm":
            {
                res = MessageBox.Show(
                    "Are you sure?",
                    "Delete bind teacher",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning);
                if (res == DialogResult.Yes)
                {
                    CoursesRequests.DelBindTeacherToCourse((int)(TeachersGridView.SelectedRows[0].Cells[0].Value));
                }
                break;
            }

            case "CallDBStudentForm":
            {
                res = MessageBox.Show(
                    "Are you sure?",
                    "Delete student",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Warning);
                if (res == DialogResult.Yes)
                {
                    CoursesRequests.DelBindStudentToCourse((int)(StudentsGridView.SelectedRows[0].Cells[0].Value));
                }
                break;
            }
            }
            Enabled = true;
        }
コード例 #2
0
        private void CallDBTeacherForm_Click(object sender, EventArgs e)
        {
            DialogResult res;

            Enabled = false;
            res     = MessageBox.Show(
                "Are you sure?",
                "Delete bind course",
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Warning);
            if (res == DialogResult.Yes)
            {
                CoursesRequests.DelBindTeacherToCourse((int)(CoursesGridView.SelectedRows[0].Cells[0].Value));
            }
            Enabled = true;
        }