Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            courseId = Request.QueryString["csid"];

            if (!IsPostBack)
            {
                var course = CourseService.GetCourseById(SessionVariable.Current.Company.Id, courseId);

                if (course != null)
                {
                    CourseName.Text = course.Name;
                    CourseDesc.Text = course.Description;

                    if (course.CourseType == CourseTypeEnum.Intenral)
                    {
                        LessonRepeater.DataSource = course.LoadActiveLessons();
                        LessonRepeater.DataBind();
                    }
                    else
                    {
                        Panel1.Visible = false;
                    }

                    SessionRepeater.DataSource = course.LoadActiveSessions();
                    SessionRepeater.DataBind();
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enrollmentId = Request.QueryString["enid"];

            if (!IsPostBack)
            {
                var enrollment = EnrolService.GetEnrollment(enrollmentId);

                if (enrollment != null)
                {
                    logger.Debug("lesson data count: " + enrollment.ScormData.Count);

                    CourseName.Text = enrollment.Session.Course.Name;
                    CourseDesc.Text = enrollment.Session.Course.Description;

                    SessionName.Text = enrollment.Session.Name;
                    SessionDesc.Text = enrollment.Session.Description;

                    EnrollStatus.Text = enrollment.EnrollStatus.ToString();
                    EnrollResult.Text = enrollment.Result.ToString();

                    if (enrollment.IsActiveEnrollment())
                    {
                        WithdrawBtn.Visible = true;
                    }

                    LessonRepeater.DataSource = enrollment.ScormData.OrderBy(x => x.Lesson.Order).ToList();
                    LessonRepeater.DataBind();
                }
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            enrollmentId = Request.QueryString["enid"];

            if (!IsPostBack)
            {
                var enrollment = EnrolService.GetEnrollment(enrollmentId);

                if (enrollment != null)
                {
                    LessonRepeater.DataSource = enrollment.ScormData.OrderBy(x => x.Lesson.Order);
                    LessonRepeater.DataBind();
                }
            }
        }
Пример #4
0
    protected void DeleteLessonLink_Click(object sender, EventArgs e)
    {
        ApplicationDbContext dbContext = new ApplicationDbContext();

        Lesson lesson = (Lesson)Session["CurrentLesson"];

        dbContext.Lessons.Remove(dbContext.Lessons.Where(l => l.Id == lesson.Id).FirstOrDefault());
        dbContext.SaveChanges();

        LessonTitleLabel.Text   = "";
        LessonContentLabel.Text = "";

        LessonRepeater.DataBind();
        LessonAttachmentRepeater.DataBind();

        HomePanel.Visible   = false;
        LessonPanel.Visible = true;

        ActivePanelLabel.Text = "Lessons";
    }
Пример #5
0
    protected void NewLessonButton_Click(object sender, EventArgs e)
    {
        ApplicationDbContext dbContext = new ApplicationDbContext();

        Lesson lesson = new Lesson();

        lesson.Title   = NewLessonTitle.Text;
        lesson.Content = NewLessonContent.Text;
        lesson.Course  = dbContext.Courses.Where(c => c.Id == course.Id).FirstOrDefault();

        dbContext.Lessons.Add(lesson);
        dbContext.SaveChanges();

        LessonRepeater.DataBind();

        HomePanel.Visible   = false;
        LessonPanel.Visible = true;

        ActivePanelLabel.Text = "Lessons";

        NewLessonTitle.Text   = "";
        NewLessonContent.Text = "";
    }