Ejemplo n.º 1
0
        public void DeleteCourse(Course c)
        {
            // Todo: Don't delete course if: It has comments or ratings
            // Todo: Soft delete of Course
            if (c == null)
            {
                throw new Exception("Cannot delete: Course not initialized");
                return;
            }

            TabController tabController = new TabController();
            TabInfo getTab = tabController.GetTab(c.TabId);

            if (getTab != null)
            {
                DNNHelper h = new DNNHelper();
                h.DeleteTab(getTab);
            }

            var cis = rep.GetItemsInCourse(c.CourseId);
            foreach (CourseItem ciDelete in cis)
            {
                rep.DeleteCourseItem(ciDelete);
            }

            rep.DeleteCourse(c);
        }
Ejemplo n.º 2
0
        public void DeletePlugg(Plugg p)
        {
            // Todo: Don't delete Plugg if: It has comments or ratings, Its included in a course.
            // Todo: Soft delete of Plugg
            if (p == null)
            {
                throw new Exception("Cannot delete: Plugg not initialized");
                return;
            }

            TabController tabController = new TabController();
            TabInfo getTab = tabController.GetTab(p.TabId);

            if (getTab != null)
            {
                DNNHelper h = new DNNHelper();
                h.DeleteTab(getTab);
            }

            rep.DeleteAllPhTextForItem(p.PluggId, (int)ETextItemType.PluggTitle);
            rep.DeleteAllPhTextForItem(p.PluggId, (int)ETextItemType.PluggHtml);
            rep.DeleteAllLatexForItem(p.PluggId, (int)ELatexType.Plugg);

            rep.DeletePlugg(p);
        }
Ejemplo n.º 3
0
        public void DeletePlugg(Plugg p)
        {
            // Todo: Don't delete Plugg if: It has comments or ratings or its included in a course.
            if (p == null)
            {
                throw new Exception("Cannot delete: Plugg not initialized");
            }

            //Delete Plugg page
            if (p.TabId != 0)
            {
                DNNHelper h = new DNNHelper();
                h.DeleteTab(p.TabId);
            }

            //Delete Plugg title and Plugg description
            rep.DeleteAllPhTextForItem(p.PluggId, ETextItemType.PluggTitle);
            rep.DeleteAllPhTextForItem(p.PluggId, ETextItemType.PluggDescription);

            //Delete all Pluggcomponents
            PluggContainer pc = new PluggContainer("en-us", p.PluggId);
            pc.LoadComponents();
            foreach (PluggComponent c in pc.TheComponents)
            {
                switch (c.ComponentType)
                {
                    case EComponentType.YouTube:
                        YouTube yt = GetYouTubeByComponentId(c.PluggComponentId);
                        if (yt!=null)
                            rep.DeleteYouTube(yt);
                        break;
                    case EComponentType.RichRichText:
                        rep.DeleteAllPhTextForItem(c.PluggComponentId, ETextItemType.PluggComponentRichRichText);
                        break;
                    case EComponentType.RichText:
                        rep.DeleteAllPhTextForItem(c.PluggComponentId, ETextItemType.PluggComponentRichText);
                        break;
                    case EComponentType.Label:
                        rep.DeleteAllPhTextForItem(c.PluggComponentId, ETextItemType.PluggComponentLabel);
                        break;
                    case EComponentType.Latex:
                        rep.DeleteAllLatexForItem(c.PluggComponentId, ELatexItemType.PluggComponentLatex);
                        break;
                    default:
                        break;
                }
                rep.DeletePluggComponent(c);
            }

            //Delete Pluggentity
            rep.DeletePlugg(p);
        }
Ejemplo n.º 4
0
        protected void btnDeleteTab_Click(object sender, EventArgs e)
        {
            DNNHelper h = new DNNHelper();
            TabInfo t;
            string s = tbDeleteTabID.Text;

            if (s.IndexOf(',') > -1)
            {
                string[] tabIDs = s.Split(',');

                for (int i = 0; i < tabIDs.Length; i++)
                {
                    t = new TabInfo();
                    t.TabID = Convert.ToInt32(tabIDs[i]);
                    h.DeleteTab(t);
                }
            }
            else
            {
                int posOfDash = s.IndexOf('-');
                if (posOfDash > -1)
                {
                    string starts = s.Substring(0, posOfDash);
                    string ends = s.Substring(posOfDash + 1, s.Length - posOfDash - 1);
                    int startint = Convert.ToInt32(starts);
                    int endint = Convert.ToInt32(ends);
                    for (int tID = startint; tID <= endint; tID++)
                    {
                        t = new TabInfo();
                        t.TabID = tID;
                        h.DeleteTab(t);
                    }
                }
                else
                {
                    t = new TabInfo();
                    t.TabID = Convert.ToInt32(s);
                    h.DeleteTab(t);
                }
            }
            tbDeleteTabID.Text = "";
        }
Ejemplo n.º 5
0
        public void DeleteCourse(Course c)
        {
            // Todo: Don't delete Course if: It has comments or ratings
            if (c == null)
            {
                throw new Exception("Cannot delete: Course not initialized");
            }

            //Delete Course page
            if (c.TabId != 0)
            {
                DNNHelper h = new DNNHelper();
                h.DeleteTab(c.TabId);
            }

            rep.DeleteAllPhTextForItem(c.CourseId, ETextItemType.CourseTitle);
            rep.DeleteAllPhTextForItem(c.CourseId, ETextItemType.CourseDescription);
            rep.DeleteAllPhTextForItem(c.CourseId, ETextItemType.CourseRichRichText);
            var CPEs = GetCPEsInCourse(c.CourseId);
            foreach (CoursePluggEntity cp in CPEs)
            {
                rep.DeleteAllPhTextForItem(cp.CoursePluggId, ETextItemType.CoursePluggText);
                rep.DeleteCoursePlugg(cp);
            }

            rep.DeleteCourse(c);
        }