Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string action = Request["action"];
            if (action != null && action.ToString().Equals("zfen"))
            {
                ZDfen = int.Parse(Request["score"].ToString());
            }
        }
        //Tbt = new TbObjectiveTopic(); //声明答案类
        //stu = new string[] { }; //保存主观题答案
        //num = 0;    //题号
        //StrLive = new List<string>(); //保存标题所有内容
        if (Request["KgtID"] != null)
        {
            Tbt       = new TbObjectiveTopic(); //声明答案类
            stu       = new string[] { };       //保存主观题答案
            num       = 0;                      //题号
            StrLive   = new List <string>();    //保存标题所有内容
            Tbt.KgtID = int.Parse(Request["KgtID"].ToString());
            HttpCookie cookie = new HttpCookie("kgtid");
            cookie.Value = Tbt.KgtID.ToString();
            Request.Cookies.Add(cookie);
        }
        else
        {
            string kgtid = Request.Cookies["kgtid"].Value;
            Tbt.KgtID = int.Parse(kgtid);
        }
        Tbt.Zt = 2;



        DataTable dt = tbAnswerCardManager.getAnswerCardZgt(Tbt);

        if (dt.Rows.Count > 0)
        {
            stu = dt.Rows[0]["ZgtAnswer"].ToString().Split('︵');                     //获得所有主观题答案
            DataRow   dtKgt = tbAnswerCardManager.getAnswerCard2(Tbt.KgtID).Rows[0]; //获得答题卡
            string    Sj    = dtKgt["SjID"].ToString();
            DataTable dtTx  = TbQuestionTypesManager.GetAllQuestionTypesBySjid(int.Parse(Sj));
            DataRow   drTx  = dtTx.Rows[dtTx.Rows.Count - 1];
            if (drTx["TxName"].ToString() == "简答题")
            {
                int     Zfen    = int.Parse(dtTx.Rows[dtTx.Rows.Count - 1]["Txzf"].ToString());    //本试卷简答题总分
                int     TCount  = int.Parse(dtTx.Rows[dtTx.Rows.Count - 1]["TxCount"].ToString()); //本试卷简答题个数
                DataRow dtPaper = TbTestPaperManager.getOnePaperInfo(Sj).Rows[0];

                Sj = dtPaper["SjName"].ToString();
                StrLive.Add(Sj);                                 //1 试卷名称
                Sj = dtPaper["LsName"].ToString();
                StrLive.Add(Sj);                                 //2 老师名字
                Sj = dtKgt["YhID"].ToString();
                Sj = TbUserManager.GetAllUser(int.Parse(Sj)).Xh; //获得用户学号
                StrLive.Add(Sj);                                 //3 学生学号
                StrLive.Add(Zfen.ToString());                    //4简答题总分
            }
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Ls = new List <string>();
        if (!IsPostBack)
        {
            if (Request["sjid"] != null)
            {
                SjID = Request["sjid"].ToString();
            }
        }
        DataTable dtPaper = TbTestPaperManager.getOnePaperInfo(SjID);

        if (dtPaper != null)
        {
            drPaper = dtPaper.Rows[0];
            DateTime Jstime = DateTime.Parse(drPaper["JsTime"].ToString());     //结束时间
            DateTime Kstime = DateTime.Parse(drPaper["KsTime"].ToString());     //开始时间
            int      Min    = PublicClass.GetMinutes(Kstime, Jstime);           //间隔时间
            Ls.Add(Min.ToString());                                             //Ls[0] = 剩余时间 分钟数
            if (STimeMin == -1)
            {
                STimeMin = Min;
            }
            int Zfen = TbQuestionTypesManager.GetSumScoreBySjid(int.Parse(SjID));
            Ls.Add(Zfen.ToString());
            string KstrTime = drPaper["KsTime"].ToString();
            KstrTime = KstrTime.Substring(KstrTime.LastIndexOf(' '));
            Ls.Add(KstrTime);
        }

        HttpCookie ck     = Request.Cookies["nowloginuser"];
        string     user   = ck.Value;//获得当前登录用户用户名
        int        YhID   = TbUserManager.GetStudentID(user);
        string     XsName = TbStudentManager.GetStudentByID(YhID).XsName;

        Ls.Add(XsName);


        ScoreZt = TbScoreManager.getScore(YhID.ToString(), SjID).Zt;
        if (ScoreZt == 2)
        {
            //ScriptManager.RegisterStartupScript(Page, typeof(string), "3", "error()", true);
            Response.Write("<script>alert('本次考试已结束,请勿重复提交');</script>");
            Response.Write("<script>window.close();</script>");
            return;
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie usercookie = Request.Cookies["nowloginuser"];
        string     url        = PublicClass.CheckLogin(usercookie, "main");

        if (url != "")
        {
            Response.Write(url);
            return;
        }

        if (!IsPostBack)
        {
            string action = Request["action"];
            string sjid   = Request["sjid"];
            if (action != null && sjid != null)
            {
                int id = int.Parse(sjid);
                if (action.Equals("delete"))
                {
                    //删除服务器上面对应试卷的所有图片
                    foreach (DataRow row in TbImagesManager.GetImagesBySjid(id).Rows)
                    {
                        string path = Server.MapPath("images/" + row["Tpian"].ToString());
                        if (File.Exists(path))
                        {
                            File.Delete(path);
                        }
                    }
                    TbImagesManager.DeleteImageBySjid(id);
                    TbQuestionTypesManager.DeleteQuestionTypesBySjid(id);
                    TbTestPaperManager.DeleteTestpaperBySjid(id);
                }
            }
            GetAllTestPaperInfo();
        }
    }
Ejemplo n.º 4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Load = this.txtName.Text;

        #region 将上传的word文档转换为图片并保存
        try
        {
            //上传的Word文件的保存路径
            string postpath = FileUpload1.PostedFile.FileName;
            if (!postpath.Contains(':') || !postpath.Contains('\\'))
            {
                lblFileMessage.Text = "请设置您当前浏览器:工具-internet选项-安全-自定义级别-将文件上传到服务器是包含本地路径!";
                return;
            }
            this.FileUpload1.PostedFile.SaveAs(postpath);         //保存上传的Word文档
            TbTestPaper paper = new TbTestPaper();
            paper.SjName = txtName.Text;                          //试卷名称
            paper.LsName = Request.Cookies["nowloginuser"].Value; //当前用户
            paper.KmID   = int.Parse(ddlSubject.SelectedValue);   //科目编号
            paper.KsTime = DateTime.Parse(startTime.Value);       //开始时间
            paper.JsTime = DateTime.Parse(endTime.Value);         //结束时间
            paper.Remark = txtRemark.Text;                        //备注
            sjid         = TbTestPaperManager.AddPaper(paper);    //添加后的试卷ID
            Word_Convert2Image(postpath);                         //调用转换函数
        }
        catch (Exception ex)
        {
            TbTestPaperManager.DeleteTestpaperBySjid(sjid);
            lblSubMessage.Text = ex.Message;
            return;
        }
        #endregion

        if (sjid > 0)
        {
            string          dxcount  = txtdxcount.Text;  //单选题数
            string          duocount = txtduocount.Text; //多选题数
            string          pdcount  = txtpdcount.Text;  //判断题数
            string          jdcount  = txtjdcount.Text;  //简答题数
            TbQuestionTypes qtype    = new TbQuestionTypes();
            qtype.SjID = sjid;
            if (dxcount != "" && dxcount != "0")  //添加单选题
            {
                qtype.TxName  = "单选题";
                qtype.TxCount = int.Parse(dxcount);
                qtype.Txzf    = int.Parse(txtdxzf.Text);
                TbQuestionTypesManager.AddQuestionType(qtype);
            }
            if (duocount != "" && duocount != "0")  //添加多选题
            {
                qtype.TxName  = "多选题";
                qtype.TxCount = int.Parse(duocount);
                qtype.Txzf    = int.Parse(txtduozf.Text);
                TbQuestionTypesManager.AddQuestionType(qtype);
            }
            if (pdcount != "" && pdcount != "0")  //添加判断题
            {
                qtype.TxName  = "判断题";
                qtype.TxCount = int.Parse(pdcount);
                qtype.Txzf    = int.Parse(txtpdzf.Text);
                TbQuestionTypesManager.AddQuestionType(qtype);
            }
            if (jdcount != "" && jdcount != "0")  //添加简答题
            {
                qtype.TxName  = "简答题";
                qtype.TxCount = int.Parse(jdcount);
                qtype.Txzf    = int.Parse(txtjdzf.Text);
                TbQuestionTypesManager.AddQuestionType(qtype);
            }
            lblSubMessage.Text = "试卷生成成功!";
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 绑定图表
    /// </summary>
    /// <param name="whereStr">当前筛选条件</param>
    /// <param name="type">1表示试卷名或姓名,2表示专业名,3表示科目名</param>
    public void LoadData(string whereStr, int type)
    {
        if (scoreList.Rows.Count > 0)
        {
            Chartlet1.AppearanceStyle = (FanG.Chartlet.AppearanceStyles)System.Enum.Parse(typeof(FanG.Chartlet.AppearanceStyles), "Bar_3D_Aurora_NoCrystal_NoGlow_NoBorder", true);
            DataTable classListTable = TbScoreManager.GetClassList(whereStr, type);
            ArrayList classList      = new ArrayList();
            foreach (DataRow classRow in classListTable.Rows)
            {
                classList.Add(classRow["BjName"]);
            }
            DataTable testpaperListTable = TbScoreManager.GetTestPaperList(whereStr, type);
            ArrayList testpaperList      = new ArrayList();
            foreach (DataRow testRow in testpaperListTable.Rows)
            {
                testpaperList.Add(testRow["SjName"]);
            }

            ArrayList[] DataArray = new ArrayList[testpaperList.Count];
            for (int i = 0; i < DataArray.Length; i++)
            {
                DataArray[i] = new ArrayList();
                int   sjid        = int.Parse(testpaperListTable.Rows[i]["SjiD"].ToString());
                float sjZongScore = TbQuestionTypesManager.GetSumScoreBySjid(sjid);
                for (int j = 0; j < classList.Count; j++)
                {
                    string    nowClassName = classList[j].ToString();
                    float     sumScore     = 0;
                    DataTable dtScorelist  = TbScoreManager.GetScoreListBySjidAndClassname(sjid, nowClassName);
                    if (dtScorelist.Rows.Count > 0)
                    {
                        foreach (DataRow row in dtScorelist.Rows)
                        {
                            float score = 0;
                            if (float.Parse(row["DxtScore"].ToString()) > 0)
                            {
                                score += float.Parse(row["DxtScore"].ToString());
                            }
                            if (float.Parse(row["DuoxtScore"].ToString()) > 0)
                            {
                                score += float.Parse(row["DuoxtScore"].ToString());
                            }
                            if (float.Parse(row["PdtScore"].ToString()) > 0)
                            {
                                score += float.Parse(row["PdtScore"].ToString());
                            }
                            if (float.Parse(row["ZgtScore"].ToString()) > 0)
                            {
                                score += float.Parse(row["ZgtScore"].ToString());
                            }
                            sumScore += score;
                        }
                        float avgScore = sumScore / dtScorelist.Rows.Count;
                        DataArray[i].Add(avgScore / sjZongScore * 100);
                    }
                }
            }
            string title = "";
            switch (type)
            {
            case 1:
                if (whereStr == "")
                {
                    title = "全部";
                }
                else
                {
                    title = "筛选:" + whereStr;
                }
                break;

            case 2: title = "专业:" + whereStr; break;

            case 3: title = "科目:" + whereStr; break;
            }
            Chartlet1.ChartTitle.Text  = title;
            Chartlet1.XLabels.UnitText = "班级/平均分";
            Chartlet1.YLabels.UnitText = "总分";
            Chartlet1.MaxValueY        = 100;
            Chartlet1.InitializeData(DataArray, classList, testpaperList);
        }
    }