Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string CultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name;
                string Title = ((DotNetNuke.Framework.CDefault)this.Page).Title;

                if(Title[0]=='C')
                {
                    Title = Title.Replace("C", "");
                    int CourseId = Convert.ToInt32(Title);
                    CourseContainer cc = new CourseContainer(CultureCode, CourseId);
                    if(cc.TheCourse.CreatedInCultureCode != CultureCode)
                    {
                        cc.LoadTitle();
                        lblTitle.Text = cc.TheTitle.Text;
                    }
                }
                else
                {
                    int PluggId = Convert.ToInt32(Title);
                    PluggContainer pc = new PluggContainer(CultureCode, PluggId);
                    if (pc.ThePlugg.CreatedInCultureCode != CultureCode)
                    {
                        pc.LoadTitle();
                        lblTitle.Text = pc.TheTitle.Text;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
 private void PopulateTreeNodes(List<CoursePlugg> cps, TreeNodeCollection RootNodes)
 {
     foreach (CoursePlugg cp in cps)
     {
         TreeNode NodeToAdd = new TreeNode();
         PluggContainer p = new PluggContainer(CultureCode, cp.PluggId);
         p.LoadTitle();
         NodeToAdd.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(p.ThePlugg.TabId, "", "cp=" + cp.CoursePluggId);
         NodeToAdd.Text = p.TheTitle.Text;
         NodeToAdd.SelectAction = TreeNodeSelectAction.Select;
         if (cp.CoursePluggId == CoursePluggId)
             NodeToAdd.Text = "<strong>" + p.TheTitle.Text + "</strong>";
         RootNodes.Add(NodeToAdd);
         if (cp.children != null)
             PopulateTreeNodes((List<CoursePlugg>)cp.children, NodeToAdd.ChildNodes);
     }
 }