Exemplo n.º 1
0
        private List <M_Exam_Type> GetTypeBySql(string sql)
        {
            List <M_Exam_Type> mqts;
            DataSet            ds = SqlHelper.ExecuteDataSet(CommandType.Text, sql);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                mqts = new List <M_Exam_Type>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    M_Exam_Type mqt = new M_Exam_Type();
                    mqt.t_id         = DataConverter.CLng(dr["t_id"].ToString());
                    mqt.t_name       = dr["t_name"].ToString();
                    mqt.t_type       = DataConverter.CLng(dr["t_type"].ToString());
                    mqt.t_remark     = dr["t_remark"].ToString();
                    mqt.t_createtime = DataConverter.CDate(dr["t_createtime"].ToString());
                    mqt.t_creatuser  = DataConverter.CLng(dr["t_creatuser"].ToString());
                    mqts.Add(mqt);
                }
                return(mqts);
            }
            else
            {
                return(new List <M_Exam_Type>());
            }
        }
Exemplo n.º 2
0
        protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Tips.Text = "<font color='red'>请输入个数</font>";
            int type = DataConverter.CLng(ddlType.SelectedValue);

            tip.Visible = false;
            M_Exam_Type mqt = bqt.GetSelectById(type);

            //单选,多选,判断,填空,问答,组合
            switch (mqt.t_type)
            {
            case 1:
                ddlNumber1.SelectedValue = "4";
                break;

            case 2:
                ddlNumber1.SelectedValue = "4";
                break;

            case 4:
                ddlNumber1.SelectedValue = "1";
                tip.Visible = true;
                break;

            default:
                break;
            }
            option();
        }
Exemplo n.º 3
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            int         id  = DataConverter.CLng(hftid.Value);
            M_Exam_Type mqt = bqt.GetSelectById(id);

            mqt.t_type      = DataConverter.CLng(ddType.SelectedValue);
            mqt.t_remark    = txtRemark.Text;
            mqt.t_name      = txt_name.Text;
            mqt.t_creatuser = badmin.GetAdminLogin().AdminId;
            if (id > 0)
            {
                bool result = bqt.GetUpdate(mqt);
                if (result)
                {
                    function.WriteSuccessMsg("修改成功!", "QuestionTypeManage.aspx");
                }
                else
                {
                    function.WriteErrMsg("修改失败!");
                }
            }
            else
            {
                mqt.t_createtime = DateTime.Now;
                int ids = bqt.GetAdd(mqt);
                if (ids > 0)
                {
                    function.WriteSuccessMsg("添加成功!", "QuestionTypeManage.aspx");
                }
                else
                {
                    function.WriteErrMsg("添加失败!");
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取内容
        /// </summary>
        /// <returns></returns>
        private string[] GetContent()
        {
            string[]    result = new string[2];
            int         type   = DataConverter.CLng(ddlType.SelectedValue);
            M_Exam_Type mqt    = bqt.GetSelectById(type);
            int         num    = DataConverter.CLng(ddlNumber1.SelectedValue);

            //单选,多选,判断,填空,问答,组合
            switch (mqt.t_type)
            {
            case 1:
                result[0] = Request.Form["option"];
                result[1] = Request.Form["anws"];
                break;

            case 2:
                result[0] = Request.Form["option"];
                result[1] = Request.Form["anws"];
                break;

            case 3:
                result[0] = "";
                result[1] = Request.Form["anws"];
                break;

            case 4:
                result[0] = "";
                result[1] = Request.Form["amws"] + "&" + Request.Form["curse"];
                break;

            case 5:
                result[0] = "";
                result[1] = Request.Form["option"] + "&" + Request.Form["key"] + "&" + Request.Form["course"];
                break;

            case 6:
                break;
            }
            return(result);
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     function.AccessRulo();
     if (!IsPostBack)
     {
         int id = DataConverter.CLng(Request.QueryString["id"]);
         if (id > 0)
         {
             liQuestionType.Text = "修改题型";
             Label1.Text         = "修改题型";
             hftid.Value         = id.ToString();
             M_Exam_Type mqt = bqt.GetSelectById(id);
             txt_name.Text        = mqt.t_name;
             txtRemark.Text       = mqt.t_remark;
             ddType.SelectedValue = mqt.t_type.ToString();
         }
         else
         {
             liQuestionType.Text = "添加题型";
             Label1.Text         = "添加题型";
         }
         Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li> <li><a href='Papers_System_Manage.aspx'>教育模块</a></li> <li><a href='QuestionManage.aspx'>考试管理</a></li> <li><a href='QuestionTypeManage.aspx'>题型管理</a></li><li>修改题型</li>");
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// 试题题型选择:页面显示
        /// </summary>
        private void option()
        {
            string option = hfoption.Value;
            string answer = hfanw.Value;

            int type = DataConverter.CLng(ddlType.SelectedValue);

            string[]    str = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" };
            M_Exam_Type mqt = bqt.GetSelectById(type);
            int         num = DataConverter.CLng(ddlNumber1.SelectedValue);

            string[] options = option.Split(',');
            string[] answers = answer.Split(',');

            string opt  = "";
            string anws = "";

            //单选,多选,判断,填空,问答,组合
            switch (mqt.t_type)
            {
            case 1:                  //单选
                ddlNumber1.Visible  = true;
                Tips.Visible        = true;
                optionDiv.Visible   = true;
                anwDiv.Visible      = true;
                optionDiv.InnerHtml = "";
                anwDiv.InnerHtml    = "";
                Tips.Text          += "<font color='red'>&nbsp;注意:以下信息请不要输入','(逗号)</font>";
                for (int i = 0; i < num; i++)
                {
                    if (i < options.Length)
                    {
                        opt = options[i];
                    }
                    else
                    {
                        opt = "";
                    }
                    optionDiv.InnerHtml += str[i] + ": <textarea name='option' id='option" + i + "' style='width:400px;height:43px'>" + opt + "</textarea><br/>";
                    if (str[i] == answer)
                    {
                        anws = "checked='checked'";
                    }
                    else
                    {
                        anws = "";
                    }
                    anwDiv.InnerHtml += str[i] + "<input type='radio' id='anw" + i + "' name='anws' value='" + str[i] + "' " + anws + " />";
                }
                break;

            case 2:           //多选
                ddlNumber1.Visible  = true;
                Tips.Visible        = true;
                Tips.Text          += "<font color='red'>&nbsp;注意:以下信息请不要输入','(逗号)</font>";
                optionDiv.Visible   = true;
                anwDiv.Visible      = true;
                optionDiv.InnerHtml = "";
                anwDiv.InnerHtml    = "";
                for (int i = 0; i < num; i++)
                {
                    if (i < options.Length)
                    {
                        opt = options[i];
                    }
                    else
                    {
                        opt = "";
                    }
                    optionDiv.InnerHtml += str[i] + ": <textarea name='option' id='option" + i + "' style='width:400px;height:43px' >" + opt + "</textarea><br/>";
                    if (answer.IndexOf(str[i]) > -1)
                    {
                        anws = "checked='checked'";
                    }
                    else
                    {
                        anws = "";
                    }
                    anwDiv.InnerHtml += str[i] + "<input type='checkbox' id='anw" + i + "' name='anws'  value='" + str[i] + "' " + anws + "/>  ";
                }
                break;

            case 3:      //判段
                ddlNumber1.Visible = false;
                Tips.Visible       = false;
                optionDiv.Visible  = false;
                anwDiv.Visible     = true;
                if (answer == "0")
                {
                    anwDiv.InnerHtml = "<input type='radio' id='anw1' name='anws' value='0' checked='checked'/>错误&nbsp;<input type='radio' id='anw2' name='anws' value='1'  />正确 ";
                }
                else
                {
                    anwDiv.InnerHtml = "<input type='radio' id='anw1' name='anws' value='0' />错误&nbsp;<input type='radio' id='anw2' name='anws' value='1' checked='checked' />正确 ";
                }
                break;

            default:
                break;
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 修改题型
 /// </summary>
 /// <param name="mqt"></param>
 /// <returns></returns>
 public bool GetUpdate(M_Exam_Type model)
 {
     return(DBCenter.UpdateByID(model, model.t_id));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="mqt"></param>
 /// <returns></returns>
 public int GetAdd(M_Exam_Type model)
 {
     return(DBCenter.Insert(model));
 }