⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 danxuan.aspx.cs

📁 本在线考试系统采用了面向对象的分析和设计
💻 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_DanXuan :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)
    {
        DanXuanContent danXuanContent = new DanXuanContent();

        WebHelper.AddChoiceFromRadioButtonList(AddRadioButtonList,danXuanContent);
        danXuanContent.Answer = WebHelper.GetAnswerFromRadioButtonList(AddRadioButtonList);
        danXuanContent.Content = AddContentTextBox.Text;

        bool addstatus = AddQuestion(danXuanContent);

        if (addstatus)
            AddMessageLabel.Text = "添加成功!";
        else
            AddMessageLabel.Text = "添加失败!";

    }
    protected void AddAddChoiceButton_Click(object sender, EventArgs e)
    {
        ListItem item = new ListItem();
        item.Text = AddChoiceTextBox.Text;
        AddRadioButtonList.Items.Add(item);
        item.Selected = true;
    }

    protected void AddRemoveChoiceButton_Click(object sender, EventArgs e)
    {
        AddRadioButtonList.Items.Remove(AddRadioButtonList.SelectedItem);
    }
    #endregion

    #region Update
    protected override void InitUpdateView()
    {
        DanXuanContent danXuanContent = (DanXuanContent)GetUpdateQuestion();

        UpdateHardDropDownList.SelectedIndex = ((int)danXuanContent.Hard - 1);
        UpdateContentTextBox.Text = danXuanContent.Content;

        WebHelper.SetRadioButtonListByDanXuan(UpdateRadioButtonList, danXuanContent);
        UpdateRadioButtonList.SelectedIndex = int.Parse(danXuanContent.Answer);
 
        MultiView1.SetActiveView(UpdateView);
    }
    protected void UpdateAddChoiceButton_Click(object sender, EventArgs e)
    {
        ListItem item = new ListItem();
        item.Text = UpdateChoiceTextBox.Text;
        UpdateRadioButtonList.Items.Add(item);
    }
    protected void UpdateRemoveChoiceButton_Click(object sender, EventArgs e)
    {
        
        UpdateRadioButtonList.Items.Remove(UpdateRadioButtonList.SelectedItem);
    }
    protected void UpdateUpdateButton_Click(object sender, EventArgs e)
    {

        DanXuanContent danXuanContent = (DanXuanContent)GetUpdateQuestion();
        danXuanContent.Answer = UpdateRadioButtonList.SelectedIndex.ToString();
        danXuanContent.Content = UpdateContentTextBox.Text;
        danXuanContent.Hard = (Hard)int.Parse(UpdateHardDropDownList.SelectedValue);
        danXuanContent.Choices.Clear();
        WebHelper.AddChoiceFromRadioButtonList(UpdateRadioButtonList, danXuanContent);

        bool updateStatus = UpdateQuestion(danXuanContent);

        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 + -