示例#1
0
文件: data.aspx.cs 项目: Hizcy/exam
 //试题填空
 public void Addtestqmtk(int questionId, int department, string typef, string contentms, string harder, string status, string contentjx, string txttk)
 {
     contentms = contentms.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
     contentjx = contentjx.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
     try
     {
         UserIdentity identity = User.Identity as UserIdentity;
         if (identity != null)
         {
             Exam.Entity.tb_QuestionEntity model = null;
             if (questionId == 0 && identity != null)
             {
                 model                = new Exam.Entity.tb_QuestionEntity();
                 model.Type           = int.Parse(typef);
                 model.SchoolId       = 0;//identity._schoolID;
                 model.QuestionClsId  = department;
                 model.Title          = contentms;
                 model.Answer         = txttk;
                 model.Interpretation = contentjx;
                 model.Isdifficulty   = int.Parse(harder);
                 model.Status         = int.Parse(status);
                 model.Addtime        = DateTime.Now;
                 model.Updatetime     = DateTime.Now;
                 Exam.BLL.tb_QuestionBLL.GetInstance().Insert(model);
                 Response.Write("1");
             }
             else
             {
                 model = Exam.BLL.tb_QuestionBLL.GetInstance().GetAdminSingle(questionId);
                 if (model != null)
                 {
                     model.Type           = int.Parse(typef);
                     model.SchoolId       = 0;// identity._schoolID;
                     model.QuestionClsId  = department;
                     model.Title          = contentms;
                     model.Answer         = txttk;
                     model.Interpretation = contentjx;
                     model.Isdifficulty   = int.Parse(harder);
                     model.Status         = int.Parse(status);
                     model.Updatetime     = DateTime.Now;
                 }
                 Exam.BLL.tb_QuestionBLL.GetInstance().Update(model);
                 Response.Write("2");
             }
         }
     }
     catch (Exception ex)
     {
         Jnwf.Utils.Log.Logger.Log4Net.Error("data.aspx.cs,EndMenu,ex:" + ex.Message + "|" + ex.StackTrace);
         Response.Write("error");
     }
 }
示例#2
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);
     }
 }
示例#3
0
文件: data.aspx.cs 项目: Hizcy/exam
    //试题多选
    public void Addtestqmdd(int questionId, int department, string typef, string contentms, string contentduxa, string contentduxb, string contentduxc, string contentduxd, string contentduxe, string contentduxf, string contentduxg, string contentduxh, string harder, string status, string contentjx, string dd)
    {
        contentms = contentms.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        //AA-HH
        contentduxa = contentduxa.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        contentduxb = contentduxb.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        contentduxc = contentduxc.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        contentduxd = contentduxd.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        contentduxe = contentduxe.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        contentduxf = contentduxf.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        contentduxg = contentduxg.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        contentduxh = contentduxh.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");

        contentjx = contentjx.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&apos;", "'").Replace("&quot;", "\"");
        try
        {
            UserIdentity identity = User.Identity as UserIdentity;
            if (identity != null)
            {
                Exam.Entity.tb_QuestionEntity model = null;
                if (questionId == 0 && identity != null)
                {
                    model               = new Exam.Entity.tb_QuestionEntity();
                    model.Type          = int.Parse(typef);
                    model.SchoolId      = 0;//identity._schoolID;
                    model.QuestionClsId = department;
                    model.Title         = contentms;
                    if (contentduxa != null)
                    {
                        model.A = contentduxa;
                    }
                    if (contentduxb != null)
                    {
                        model.B = contentduxb;
                    }
                    if (contentduxc != null)
                    {
                        model.C = contentduxc;
                    }
                    if (contentduxd != null)
                    {
                        model.D = contentduxd;
                    }
                    if (contentduxe != null)
                    {
                        model.E = contentduxe;
                    }
                    if (contentduxf != null)
                    {
                        model.F = contentduxf;
                    }
                    if (contentduxg != null)
                    {
                        model.G = contentduxg;
                    }
                    if (contentduxh != null)
                    {
                        model.H = contentduxh;
                    }
                    model.Answer         = dd.TrimEnd(',');
                    model.Interpretation = contentjx;
                    model.Isdifficulty   = int.Parse(harder);
                    model.Status         = int.Parse(status);
                    model.Addtime        = DateTime.Now;
                    model.Updatetime     = DateTime.Now;

                    Exam.BLL.tb_QuestionBLL.GetInstance().Insert(model);
                    Response.Write("1");
                }
                else
                {
                    model = Exam.BLL.tb_QuestionBLL.GetInstance().GetAdminSingle(questionId);
                    if (model != null)
                    {
                        model.Type          = int.Parse(typef);
                        model.SchoolId      = 0;//identity._schoolID;
                        model.QuestionClsId = department;
                        model.Title         = contentms;
                        if (contentduxa != null)
                        {
                            model.A = contentduxa;
                        }
                        if (contentduxb != null)
                        {
                            model.B = contentduxb;
                        }
                        if (contentduxc != null)
                        {
                            model.C = contentduxc;
                        }
                        if (contentduxd != null)
                        {
                            model.D = contentduxd;
                        }
                        if (contentduxe != null)
                        {
                            model.E = contentduxe;
                        }
                        if (contentduxf != null)
                        {
                            model.F = contentduxf;
                        }
                        if (contentduxg != null)
                        {
                            model.G = contentduxg;
                        }
                        if (contentduxh != null)
                        {
                            model.H = contentduxh;
                        }
                        model.Answer         = dd.TrimEnd(',');
                        model.Interpretation = contentjx;
                        model.Isdifficulty   = int.Parse(harder);
                        model.Status         = int.Parse(status);
                        model.Updatetime     = DateTime.Now;
                    }
                    Exam.BLL.tb_QuestionBLL.GetInstance().Update(model);
                    Response.Write("2");
                }
            }
        }
        catch (Exception ex)
        {
            Jnwf.Utils.Log.Logger.Log4Net.Error("data.aspx.cs,EndMenu,ex:" + ex.Message + "|" + ex.StackTrace);
            Response.Write("error");
        }
    }