/// <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); }
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); }
public void CreatePlugg(Plugg t) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository<Plugg>(); rep.Insert(t); } }
public void DeletePlugg(Plugg plugg) { using (IDataContext db = DataContext.Instance()) { var rep = db.GetRepository <Plugg>(); rep.Delete(plugg); } }
public void CreatePlugg(Plugg t) { using (IDataContext ctx = DataContext.Instance()) { var rep = ctx.GetRepository <Plugg>(); rep.Insert(t); } }
/// <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; }
public void UpdatePlugg(Plugg plugg) { using (IDataContext db = DataContext.Instance()) { var rep = db.GetRepository<Plugg>(); rep.Update(plugg); } }
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); }