Song.Site/Mobile/TestPaper.ashx.cs

(完整代码) 2KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WeiSha.Common;
using Song.ServiceInterfaces;
using VTemplate.Engine;

namespace Song.Site.Mobile
{
    /// <summary>
    /// 模拟考场的首页
    /// </summary>
    public class TestPaper : BasePage
    {
        //搜索字符
        protected string search = WeiSha.Common.Request.Form["search"].String;
        protected override void InitPageTemplate(HttpContext context)
        {
            this.Document.SetValue("search", search);
            if (!Extend.LoginState.Student.IsLogin)
                this.Response.Redirect("Entry.ashx");           
            //当前选中的科目
            Song.Entities.Course currCourse = Extend.LoginState.Student.Course();
            if (currCourse == null) this.Response.Redirect("subject.ashx");
            //试卷列表
            Song.Entities.TestPaper[] tps = null;
            if (string.IsNullOrWhiteSpace(search))
            {
                tps = Business.Do<ITestPaper>().PagerCount(this.Organ.Org_ID, currCourse.Sbj_ID, currCourse.Cou_ID, -1, true, 0);
            }
            else
            {
                tps = Business.Do<ITestPaper>().PagerCount(search, Organ.Org_ID, currCourse.Sbj_ID, currCourse.Cou_ID, -1, true, 0);
            }           

            foreach (Song.Entities.TestPaper s in tps)
            {
                s.Tp_Logo = string.IsNullOrWhiteSpace(s.Tp_Logo) ? s.Tp_Logo : Upload.Get["TestPaper"].Virtual + s.Tp_Logo;
            }
            this.Document.SetValue("tps", tps);

            //是否购买该科目
            Song.Entities.Course couBuy = Business.Do<ICourse>().CourseIsBuy(currCourse.Cou_ID, Extend.LoginState.Student.CurrentUserId, 1);
            bool isBuy = couBuy != null;
            if (!isBuy)
            {
                //this.Response.Redirect("BuyCourse.ashx?couid=" + currCourse.Cou_ID);
            }
            //是否购买,如果免费也算已经购买
            this.Document.SetValue("isBuy", isBuy || currCourse.Cou_IsFree);
            if (couBuy == null) couBuy = currCourse;
            this.Document.SetValue("couBuy", couBuy);
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。