private void btn_Save_Click(object sender, EventArgs e)
{
QuestionBL questionBl = new QuestionBL();
Question question = new Question();
Answer answer = new Answer();
if (txt_ContentQuestion.Text.Trim() == "" || txt_ContentAnswer.Text.Trim() == "")
{
if (txt_ContentQuestion.Text.Trim() == "")
{
MessageBox.Show("Câu hỏi không được rỗng. Vui lòng nhập thông tin câu hỏi trước khi lưu.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("Đáp án không được rỗng. Vui lòng nhập thông tin đáp án trước khi lưu.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
else
{
//Update question
question.NameQuestion = txt_ContentQuestion.Text.Trim();
question.IDQuestion = IDQuestion;
questionBl.EditQuestionbyID(question);
//Update answer
answer.IDQuestion = IDQuestion;
answer.ContentAnswer = txt_ContentAnswer.Text.Trim();
//answer.IsCorrect = true;
answer.Check = 1;
questionBl.EditAnswerbyID(answer);
//Show notify
//notifyIcon1.Icon = SystemIcons.Information;
//notifyIcon1.BalloonTipText = "Chỉnh sửa câu hỏi thành công";
//notifyIcon1.ShowBalloonTip(2000);
//Close form
Form FindForm = this.FindForm();
FindForm.Close();
}
}