コード例 #1
0
 private void CreateCourse()
 {
     string cultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name;
     CourseContainer cc = new CourseContainer(cultureCode);
     cc.TheCourse.CreatedByUserId = UserId;
     cc.TheCourse.ModifiedByUserId = UserId;
     cc.TheCourse.CourseId = 0;
     cc.TheCourse.CreatedInCultureCode = cultureCode;
     cc.SetTitle(Regex.Replace(nvc["Title"], "<[^>]*>", String.Empty));
     //string subjectStr = Page.Request.QueryString["s"];
     //if (subjectStr != null)
     //{
     //    int subid = Convert.ToInt32(subjectStr);
     //    pc.ThePlugg.SubjectId = subid;
     //}
     //else
     //    pc.ThePlugg.SubjectId = 0;
     cc.TheCourse.SubjectId = 0;
     if (nvc["Description"] != "")
         cc.SetDescription(Regex.Replace(nvc["Description"], "<[^>]*>", String.Empty));
     cc.TheCourse.WhoCanEdit = EWhoCanEdit.Anyone;
     BaseHandler bh = new BaseHandler();
     bh.CreateCourse(cc);
     Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(cc.TheCourse.TabId, "", "edit=0"));
 }
コード例 #2
0
ファイル: View.ascx.cs プロジェクト: Jochumzen/Plugghest
        protected void ReadFromControls(CourseContainer c, List<CourseItemEntity> cis)
        {
            string subjectStr = Page.Request.QueryString["s"];
            if (subjectStr != null)
            {
                int subjectId;
                bool isNum = int.TryParse(subjectStr, out subjectId);
                if (isNum)
                    c.TheCourse.SubjectId = subjectId;
            }

            c.SetTitle(txtTitle.Text);
            c.CultureCode = DDLanguage.SelectedValue;
            c.TheCourse.WhoCanEdit = (EWhoCanEdit)Enum.Parse(typeof(EWhoCanEdit), rdbtnWhoCanEdit.SelectedValue);
            c.TheCourse.CreatedOnDate = DateTime.Now;
            c.TheCourse.CreatedByUserId = this.UserId;
            c.TheCourse.ModifiedOnDate = DateTime.Now; ;
            c.TheCourse.ModifiedByUserId = this.UserId;
            c.SetDescription(txtHtmlText.Text);

            // string is in form "44,45,48,52" holding PluggIDs
            string pluggtext = txtPluggs.Text.Trim();

            // Todo: Check that pluggtext is in the correct format before creating the Course

            CourseItemEntity ci;
            if (!string.IsNullOrEmpty(pluggtext))
            {
                string[] itempluggs = pluggtext.Split(',');

                for (int i = 0; i < itempluggs.Length; i++)
                {
                    ci = new CourseItemEntity();
                    ci.ItemId = Convert.ToInt32(itempluggs[i]);
                    ci.CIOrder = i + 1;
                    ci.ItemType = ECourseItemType.Plugg;
                    ci.MotherId = 0;
                    cis.Add(ci);
                }
            }
        }