示例#1
0
文件: data.aspx.cs 项目: Hizcy/exam
 //添加
 public void addquestionmenu(int questionId, string name, int pass, int ismust)
 {
     try
     {
         Exam.Entity.tb_QuestionClsEntity model = new Exam.Entity.tb_QuestionClsEntity();
         UserIdentity identity = User.Identity as UserIdentity;
         if (identity != null)
         {
             model.SchoolId    = 0;//identity._schoolID;
             model.ParentId    = questionId;
             model.Name        = name;
             model.Description = name;
             model.Status      = 1;
             model.Addtime     = DateTime.Now;
             model.Updatetime  = DateTime.Now;
             model.IsMust      = ismust;
             model.Score       = pass;
             Exam.BLL.tb_QuestionClsBLL.GetInstance().Insert(model);
             Response.Write("1");
         }
     }
     catch (Exception ex)
     {
         Jnwf.Utils.Log.Logger.Log4Net.Error("data.aspx.cs,addquestionmenu,ex:" + ex.Message + "|" + ex.StackTrace);
         Response.Write("error");
     }
 }
示例#2
0
 protected void btnexcel_Click(object sender, EventArgs e)
 {
     if (identity != null)
     {
         string where = "";
         if (hid.Text.Trim() != "")
         {
             Exam.Entity.tb_QuestionClsEntity model = Exam.BLL.tb_QuestionClsBLL.GetInstance().GetAdminSingle(int.Parse(hid.Text.Trim()));
             if (model.ParentId != 0)
             {
                 where += " and ParentId =" + hid.Text.Trim();
                 DataSet tds = Exam.BLL.tb_QuestionBLL.GetInstance().GetList("schoolid=" + 0 + where);
                 gvlistbrary.DataSource = tds;
                 gvlistbrary.DataBind();
                 if (gvlistbrary.Rows.Count > 0)
                 {
                     //调用导出方法
                     GridViewToExcel(gvlistbrary, DateTime.Now.Ticks + ".xls");
                 }
                 return;
             }
         }
         if (!string.IsNullOrEmpty(hid.Text.Trim()))
         {
             where += " and QuestionClsId =" + hid.Text.Trim();
         }
         //难度
         if (int.Parse(dllharde.SelectedItem.Value) != -1)
         {
             where += " and Isdifficulty =" + dllharde.SelectedValue;
         }
         //状态
         if (int.Parse(dllstatus.SelectedItem.Value) != -1)
         {
             where += " and Status=" + dllstatus.SelectedValue;
         }
         //单选
         if (int.Parse(dlltype.SelectedItem.Value) != -1)
         {
             where += " and Type=" + dlltype.SelectedValue;
         }
         DataSet ds = Exam.BLL.tb_QuestionBLL.GetInstance().GetList("schoolid=" + 0 + where);
         gvlistbrary.DataSource = ds;
         gvlistbrary.DataBind();
         if (gvlistbrary.Rows.Count > 0)
         {
             //调用导出方法
             GridViewToExcel(gvlistbrary, DateTime.Now.Ticks + ".xls");
         }
         else
         {
             MessageBox.Show(this, "没有数据可导出,请先查询数据!");
         }
     }
 }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Exam.Entity.tb_QuestionClsEntity model = Exam.BLL.tb_QuestionClsBLL.GetInstance().GetAdminSingle(tkid);
         if (model != null)
         {
             name = model.Name;
             IList <Exam.Entity.tb_QuestionClsEntity> list = Exam.BLL.tb_QuestionClsBLL.GetInstance().Gettb_QuestionClsListParentIdTow(model.QuestionClsId);
             if (list != null && list.Count > 0)
             {
                 listboxManage.DataSource     = list;
                 listboxManage.DataTextField  = "name";
                 listboxManage.DataValueField = "questionclsid";
                 listboxManage.DataBind();
             }
         }
     }
 }
示例#4
0
文件: data.aspx.cs 项目: Hizcy/exam
 //修改
 public void enditquestionmenu(int questionId, string name, int pass, int ismust)
 {
     try
     {
         Exam.Entity.tb_QuestionClsEntity model = Exam.BLL.tb_QuestionClsBLL.GetInstance().GetAdminSingle(questionId);
         if (model != null)
         {
             model.IsMust = ismust;
             model.Score  = pass;
             model.Name   = name;
             Exam.BLL.tb_QuestionClsBLL.GetInstance().Update(model);
             Response.Write("1");
         }
     }
     catch (Exception ex)
     {
         Jnwf.Utils.Log.Logger.Log4Net.Error("data.aspx.cs,enditquestionmenu,ex:" + ex.Message + "|" + ex.StackTrace);
         Response.Write("error");
     }
 }
示例#5
0
 private void BindData()
 {
     try
     {
         UserIdentity identity = User.Identity as UserIdentity;
         if (identity != null)
         {
             Exam.Entity.tb_QuestionEntity model = Exam.BLL.tb_QuestionBLL.GetInstance().GetAdminSingle(questionid);
             model.SchoolId = identity._schoolID;
             if (model != null)
             {
                 //在修改题库时隐藏上面的两个按钮
                 this.divn.Style.Add("display", "none");
                 this.divnn.Style.Add("display", "none");
                 hidid.Text    = model.Type.ToString();
                 questionclsid = model.QuestionClsId;
                 Exam.Entity.tb_QuestionClsEntity temp = Exam.BLL.tb_QuestionClsBLL.GetInstance().GetAdminSingle(model.QuestionClsId);
                 if (temp != null)
                 {
                     name = temp.Name;
                 }
                 this.ddlFirst.SelectedValue  = model.Type.ToString();
                 this.ddlharder.SelectedValue = model.Isdifficulty.ToString();
                 this.ddlstatus.SelectedValue = model.Status.ToString();
                 //试题描述
                 this.contenms = model.Title.Replace("\"", "':");
                 //单选
                 if (int.Parse(this.ddlFirst.SelectedValue) == 1)
                 {
                     this.contenA = model.A.ToString();
                     this.contenB = model.B.ToString();
                     this.contenC = model.C.ToString();
                     this.contenD = model.D.ToString();
                     this.contenE = model.E.ToString();
                     this.contenF = model.F.ToString();
                     this.contenG = model.G.ToString();
                     this.contenH = model.H.ToString();
                     if (model.Answer.ToUpper() == "A")
                     {
                         raidaA.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "B")
                     {
                         raidaB.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "C")
                     {
                         raidaC.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "D")
                     {
                         raidaD.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "E")
                     {
                         raidaE.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "F")
                     {
                         raidaF.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "G")
                     {
                         raidaG.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "H")
                     {
                         raidaH.Checked = true;
                     }
                 }
                 //多选
                 if (int.Parse(this.ddlFirst.SelectedValue) == 2)
                 {
                     this.contenAA = model.A.ToString();
                     this.contenBB = model.B.ToString();
                     this.contenCC = model.C.ToString();
                     this.contenDD = model.D.ToString();
                     this.contenEE = model.E.ToString();
                     this.contenFF = model.F.ToString();
                     this.contenGG = model.G.ToString();
                     this.contenHH = model.H.ToString();
                     string   str = model.Answer;
                     string[] arr = str.Split(',');
                     foreach (string answer in arr)
                     {
                         if (answer == "A")
                         {
                             ckdA.Checked = true;
                         }
                         if (answer == "B")
                         {
                             ckdB.Checked = true;
                         }
                         if (answer == "C")
                         {
                             ckdC.Checked = true;
                         }
                         if (answer == "D")
                         {
                             ckdD.Checked = true;
                         }
                         if (answer == "E")
                         {
                             ckdE.Checked = true;
                         }
                         if (answer == "F")
                         {
                             ckdF.Checked = true;
                         }
                         if (answer == "G")
                         {
                             ckdG.Checked = true;
                         }
                         if (answer == "H")
                         {
                             ckdH.Checked = true;
                         }
                     }
                 }
                 //判断
                 if (int.Parse(this.ddlFirst.SelectedValue) == 3)
                 {
                     if (model.Answer.ToUpper() == "1")
                     {
                         raidzq.Checked = true;
                     }
                     if (model.Answer.ToUpper() == "0")
                     {
                         raidcw.Checked = true;
                     }
                 }
                 //填空
                 if (int.Parse(this.ddlFirst.SelectedValue) == 4)
                 {
                     this.txttk.Text = model.Answer;
                 }
                 //试题解析
                 this.contenjx = model.Interpretation.Replace("\"", "':");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message);
     }
 }
示例#6
0
文件: Formed.aspx.cs 项目: Hizcy/exam
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (exampaperId > 0)
            {
                Exam.Entity.tb_ExampaperEntity model = Exam.BLL.tb_ExampaperBLL.GetInstance().GetAdminSingle(exampaperId);
                if (model != null)
                {
                    Exam.Entity.tb_QuestionClsEntity question = Exam.BLL.tb_QuestionClsBLL.GetInstance().GetAdminSingle(model.ExampaperClsId);
                    if (question != null)
                    {
                        namek = question.Name;
                    }
                    txthid.Text             = model.ExampaperClsId.ToString();
                    exampaperclsd           = model.ExampaperClsId;
                    txthidname.Text         = model.Name;
                    ddlstatus.SelectedValue = model.Status.ToString();
                    ddltype.SelectedIndex   = model.Type;
                    txttime.Text            = model.Duration.ToString();
                    txtscore.Text           = model.Pass.ToString();
                }
                IList <Exam.Entity.tb_ExampaperExtEntity> list = Exam.BLL.tb_ExampaperExtBLL.GetInstance().GetListByExampaperId(exampaperId);
                System.Text.StringBuilder strb = new System.Text.StringBuilder();
                if (list.Count > 0 && list != null)
                {
                    int id = 0;
                    foreach (Exam.Entity.tb_ExampaperExtEntity temp in list)
                    {
                        string tempStr2 = "\"num1\":\"" + temp.Number + "\",\"num2\":\"" + temp.Diff + "\"";

                        Exam.Entity.tb_QuestionClsEntity question = Exam.BLL.tb_QuestionClsBLL.GetInstance().GetAdminSingle(temp.tb_QuestionClsId);
                        if (temp.Type == 1)
                        {
                            id++;
                            strb.Append("<tr class=\"tr\" id=\"tr" + id + "\">"
                                        + "<td ><img src=\"../images/substract.png\" onclick=\"deleteTxt(" + id + ")\" /></td>"
                                        + "<td ><input id=\"txttype" + id + "\" type=\"text\"  style=\"display:none\" value=\"1\" /><span>单选</span></td>"
                                        + "<td ><span id=\"num" + id + "\">" + (temp.Number + temp.Diff) + "</span></td>"
                                        + "<td ><input id=\"txttile" + id + "\" Value=\"" + temp.Title + "\" type=\"text\" style=\"width:200px\" /></td><td ><input id=\"txtnum" + id + "\" Value=\"" + temp.Score + "\" type=\"text\" style=\"width:50px\" /></td>"
                                        + "<td><a href=\"javascript:selectExam(" + id + ")\" style=\"text-decoration:none\"><span id=\"select" + id + "\">" + question.Name + "</span><img src=\"../images/icon6.gif\" style=\"margin-bottom:2px;margin-left:5px\"  /></a><input type=\"text\" style=\"display:none\" value=\"" + temp.tb_QuestionClsId + "\" id=parentid" + id + " /></td>"
                                        + "<td><a href=\"javascript:extractNum(1," + id + ")\" style=\"text-decoration:none\">抽取数量</a> <input type=\"text\" style=\"display:none\"   value='" + tempStr2 + "' id=hid" + id + " /></td></tr>");
                        }
                        else if (temp.Type == 2)
                        {
                            id++;
                            strb.Append("<tr  class=\"tr\" id=\"tr" + id + "\">"
                                        + "<td ><img src=\"../images/substract.png\" onclick=\"deleteTxt(" + id + ")\" /></td>"
                                        + "<td ><input id=\"txttype" + id + "\" type=\"text\"  style=\"display:none\" value=\"2\" /><span>多选</span></td>"
                                        + "<td ><span id=\"num" + id + "\">" + (temp.Number + temp.Diff) + "</span></td>"
                                        + "<td ><input id=\"txttile" + id + "\" Value=\"" + temp.Title + "\" type=\"text\" style=\"width:200px\" /></td><td ><input id=\"txtnum" + id + "\" Value=\"" + temp.Score + "\" type=\"text\" style=\"width:50px\" /></td>"
                                        + "<td><a href=\"javascript:selectExam(" + id + ")\" style=\"text-decoration:none\"><span id=\"select" + id + "\">" + question.Name + "</span><img src=\"../images/icon6.gif\" style=\"margin-bottom:2px;margin-left:5px\"  /></a><input type=\"text\" style=\"display:none\" value=\"" + temp.tb_QuestionClsId + "\" id=parentid" + id + " /></td>"
                                        + "<td><a href=\"javascript:extractNum(2," + id + ")\" style=\"text-decoration:none\">抽取数量</a> <input type=\"text\" style=\"display:none\"   value='" + tempStr2 + "' id=hid" + id + " /></td></tr>");
                        }
                        else if (temp.Type == 3)
                        {
                            id++;
                            strb.Append("<tr class=\"tr\" id=\"tr" + id + "\">"
                                        + "<td ><img src=\"../images/substract.png\" onclick=\"deleteTxt(" + id + ")\" /></td>"
                                        + "<td ><input id=\"txttype" + id + "\" type=\"text\"  style=\"display:none\" value=\"3\" /><span>判断</span></td>"
                                        + "<td ><span id=\"num" + id + "\">" + (temp.Number + temp.Diff) + "</span></td>"
                                        + "<td ><input id=\"txttile" + id + "\" Value=\"" + temp.Title + "\" type=\"text\" style=\"width:200px\" /></td><td ><input id=\"txtnum" + id + "\" Value=\"" + temp.Score + "\" type=\"text\" style=\"width:50px\" /></td>"
                                        + "<td><a href=\"javascript:selectExam(" + id + ")\" style=\"text-decoration:none\"><span id=\"select" + id + "\">" + question.Name + "</span><img src=\"../images/icon6.gif\" style=\"margin-bottom:2px;margin-left:5px\"  /></a><input type=\"text\" style=\"display:none\" value=\"" + temp.tb_QuestionClsId + "\" id=parentid" + id + " /></td>"
                                        + "<td><a href=\"javascript:extractNum(3," + id + ")\" style=\"text-decoration:none\">抽取数量</a> <input type=\"text\" style=\"display:none\"   value='" + tempStr2 + "' id=hid" + id + " /></td></tr>");
                        }
                        else
                        {
                            id++;
                            strb.Append("<tr class=\"tr\" id=\"tr" + id + "\">"
                                        + "<td ><img src=\"../images/substract.png\" onclick=\"deleteTxt(" + id + ")\" /></td>"
                                        + "<td ><input id=\"txttype" + id + "\" type=\"text\"  style=\"display:none\" value=\"4\" /><span>填空</span></td>"
                                        + "<td ><span id=\"num" + id + "\">" + (temp.Number + temp.Diff) + "</span></td>"
                                        + "<td ><input id=\"txttile" + id + "\" Value=\"" + temp.Title + "\" type=\"text\" style=\"width:200px\" /></td><td ><input id=\"txtnum" + id + "\" Value=\"" + temp.Score + "\" type=\"text\" style=\"width:50px\" /></td>"
                                        + "<td><a href=\"javascript:selectExam(" + id + ")\" style=\"text-decoration:none\"><span id=\"select" + id + "\">" + question.Name + "</span><img src=\"../images/icon6.gif\" style=\"margin-bottom:2px;margin-left:5px\"  /></a><input type=\"text\" style=\"display:none\" value=\"" + temp.tb_QuestionClsId + "\" id=parentid" + id + " /></td>"
                                        + "<td><a href=\"javascript:extractNum(4," + id + ")\" style=\"text-decoration:none\">抽取数量</a> <input type=\"text\" style=\"display:none\"   value='" + tempStr2 + "' id=hid" + id + " /></td></tr>");
                        }
                    }
                    tempstr = strb.ToString();
                }
                Exam.Entity.tb_QuestionClsEntity tempQuestion = Exam.BLL.tb_QuestionClsBLL.GetInstance().GetAdminSingle(exampaperclsd);
                if (tempQuestion != null)
                {
                    namek = tempQuestion.Name;
                }
            }
        }
    }