예제 #1
0
        /// <summary>
        /// Loads an existing Plugg in the language cultureCode
        /// </summary>
        /// <param name="cultureCode"></param>
        /// <param name="pluggId"></param>
        public PluggContainer(string cultureCode, int pluggId)
        {
            BaseRepository rep = new BaseRepository();

            CultureCode = cultureCode;
            ThePlugg    = rep.GetPlugg(pluggId);
        }
예제 #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);
        }
예제 #3
0
 public void CreatePlugg(Plugg t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository<Plugg>();
         rep.Insert(t);
     }
 }
예제 #4
0
 public void DeletePlugg(Plugg plugg)
 {
     using (IDataContext db = DataContext.Instance())
     {
         var rep = db.GetRepository <Plugg>();
         rep.Delete(plugg);
     }
 }
예제 #5
0
 public void CreatePlugg(Plugg t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository <Plugg>();
         rep.Insert(t);
     }
 }
예제 #6
0
 /// <summary>
 /// Loads an existing Plugg in the language cultureCode
 /// </summary>
 /// <param name="cultureCode"></param>
 /// <param name="pluggId"></param>
 public PluggContainer(string cultureCode, int pluggId)
 {
     BaseRepository rep = new BaseRepository();
     CultureCode = cultureCode;
     ThePlugg = rep.GetPlugg(pluggId);
 }
예제 #7
0
 /// <summary>
 /// Base constructor. Creates a new Plugg in the language cultureCode.
 /// </summary>
 /// <param name="cultureCode"></param>
 public PluggContainer(string cultureCode)
 {
     ThePlugg = new Plugg();
     CultureCode = cultureCode;
 }
예제 #8
0
 public void UpdatePlugg(Plugg plugg)
 {
     using (IDataContext db = DataContext.Instance())
     {
         var rep = db.GetRepository<Plugg>();
         rep.Update(plugg);
     }
 }
예제 #9
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);
        }
예제 #10
0
 /// <summary>
 /// Base constructor. Creates a new Plugg in the language cultureCode.
 /// </summary>
 /// <param name="cultureCode"></param>
 public PluggContainer(string cultureCode)
 {
     ThePlugg    = new Plugg();
     CultureCode = cultureCode;
 }
예제 #11
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);
        }