protected void btnOk_Click(object sender, EventArgs e) { try { if (txtTitle.Text.Trim() == "") { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Err", "alert('Please enter title !')", true); return; } BaseHandler bh = new BaseHandler(); List<object> cmpData = new List<object>(); PluggContainer pc = new PluggContainer(new Localization().CurrentCulture); //pc.ThePlugg.CreatedByUserId = this.UserId; //pc.ThePlugg.ModifiedByUserId = this.UserId; pc.ThePlugg.PluggId = 0; pc.SetTitle(txtTitle.Text); //pc.SetDescription(txtDescription.Text); PHText RichRichText = new PHText(); RichRichText.ItemType = ETextItemType.PluggComponentRichRichText; cmpData.Add(RichRichText); Plugghest.Base2.YouTube objYouTube = new Plugghest.Base2.YouTube(); cmpData.Add(objYouTube); bh.SavePlugg(pc, cmpData); txtTitle.Text = ""; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Success", "alert('New Plugg is created successfully')", true); } catch (Exception ex) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('Error : " + ex.Message + "')", true); } }
protected void btnSaveTitle_Click(object sender, EventArgs e) { BaseHandler bh = new BaseHandler(); PluggContainer pc = new PluggContainer(new Localization().CurrentCulture); pc.ThePlugg.CreatedByUserId = this.UserId; pc.ThePlugg.ModifiedByUserId = this.UserId; pc.ThePlugg.PluggId = 0; pc.ThePlugg.WhoCanEdit = (EWhoCanEdit)Enum.Parse(typeof(EWhoCanEdit), rdEditPlug.SelectedValue); pc.SetTitle(txtTitle.Text); pc.SetDescription(txtDescription.Text); List<object> cmpData = new List<object>(); foreach (string StrCmpData in hdcmpData.Value.Split(new string[] { "$#%#$%" }, StringSplitOptions.RemoveEmptyEntries)) { string[] straCmpData = StrCmpData.Split(new string[] { "$$$&$$$" }, StringSplitOptions.RemoveEmptyEntries); switch (straCmpData[0]) { case "RichRichText": PHText RichRichText = new PHText(); RichRichText.Text = straCmpData[1]; RichRichText.ItemType = ETextItemType.PluggComponentRichRichText; cmpData.Add(RichRichText); break; case "RichText": PHText RichText = new PHText(); RichText.Text = straCmpData[1]; RichText.ItemType = ETextItemType.PluggComponentRichText; cmpData.Add(RichText); break; case "Label": PHText Label = new PHText(); Label.Text = straCmpData[1]; Label.ItemType = ETextItemType.PluggComponentLabel; cmpData.Add(Label); break; case "Latex": PHLatex Latex = new PHLatex(straCmpData[1], new Localization().CurrentCulture,ELatexItemType.PluggComponentLatex); cmpData.Add(Latex); break; case "YouTube": Plugghest.Base2.YouTube objYouTube = new Plugghest.Base2.YouTube(); string[] strYoutubeval = straCmpData[1].Split(new string[] { "&&&$$&&&" }, StringSplitOptions.RemoveEmptyEntries); objYouTube.YouTubeAuthor = strYoutubeval[3]; objYouTube.YouTubeCode = strYoutubeval[2]; objYouTube.YouTubeComment = strYoutubeval[5]; objYouTube.YouTubeCreatedOn = Convert.ToDateTime(strYoutubeval[4]); objYouTube.YouTubeDuration = Convert.ToInt32(strYoutubeval[1]); objYouTube.YouTubeTitle = strYoutubeval[0]; cmpData.Add(objYouTube); break; } } bh.SavePlugg(pc, cmpData); }
protected void btnSelSub_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(hdnNodeSubjectId.Value)) { int id = Convert.ToInt32(hdnNodeSubjectId.Value); BaseHandler plugghandler = new BaseHandler(); this.PluggContainer.ThePlugg.SubjectId = id; this.PluggContainer.LoadTitle(); List<object> blankList = new List<object>(); BaseHandler bh = new BaseHandler(); try { bh.SavePlugg(this.PluggContainer, blankList); } catch (Exception) { } } Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", new string[] { "edit=" + EditStr, "language=" + this.CurrentLanguage })); }