Example #1
0
 protected override void InitPageTemplate(HttpContext context)
 {
     //知识
     Song.Entities.Knowledge knl = Business.Do <IKnowledge>().KnowledgeSingle(id);
     this.Document.Variables.SetValue("knl", knl);
     if (knl != null)
     {
         Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(knl.Cou_ID);
         //是否免费,或是限时免费
         if (course.Cou_IsLimitFree)
         {
             DateTime freeEnd = course.Cou_FreeEnd.AddDays(1).Date;
             if (!(course.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
             {
                 course.Cou_IsLimitFree = false;
             }
         }
         this.Document.Variables.SetValue("course", course);
         //是否购买课程(免费的也可以学习)
         int  acid  = this.Account != null ? this.Account.Ac_ID : 0;
         bool isBuy = acid > 0 && (course.Cou_IsFree || course.Cou_IsLimitFree) ? true : Business.Do <ICourse>().IsBuy(course.Cou_ID, acid);
         this.Document.Variables.SetValue("isBuy", isBuy);
         //上级专业
         if (course != null)
         {
             List <Song.Entities.Subject> sbjs = Business.Do <ISubject>().Parents(course.Sbj_ID, true);
             this.Document.Variables.SetValue("sbjs", sbjs);
         }
     }
 }
Example #2
0
        protected override void InitPageTemplate(HttpContext context)
        {
            //当前知识
            int id = WeiSha.Common.Request.QueryString["id"].Int32 ?? 0;

            Song.Entities.Knowledge kn = Business.Do <IKnowledge>().KnowledgeSingle(id);
            this.Document.Variables.SetValue("kn", kn);
            if (kn != null)
            {
                Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(kn.Cou_ID);
                //是否免费,或是限时免费
                if (course.Cou_IsLimitFree)
                {
                    DateTime freeEnd = course.Cou_FreeEnd.AddDays(1).Date;
                    if (!(course.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
                    {
                        course.Cou_IsLimitFree = false;
                    }
                }
                this.Document.Variables.SetValue("course", course);
                //是否购买课程(免费的也可以学习)
                bool isBuy = course.Cou_IsFree || course.Cou_IsLimitFree ? true : Business.Do <ICourse>().IsBuy(course.Cou_ID, this.Account.Ac_ID);
                this.Document.Variables.SetValue("isBuy", isBuy);
            }

            //上一条
            Song.Entities.Knowledge prev = Business.Do <IKnowledge>().KnowledgePrev(kn.Cou_ID, -1, id);
            this.Document.Variables.SetValue("prev", prev);
            //下一条
            Song.Entities.Knowledge next = Business.Do <IKnowledge>().KnowledgeNext(kn.Cou_ID, -1, id);
            this.Document.Variables.SetValue("next", next);
        }
Example #3
0
 protected override void InitPageTemplate(HttpContext context)
 {
     //当前试题
     Song.Entities.Questions qus = Business.Do <IQuestions>().QuesSingle(id);
     if (qus != null)
     {
         Song.Entities.Knowledge knl = Business.Do <IKnowledge>().KnowledgeSingle(qus.Kn_ID);
         this.Document.Variables.SetValue("knl", knl);
     }
 }
Example #4
0
        protected override void InitPageTemplate(HttpContext context)
        {
            //当前知识
            int id = WeiSha.Common.Request.QueryString["id"].Int32 ?? 0;

            Song.Entities.Knowledge kn = Business.Do <IKnowledge>().KnowledgeSingle(id);
            this.Document.Variables.SetValue("kn", kn);

            //上一条
            Song.Entities.Knowledge prev = Business.Do <IKnowledge>().KnowledgePrev(kn.Cou_ID, -1, id);
            this.Document.Variables.SetValue("prev", prev);
            //下一条
            Song.Entities.Knowledge next = Business.Do <IKnowledge>().KnowledgeNext(kn.Cou_ID, -1, id);
            this.Document.Variables.SetValue("next", next);
        }
 protected override void InitPageTemplate(HttpContext context)
 {
     //知识
     Song.Entities.Knowledge knl = Business.Do <IKnowledge>().KnowledgeSingle(id);
     this.Document.Variables.SetValue("knl", knl);
     if (knl != null)
     {
         Song.Entities.Course cou = Business.Do <ICourse>().CourseSingle(knl.Cou_ID);
         this.Document.Variables.SetValue("course", cou);
         //上级专业
         if (cou != null)
         {
             List <Song.Entities.Subject> sbjs = Business.Do <ISubject>().Parents(cou.Sbj_ID, true);
             this.Document.Variables.SetValue("sbjs", sbjs);
         }
     }
 }