using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;

using Entity;
using BLL;

public partial class Admin_Paper_SubjectOfSimpleAnswerList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RoleCheck.DenyLogin();
    }

    protected void ObjectDataSource1_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        List<SubjectOfSimpleAnswer> list = (List<SubjectOfSimpleAnswer>)e.ReturnValue;
        lblRecorderSum.Text = list.Count.ToString();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        List<int> idList = new List<int>();
        for (int i = 0; i < rptSubjectOfSimpleAnswerList.Items.Count; i++)
        {
            CheckBox tb = (CheckBox)rptSubjectOfSimpleAnswerList.Items[i].FindControl("CheckBox1");
            if (tb.Checked)
            {
                HiddenField hf = (HiddenField)rptSubjectOfSimpleAnswerList.Items[i].FindControl("HiddenField1");
                idList.Add(Convert.ToInt32(hf.Value));
            }
        }

        if (idList.Count > 0)
        {
            List<SubjectOfSimpleAnswer> list = new BLLSubjectOfSimpleAnswer().GetSubjectList(idList);
            SessionClass.SetSimpleAnswer(list);
        }
        else
            SessionClass.SetSimpleAnswer(null);

        Response.Redirect("AddPaperByManualSelection.aspx");
    }
    protected void drpSubjectTypeCategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        rptSubjectOfSimpleAnswerList.DataBind();
    }
}
