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 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; }