protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Bind();
         int id  = DataConverter.CLng(Request.QueryString["id"]);
         int pid = DataConverter.CLng(Request.QueryString["pid"]);
         hfId.Value      = id.ToString();
         hfpaperId.Value = pid.ToString();
         if (id > 0)
         {
             liPaper.Text = "修改大题";
             Label1.Text  = "修改大题";
             M_Paper_Questions mpq = bpq.GetSelect(id);
             if (mpq != null && mpq.ID > 0)
             {
                 txt_name.Text        = mpq.QuestionTitle;
                 ddType.SelectedValue = mpq.QuestionType.ToString();
                 txtSubTitle.Text     = mpq.Subtitle;
                 txt_OrderBy.Text     = mpq.OrderBy.ToString();
                 txtCourse.Text       = mpq.Course.ToString();
                 txtNum.Text          = mpq.QuesNum.ToString();
                 txtRemark.Text       = mpq.Remark;
             }
         }
         else
         {
             liPaper.Text = "添加大题";
             Label1.Text  = "添加大题";
             DataTable dt = bpq.Select_PaperId(pid);
             if (dt != null)
             {
                 txt_OrderBy.Text = (dt.Rows.Count + 1).ToString();
             }
             else
             {
                 txt_OrderBy.Text = "1";
             }
         }
         Call.SetBreadCrumb(Master, "<li>教育模块</li><li><a href='QuestionManage.aspx'>在线考试系统</a></li><li>试卷管理</li><li>大题管理</li><li>" + liPaper.Text + "</li>");
     }
 }
Exemplo n.º 2
0
        private static M_Paper_Questions GetInfoFromReader(DbDataReader rdr)
        {
            M_Paper_Questions info = new M_Paper_Questions();

            info.ID            = DataConverter.CLng(rdr["ID"].ToString());
            info.QuestionTitle = rdr["QuestionTitle"].ToString();
            info.PaperID       = DataConverter.CLng(rdr["PaperID"].ToString());
            info.OrderBy       = DataConverter.CLng(rdr["OrderBy"].ToString());
            info.QuestionType  = DataConverter.CLng(rdr["QuestionType"].ToString());
            info.Subtitle      = rdr["Subtitle"].ToString();
            info.Course        = DataConverter.CDouble(rdr["Course"].ToString());
            info.QuesNum       = DataConverter.CLng(rdr["QuesNum"].ToString());
            info.Remark        = rdr["Remark"].ToString();
            info.QuestIDs      = rdr["QuestIDs"].ToString();
            info.CreateTime    = DataConverter.CDate(rdr["CreateTime"].ToString());
            info.AddUser       = DataConverter.CLng(rdr["AddUser"].ToString());
            rdr.Close();
            rdr.Dispose();
            return(info);
        }
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            int id = DataConverter.CLng(hfId.Value);
            M_Paper_Questions mpq = bpq.GetSelect(id);

            mpq.QuestionTitle = txt_name.Text;
            mpq.QuestionType  = DataConverter.CLng(ddType.SelectedValue);
            mpq.Remark        = txtRemark.Text;
            mpq.Subtitle      = txtSubTitle.Text;
            mpq.QuesNum       = DataConverter.CLng(txtNum.Text);
            mpq.OrderBy       = DataConverter.CLng(txt_OrderBy.Text);
            mpq.Course        = DataConverter.CDouble(txtCourse.Text);
            mpq.AddUser       = badmin.GetAdminLogin().AdminId;
            if (id > 0)
            {
                bool result = bpq.GetUpdate(mpq);
                if (result)
                {
                    function.WriteSuccessMsg("修改成功", "Paper_QuestionManage.aspx?pid=" + hfpaperId.Value);
                }
                else
                {
                    function.WriteErrMsg("修改失败");
                }
            }
            else
            {
                mpq.PaperID    = DataConverter.CLng(hfpaperId.Value);
                mpq.CreateTime = DateTime.Now;
                int ids = bpq.GetInsert(mpq);
                if (ids > 0)
                {
                    function.WriteSuccessMsg("添加成功", "Paper_QuestionManage.aspx?pid=" + hfpaperId.Value);
                }
                else
                {
                    function.WriteErrMsg("添加失败");
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 ///更新记录
 /// </summary>
 /// <param name="Paper_Questions"></param>
 /// <returns></returns>
 public bool GetUpdate(M_Paper_Questions model)
 {
     return(DBCenter.UpdateByID(model, model.ID));
 }
Exemplo n.º 5
0
 /// <summary>
 ///添加记录
 /// </summary>
 /// <param name="Paper_Questions"></param>
 /// <returns></returns>
 public int GetInsert(M_Paper_Questions model)
 {
     return(DBCenter.Insert(model));
 }