Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtLabelText.Text))
            {
                lblTextError.Visible = true;
                return;
            }
            var label = new Academic.DbEntities.ActivityAndResource.LabelResource()
            {
                Id   = LabelId,
                Text = txtLabelText.Text.Trim()
            };

            if (SectionId > 0)
            {
                var restriction = new Academic.DbEntities.AccessPermission.Restriction()
                {
                };
                using (var helper = new DbHelper.ActAndRes())
                {
                    var saved = helper.AddOrUpdateLabelResource(label, 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);
                    }
                }
            }
        }
Example #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var page = new Academic.DbEntities.ActivityAndResource.PageResource()
            {
                Id   = UrlResourceId,
                Name = txtName.Text
                ,
                Description = txtDescription.Text
                ,
                DisplayDescriptionOnPage = chkDisplayDescription.Checked
                ,
                DisplayPageName = chkDisplayPageName.Checked
                ,
                DisplayPageDescription = chkDisplayPageDescription.Checked
                ,
                PageContent = txtContent.Text
            };

            var restriction = new Academic.DbEntities.AccessPermission.Restriction()
            {
            };

            using (var helper = new DbHelper.ActAndRes())
            {
                var saved = helper.AddOrUpdatePageResource(page, 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);
                }
            }
        }
Example #3
0
 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);
         }
     }
 }
Example #4
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);
                }
            }
        }
Example #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                var list = new List <Academic.DbEntities.ActivityAndResource.ChoiceItems.ChoiceOptions>();

                var limitResponses = ddlLimitTheNumberOfResponses.SelectedIndex == 1;
                var choiceId       = ChoiceId;

                var choice = new Academic.DbEntities.ActivityAndResource.ChoiceActivity()
                {
                    Id   = choiceId,
                    Name = txtName.Text
                    ,
                    Description = txtDescription.Text
                    ,
                    DisplayDescriptionOnCoursePage = chkDisplayDescription.Checked
                    ,
                    DisplayModeForOptions = ddlDisplayModeForOptions.SelectedIndex == 1
                    ,
                    AllowChoiceTobeUpdated = ddlAllowChoiceToBeUpdated.SelectedIndex == 1
                    ,
                    AllowMoreThanOneChoiceToBeSelected = ddlAllowMoreChoiceToBeSelected.SelectedIndex == 1
                    ,
                    LimitTheNumberOfResponsesAllowed = limitResponses
                    ,
                    RestrictTimePeriod = chkRestrictAnsweringTime.Checked
                    ,
                    IncludeResponsesFromInactiveUsers = ddlIncludeResponsesFromInactiveUsers.SelectedIndex == 1
                    ,
                    PublishResults = (byte)ddlPublishResults.SelectedIndex
                    ,
                    //PrivacyOfResults = ddlPrivacyOfResults.SelectedIndex == 1
                    //,
                    ShowColumnForUnAnswered = ddlShowColumnsForUnanswered.SelectedIndex == 1
                    ,
                    ShowPreview = chkShowPreview.Checked
                    ,
                };
                if (chkRestrictAnsweringTime.Checked)
                {
                    choice.OpenDate  = Convert.ToDateTime(txtOpenDate.Text);
                    choice.UntilDate = Convert.ToDateTime(txtUntilDate.Text);
                }
                else
                {
                    choice.OpenDate  = null;
                    choice.UntilDate = null;
                }

                if (ddlPublishResults.SelectedIndex == 0)
                {
                    choice.PrivacyOfResults = false;
                }
                else
                {
                    choice.PrivacyOfResults = ddlPrivacyOfResults.SelectedIndex == 1;
                }


                //choice options
                foreach (var c in pnlOptions.Controls)
                {
                    var uc = c as ChoiceOptionsCreate;
                    if (uc != null)
                    {
                        if (uc.Visible)
                        {
                            list.Add(new ChoiceOptions()
                            {
                                Id = uc.OptionId
                                ,
                                Position = uc.Position
                                ,
                                Limit = (limitResponses) ? uc.LimitValue : 0
                                ,
                                Option = uc.OptionValue
                                ,
                                ChoiceActivityId = choiceId
                            });
                        }
                    }
                }

                var restriction = new Academic.DbEntities.AccessPermission.Restriction()
                {
                };

                using (var helper = new Academic.DbHelper.DbHelper.ActAndRes())
                {
                    var saved = helper.AddOrUpdateChoiceActivity(choice, list, SectionId, restriction);
                    if (saved != null)
                    {
                        Response.Redirect("~/Views/ActivityResource/Choice/ChoiceView.aspx" + "?SubId="
                                          + SubjectId + "&arId=" + saved.Id + "&secId=" + SectionId);//+ "&edit=" + (edit ? 1 : 0););
                    }
                }
            }
        }