Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserRole"] == null || Session["UserRole"].ToString() != "Student")
            {
                Response.Write("<Script language='javascript'>alert('您无权访问此页面,请重新登录!');window.history.go(-1);</Script>");
                return;
            }

            //获取作业id
            id = Request.QueryString["AssignmentId"];
            header_text.Text = Request.QueryString["AssignmentTitle"];
            ProblemManager ProblemMan = new ProblemManager();

            stu         = (Student)Session["student"];
            ProblemList = ProblemMan.GetProblem(System.Int32.Parse(id));

            if (ProblemList.Count != 0)
            {
                //动态创建问题及回答区域
                //加载上次答案
                AnswerList = AnswerMan.GetAnswerList(stu.username, System.Int32.Parse(id));
                accessory  = AccessoryMan.GetAccessory(stu.username, System.Int32.Parse(id));

                for (int i = 0; i < ProblemList.Count; i++)
                {
                    string  pro = "<p>" + ProblemList[i].title + "</p>";
                    Control ct  = ParseControl(pro);
                    PlaceHolder1.Controls.Add(ct);

                    string an = "<p><textarea cols='120' rows='15' name='TA' id='TA" + i + "'></textarea></p>";

                    //加载已有答案
                    if (AnswerList != null)
                    {
                        an         = "<p><textarea cols='120' rows='15' name='TA' id='TA" + i + "'>" + AnswerList[i].content + "</textarea></p>";
                        submitFlag = false;
                    }

                    Control ct2 = ParseControl(an);
                    PlaceHolder1.Controls.Add(ct2);
                }

                //加载已有附件
                if (accessory != null)
                {
                    fileTips.Text       = "已有附件,无需再添加!";
                    FileUpload2.Enabled = false;
                }
            }
            else
            {
                header_text.Text    = "   逗你玩呢,哈哈哈哈。";
                submit.Enabled      = false;
                submit2.Enabled     = false;
                export.Enabled      = false;
                export2.Enabled     = false;
                fileTips.Enabled    = false;
                FileUpload2.Enabled = false;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Submit(Int32 id = -1)
        {
            ProblemEntity problem = ProblemManager.GetProblem(id);
            IEnumerable <SelectListItem> items = this.GetLanguageItems();

            ViewBag.Languages = items;

            return(View(problem));
        }
Ejemplo n.º 3
0
 public ActionResult Show(Int32 id = -1)
 {
     return(View(ProblemManager.GetProblem(id)));
 }