예제 #1
0
        private void Btn_DeleteQuestion_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = System.Windows.MessageBox.Show("Are you sure you want to delete the Question", "Delete Question", MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                XmlDocument docu = new XmlDocument();
                docu.Load("Questions.xml");
                foreach (XmlNode x in docu.SelectNodes("ArrayOfQuestion/Question"))
                {
                    if (x.SelectSingleNode("QuestionId").InnerText == Questionid.Text)
                    {
                        x.ParentNode.RemoveChild(x);
                        docu.Save("Questions.xml");
                    }
                }
                var manageQuestion = new ManageQuestion();
                manageQuestion.Show();
                this.Close();
                break;

            case MessageBoxResult.No:

                break;
            }
        }
예제 #2
0
        private void Btn_ManageQuestions_Click(object sender, RoutedEventArgs e)
        {
            var mainwindow = new MainWindow();

            mainwindow.Close();

            var managequestions = new ManageQuestion();

            managequestions.Show();
            this.Close();
        }
예제 #3
0
        private void Btn_UpdateQuestion_Click(object sender, RoutedEventArgs e)
        {
            var pro      = DbUtility.ReadXml <ObservableCollection <Question> >("Questions.xml");
            var question = new ObservableCollection <Question>();
            var qs       = pro.First(f => f.QuestionId == Questionid.Text);

            qs.QuestionTitle   = Question.Text;
            qs.OptionA         = OptionA.Text;
            qs.OptionB         = OptionB.Text;
            qs.OptionC         = OptionC.Text;
            qs.OptionD         = OptionD.Text;
            qs.CorectionAnswer = CorrectAnswer.Text;
            DbUtility.WriteXml <ObservableCollection <Question> >(pro, "Questions.xml");
            MessageBox.Show("Question Successfully Updated");
            var manageQuestion = new ManageQuestion();

            manageQuestion.Show();
            this.Close();
        }