protected Boolean CheckPlugg() { bool ischecked = true; CIInfo.Text = ""; BaseHandler ph = new BaseHandler(); //string pluggtext = "12,56,34,45k,56"; string pluggtext = txtPluggs.Text.Trim(); if (!string.IsNullOrEmpty(pluggtext)) { string[] itempluggs = pluggtext.Split(','); for (int i = 0; i < itempluggs.Length; i++) { int num; bool isNumeric = int.TryParse(itempluggs[i], out num);//check number..... if (isNumeric) { PluggContainer p = new PluggContainer(new Localization().CurrentCulture, num); // p.ThePlugg = ph.GetPlugg(num); if (p.ThePlugg != null) { p.CultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name; p.LoadTitle(); CIInfo.Text += num + ": " + p.TheTitle.Text + "<br />"; } else { CIInfo.Text += num + ": Error – Plugg " + num + " does not exist" + "<br />"; ischecked = false; } } else { CIInfo.Text = "Pluggs in wrong format."; ischecked = false; } } } return(ischecked); }
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); string subjectStr = Page.Request.QueryString["s"]; if (subjectStr != null) { int subid = Convert.ToInt32(subjectStr); pc.ThePlugg.SubjectId = subid; } else { pc.ThePlugg.SubjectId = 0; } pc.SetDescription(txtDescription.Text); pc.ThePlugg.WhoCanEdit = (EWhoCanEdit)Enum.Parse(typeof(EWhoCanEdit), rdbtnWhoCanEdit.SelectedValue); bh.CreateBasicPlugg(pc); txtTitle.Text = ""; txtDescription.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); } }
private bool CheckAddText() { string[] itempluggs = txtAddPlugg.Text.Trim().Split(','); int num; for (int i = 0; i < itempluggs.Length; i++) { if (!int.TryParse(itempluggs[i], out num)) { return(false); } } for (int i = 0; i < itempluggs.Length; i++) { PluggContainer p = new PluggContainer(Language, Convert.ToInt32(itempluggs[i])); if (p.ThePlugg == null) { return(false); } } return(true); }
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 btnCheckPluggs_Click(object sender, EventArgs e) { lblPluggInfo.Text = ""; BaseHandler ph = new BaseHandler(); //string pluggtext = "12,56,34,45,56"; string pluggtext = txtAddPlugg.Text.Trim(); if (!string.IsNullOrEmpty(pluggtext)) { string[] itempluggs = pluggtext.Split(','); //Check that entered Pluggs is in the correct format "12,56,34,45,56" int num; bool isNumeric; bool success = true; for (int i = 0; i < itempluggs.Length; i++) { isNumeric = int.TryParse(itempluggs[i], out num); if (!isNumeric) { success = false; } } if (!success) { lblPluggInfo.Text = Localization.GetString("IncorrectPluggString.Text", LocalResourceFile); return; } StringBuilder s = new StringBuilder(); s.Append("<ul>"); int pluggId; for (int i = 0; i < itempluggs.Length; i++) { pluggId = Convert.ToInt32(itempluggs[i]); PluggContainer p = new PluggContainer(Language, pluggId); s.Append("<li><strong>ID</strong>: ").Append(pluggId).Append(". "); if (p.ThePlugg != null) { p.LoadTitle(); p.LoadDescription(); s.Append("<strong>").Append(Localization.GetString("Title.Text", LocalResourceFile)).Append("</strong>: "); s.Append(p.TheTitle.Text); s.Append(". <strong>").Append(Localization.GetString("Description.Text", LocalResourceFile)).Append("</strong>: "); if (p.TheDescription != null) { s.Append(p.TheDescription.Text); } } else { s.Append(Localization.GetString("NoPlugg.Text", LocalResourceFile)); } s.Append("</li>"); } lblPluggInfo.Text = s.ToString(); } //return ischecked; }