📄 tiankong.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ExaminationSystem.BLL.Service;
using ExaminationSystem.BLL.Domain;
public partial class Admin_TianKong : QuestionPage
{
#region Add
protected override void InitAddView(Chapter addChapter, Hard addHard)
{
MultiView1.SetActiveView(AddView);
AddSubjectLabel.Text = addChapter.Subject.Name;
AddChapterLabel.Text = addChapter.Name;
AddHardLabel.Text = addHard.ToString();
}
protected void AddAddQuestionButton_Click(object sender, EventArgs e)
{
if (TianKongContent.IsBlankAnswerMatch(AddContentTextBox.Text, AddAnswerTextBox.Text)==false)
{
AddMessageLabel.Text = "填空数和答案不匹配!";
return;
}
TianKongContent tianKongContent = new TianKongContent();
tianKongContent.Answer = AddAnswerTextBox.Text;
tianKongContent.Content = AddContentTextBox.Text;
bool addstatus = AddQuestion(tianKongContent);
if (addstatus)
AddMessageLabel.Text = "添加成功!";
else
AddMessageLabel.Text = "添加失败!";
}
#endregion
#region Update
protected override void InitUpdateView()
{
TianKongContent tianKongContent = (TianKongContent)GetUpdateQuestion();
UpdateHardDropDownList.SelectedIndex = ((int)tianKongContent.Hard - 1);
UpdateContentTextBox.Text = tianKongContent.Content;
UpdateAnswerTextBox.Text = tianKongContent.Answer;
MultiView1.SetActiveView(UpdateView);
}
protected void UpdateUpdateButton_Click(object sender, EventArgs e)
{
if (TianKongContent.IsBlankAnswerMatch(UpdateContentTextBox.Text, UpdateAnswerTextBox.Text) == false)
{
AddMessageLabel.Text = "填空数和答案不匹配!";
return;
}
TianKongContent tianKongContent = (TianKongContent)GetUpdateQuestion();
tianKongContent.Answer = UpdateAnswerTextBox.Text;
tianKongContent.Content = UpdateContentTextBox.Text;
tianKongContent.Hard = (Hard)int.Parse(UpdateHardDropDownList.SelectedValue);
bool updateStatus = UpdateQuestion(tianKongContent);
if (updateStatus)
UpdateMessageLabel.Text = "更新成功!";
else
UpdateMessageLabel.Text = "更新失败!";
}
#endregion
#region Delete
protected override void InitDeleteView()
{
DeleteMessageLabel.Text = DeleteQuestion();
MultiView1.SetActiveView(DeleteView);
}
#endregion
#region View
protected override void InitViewView()
{
ViewContentLiteral.Text = GetViewQuestionHtml();
MultiView1.SetActiveView(ViewView);
}
#endregion
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -