示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var url = new Academic.DbEntities.ActivityAndResource.UrlResource()
            {
                Id   = UrlResourceId,
                Name = txtName.Text
                ,
                Description = CKEditor1.Text
                ,
                DisplayDescriptionOnPage = chkDisplayDescription.Checked
                ,
                Display = (byte)ddlDisplay.SelectedIndex
                ,
                Url = txtExternalUrl.Text
            };

            if (!string.IsNullOrEmpty(txtPopupHeightInPixel.Text) &&
                !string.IsNullOrEmpty(txtPopupWidthInPixel.Text) &&
                ddlDisplay.SelectedIndex == 3)
            {
                url.PopupHeightInPixel = Convert.ToInt32(txtPopupHeightInPixel.Text);
                url.PopupWidthInPixel  = Convert.ToInt32(txtPopupWidthInPixel.Text);
            }
            var restriction = new Academic.DbEntities.AccessPermission.Restriction()
            {
            };

            using (var helper = new DbHelper.ActAndRes())
            {
                var saved = helper.AddOrUpdateUrlResource(url, SectionId, restriction);
                if (saved != null)
                {
                    Response.Redirect(DbHelper.StaticValues.WebPagePath.CourseDetailPage(SubjectId, SectionId));
                    //Response.Redirect("~/Views/Course/Section/Master/CourseSectionListing.aspx?SubId=" + SubjectId + "&edit=1#section_" + SectionId);
                }
            }
        }