コード例 #1
0
ファイル: ForumCreate.aspx.cs プロジェクト: skrishnau/LMS
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         var forum = new Academic.DbEntities.ActivityAndResource.ForumActivity()
         {
             Id            = ForumActivityId
             , Name        = txtName.Text
             , Description = txtDescription.Text
             , DisplayDescriptionOnCoursePage = chkDisplayDescription.Checked
             , DisplayWordCount       = ddlDisplayWordCount.SelectedIndex == 1
             , ForumType              = (byte)ddlForumType.SelectedIndex
             , MaximumAttachmentSize  = Convert.ToInt32(ddlMaximumAttachmentSize.SelectedValue)
             , MaximumNoOfAttachments = Convert.ToInt32(ddlMaximumNoOfAttachments.SelectedValue)
             , ReadTracking           = ddlReadTracking.SelectedIndex == 0
             , SubscriptionMode       = (byte)ddlSubscriptionMode.SelectedIndex
             , TimePeriodForBlocking  = Convert.ToByte(ddlTimeForBlocking.SelectedValue)
             ,
         };
         if (ddlTimeForBlocking.SelectedIndex != 0)
         {
             forum.PostThresholdForBlocking = Convert.ToInt32(txtPostThresholdForBlocking.Text);
             forum.PostThresholdForWarning  = Convert.ToInt32(txtPostThresholdForWarning.Text);
         }
         else
         {
             forum.PostThresholdForBlocking = 0;
             forum.PostThresholdForWarning  = 0;
         }
         var restriction = new Academic.DbEntities.AccessPermission.Restriction()
         {
         };
         using (var helper = new DbHelper.ActAndRes())
         {
             var saved = helper.AddOrUpdateForumActivity(forum, 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);
         }
     }
 }