Esempio n. 1
0
        private void dataGridViewQuizMaker_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == dataGridViewQuizMaker.NewRowIndex || e.RowIndex < 0)
            {
                return;
            }

            //if (e.ColumnIndex == dataGridViewQuizMaker.Columns["Edit"].Index)
            //{
            //    var data = (QuizMakerModel)dataGridViewQuizMaker.Rows[e.RowIndex].DataBoundItem;

            //    QuizMaker quizMaker = new QuizMaker(data);
            //    quizMaker.lblQuizMakerID.Text = Convert.ToString(data.QuizMakerID);
            //    //quizMaker.cmbGrades.SelectedValue = data.GradeID;
            //    //quizMaker.cmbSubjects.SelectedValue = data.SubjectID;
            //    //quizMaker.txt .Text = data.MainTopicNumber;
            //    //lessonPlanner.txtTitleMainTopic.Text = data.TitleMainTopic;
            //    //lessonPlanner.txtIntroduction.Text = data.Introduction;
            //    //lessonPlanner.txtObjectives.Text = data.Objectives;
            //    //lessonPlanner.txtMaterial.Text = data.Material;

            //    quizMaker.Show();

            //    this.Close();
            //}
            //else if (e.ColumnIndex == dataGridViewQuizMaker.Columns["Delete"].Index)
            //{
            //    //Put some logic here, for example to remove row from your binding list.
            //    //yourBindingList.RemoveAt(e.RowIndex);

            //    // Or
            //    // var data = (Product)dataGridView1.Rows[e.RowIndex].DataBoundItem;
            //    // do something

            //    int rowCount = 0;
            //    long quizMakerID = Convert.ToInt64(dataGridViewQuizMaker.Rows[e.RowIndex].Cells["QuizMakerID"].Value);

            //    QuizMakerRepository quizMakerRepository = new QuizMakerRepository();
            //    //rowCount = lessonPlannerRepository.DeleteLessonPlannerByID(lessonPlannerID);

            //    if (rowCount > 0)
            //    {
            //        ShowStatus(true, "DELETE");
            //        BindGridViewQuizMaker();
            //    }
            //}
            //else
            if (e.ColumnIndex == dataGridViewQuizMaker.Columns["AddQuestions"].Index)
            {
                long             quizMakerID      = Convert.ToInt64(dataGridViewQuizMaker.Rows[e.RowIndex].Cells["QuizMakerID"].Value);
                AddMoreQuestions addMoreQuestions = new AddMoreQuestions(quizMakerID);
                addMoreQuestions.Show();
            }
            else if (e.ColumnIndex == dataGridViewQuizMaker.Columns["ViewQuestions"].Index)
            {
                long             quizMakerID      = Convert.ToInt64(dataGridViewQuizMaker.Rows[e.RowIndex].Cells["QuizMakerID"].Value);
                ShowAllQuestions showAllQuestions = new ShowAllQuestions(quizMakerID);
                showAllQuestions.Show();
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ShowAllQuestions showAllQuestions = new ShowAllQuestions();

            showAllQuestions.Show();
        }