示例#1
0
        public void LoadBook()
        {
            using (var helper = new DbHelper.ActAndRes())
            {
                var book = helper.GetBook(BookId);
                if (book != null)
                {
                    txtName.Text   = book.Name;
                    CKEditor1.Text = book.Description;
                    chkDisplayDescription.Checked      = book.DisplayDescriptionOnCourePage;
                    ddlChapterFormatting.SelectedIndex = book.ChapterFormatting;
                    ddlStyleOfNavigation.SelectedIndex = book.StyleOfNavigation;
                    //lblHeading.Text = "Edit '" + book.Name+"'";

                    RestrictionUC.SetActivityResource(false, ((int)Enums.Resources.Book) + 1, book.Id);

                    //RestrictionUC.ActivityOrResource = false;
                    //RestrictionUC.ActivityOrResourceId = book.Id;
                    //RestrictionUC.ActivityOrResourceType = ((int) Enums.Resources.Book) + 1;

                    //RestrictionUC.RestricionId = book.
                    //book.ActivityResource.Restriction.re
                    //RestrictionUC.GetRestriction()
                }
            }
        }
示例#2
0
        private void ParseQueryString()
        {
            var subjectId = Request.QueryString["SubId"];
            var sectionId = Request.QueryString["secId"];
            var arId      = Request.QueryString["arId"];

            //var edit = Request.QueryString["edit"];
            if (arId != null)
            {
                BookId = (Convert.ToInt32(arId.ToString()));
                using (var helper = new DbHelper.ActAndRes())
                {
                    var book = helper.GetBook(BookId);
                    lblBookName.Text        = book.Name;
                    lblBookDescription.Text = book.Description;
                    lblPageTitle.Text       = book.Name;
                }
            }
            if (sectionId != null && subjectId != null)
            {
                SectionId = Convert.ToInt32(sectionId);
                SubjectId = Convert.ToInt32(subjectId);
            }

            var user = Page.User as CustomPrincipal;

            if (user != null)
            {
                if ((user.IsInRole(DbHelper.StaticValues.Roles.CourseEditor) ||
                     user.IsInRole(DbHelper.StaticValues.Roles.Manager) ||
                     user.IsInRole(DbHelper.StaticValues.Roles.Teacher)))
                {
                    var edit = Session["editMode"] as string;

                    //var edit = Request.QueryString["edit"];
                    if (edit == "1")
                    {
                        edit_panel.Visible = true;
                        Edit = "1";
                    }
                    else
                    {
                        Edit = "0";
                        edit_panel.Visible = false;
                    }

                    if (subjectId != null && sectionId != null)
                    {
                        lnkBackToCourse.NavigateUrl =
                            "~/Views/Course/Section/?SubId=" + subjectId
                            + "#section_" + sectionId;
                    }
                }
                else
                {
                    Edit = "0";
                }
            }
        }
示例#3
0
        List <IdAndName> GetBook(DbHelper.ActAndRes helper, string fileName)
        {
            var list = new List <IdAndName>();

            switch (fileName)
            {
            case "BookCreate.aspx":
                list.Add(new IdAndName()
                {
                    Name = "Book edit"
                });
                break;

            case "BookView.aspx":
                var bookId = Request.QueryString["arId"];
                var book   = helper.GetBook(Convert.ToInt32(bookId));
                list.Add(new IdAndName()
                {
                    Name = book.Name,
                });
                break;

            case "ChapterCreate.aspx":
                var bId   = Request.QueryString["bId"];
                var subId = Request.QueryString["SubId"];
                var secId = Request.QueryString["secId"];
                var bk    = helper.GetBook(Convert.ToInt32(bId));
                list.Add(new IdAndName()
                {
                    Name  = bk.Name,
                    Value = "~/Views/ActivityResource/Book/BookView.aspx" +
                            "?SubId=" + subId +
                            "&arId=" + bId +
                            "&secId=" + secId,
                    Void = true,
                });
                list.Add(new IdAndName()
                {
                    Name = "Chapter edit"
                });
                break;
            }

            return(list);
        }