public static System.Collections.Generic.List <MLCategoryInfo> GetCategoriesAsListe(int PortalId, string Locale, bool FromCache)
        {
            System.Collections.Generic.Dictionary <string, StringInfo> dic = effority.Ealo.Controller.GetStringsByQualifier(CatQualifier, Locale, FromCache);
            CategoryController catController = new CategoryController();

            System.Collections.Generic.Dictionary <string, CategoryInfo> catDic    = catController.GetCatsByPortal(PortalId);
            System.Collections.Generic.List <MLCategoryInfo>             neueListe = new System.Collections.Generic.List <MLCategoryInfo>();

            foreach (CategoryInfo info in catDic.Values)
            {
                StringInfo     localizedCatName = null;
                MLCategoryInfo MLCatInfo        = new MLCategoryInfo(info);
                if (dic.TryGetValue(info.CatID, out localizedCatName))
                {
                    if (!string.IsNullOrEmpty(localizedCatName.StringText))
                    {
                        localizedCatName.FallBack       = MLCatInfo.CatName;
                        localizedCatName.FallbackIsNull = false;
                        MLCatInfo.MLCatName             = localizedCatName;
                    }
                }
                neueListe.Add(MLCatInfo);
            }
            return(neueListe);
        }
 public static List <MLCategoryInfo> LocalizedCategoryList(List <CategoryInfo> Categories, string Locale, bool FromCache)
 {
     System.Collections.Generic.Dictionary <string, StringInfo> dic       = effority.Ealo.Controller.GetStringsByQualifier(CatQualifier, Locale, FromCache);
     System.Collections.Generic.List <MLCategoryInfo>           neueListe = new System.Collections.Generic.List <MLCategoryInfo>();
     foreach (CategoryInfo info in Categories)
     {
         StringInfo     localizedCatName = null;
         MLCategoryInfo MLCatInfo        = new MLCategoryInfo(info);
         if (dic.TryGetValue(info.CatID, out localizedCatName))
         {
             MLCatInfo.MLCatName = localizedCatName;
         }
         neueListe.Add(MLCatInfo);
     }
     return(neueListe);
 }
        protected void repCats_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                MLCategoryInfo catInfo    = (MLCategoryInfo)e.Item.DataItem;
                Label          lblCatName = (Label)e.Item.FindControl("lblCatName");
                TextBox        txtCatName = (TextBox)e.Item.FindControl("txtCatName");
                HiddenField    catId      = (HiddenField)e.Item.FindControl("CatId");

                if (lblCatName != null)
                {
                    lblCatName.Text = catInfo.CatName;
                }

                bool CatNameTranslated = false;
                if (catInfo.MLCatName != null)
                {
                    CatNameTranslated = !catInfo.MLCatName.StringTextIsNull;
                }
                else
                {
                    CatNameTranslated = false;
                }

                if (!CatNameTranslated)
                {
                    txtCatName.Style.Add("border-color", "Red");
                    txtCatName.ToolTip = Localization.GetString("notTranslated", this.LocalResourceFile);
                }

                if (txtCatName != null && catInfo.MLCatName != null)
                {
                    txtCatName.Text = catInfo.MLCatName.StringText;
                }

                if (catId != null)
                {
                    catId.Value = catInfo.CatID;
                }
            }
        }
        public static MLCategoryInfo GetCategory(string catID, string Locale, bool FromCache)
        {
            StringInfo         CatName    = effority.Ealo.Controller.GetStringByQualifierAndStringName(CatQualifier, catID, Locale, FromCache);
            MLCategoryInfo     fMLCatInfo = null;
            CategoryController catCont    = new CategoryController();
            CategoryInfo       catInfo    = catCont.Load(catID);

            fMLCatInfo = new MLCategoryInfo(catInfo);
            if (CatName != null)
            {
                if (!String.IsNullOrEmpty(CatName.StringText))
                {
                    fMLCatInfo.MLCatName = CatName;
                }
            }
            //if (CatName!=null && String.IsNullOrEmpty(CatName.StringText))
            //{
            //    CatName.StringText = catInfo.CatName;
            //}
            //fMLCatInfo.MLCatName = CatName;
            return(fMLCatInfo);
        }
        public DataTable LoadTreeForMenu(int PortalID, int source, string codes, string parentCat, string Locale)
        {
            DataTable dt = null;
            if (source == 0)
            {
                dt = LoadTree(true, PortalID,"");
            }
            else if (source == 1)
            {
                dt = LoadTreeByCode(true, PortalID, codes);
            }
            else if (source == 2)
            {
                dt = LoadTreeByParents(true, PortalID, parentCat);
            }
            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("Link", typeof(string)));
            dt.Columns.Add(new DataColumn("Target", typeof(string)));
            dt.Columns.Add(new DataColumn("Image", typeof(string)));

            int MotherLevel = -1;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                bool visible = Convert.ToBoolean(dt.Rows[i]["Visible"]);
                int level = Convert.ToInt32(dt.Rows[i]["Level"]);
                if (visible)
                {
                    if (MotherLevel < level && MotherLevel != -1)
                    {
                        dt.Rows[i]["Visible"] = false;
                    }
                    else if (MotherLevel >= level)
                    {
                        MotherLevel = -1;
                    }
                }
                else
                {
                    if (MotherLevel < level && MotherLevel == -1)
                    {
                        MotherLevel = level;
                    }
                    else if (MotherLevel > level)
                    {
                        MotherLevel = level;
                    }
                    else if (MotherLevel == level)
                    {
                        MotherLevel = level;
                    }
                }

                dt.Rows[i]["Target"] = "_self";
                dt.Rows[i]["Image"] = "";
                int tabid = Convert.ToInt32(dt.Rows[i]["DesktopListID"]);
                string link = DotNetNuke.Common.Globals.NavigateURL(tabid, "", "categoryid/" + dt.Rows[i]["CatID"].ToString());
                if (dt.Rows[i]["NewsID"].ToString() != "0")
                {
                    tabid = Convert.ToInt32(dt.Rows[i]["DesktopViewID"]);
                    link = DotNetNuke.Common.Globals.NavigateURL(tabid, "", "id/" + dt.Rows[i]["NewsID"].ToString());
                }
                dt.Rows[i]["Link"] = link;
                MLCategoryInfo fMLCategory = MLCategoryController.GetCategory(dt.Rows[i]["CatID"].ToString(), Locale, false);
                if (fMLCategory != null)
                {
                    if (fMLCategory.MLCatName != null)
                    {
                        dt.Rows[i]["Name"] = fMLCategory.MLCatName.StringText;
                    }
                    else
                    {
                        dt.Rows[i]["Name"] = fMLCategory.CatName;
                    }
                }
                else
                {
                    dt.Rows[i]["Name"] = dt.Rows[i]["CatName"].ToString();
                }

            }

            for (int j = dt.Rows.Count - 1; j >= 0; j-- )
            {
                if (!Convert.ToBoolean(dt.Rows[j]["Visible"]))
                {
                    dt.Rows.RemoveAt(j);
                }
            }

            return dt;
        }
        public XmlDocument MLLoadTreeXML(string editFormatUrl, bool ismenu, int PortalID, int source, string codes, string parentCat, string Locale)
        {
            DataTable dt = null;
            if (source == 0)
            {
                dt = LoadTree(ismenu, PortalID,"");
            }
            else if (source == 1)
            {
                dt = LoadTreeByCode(ismenu, PortalID, codes);
            }
            else if (source == 2)
            {
                dt = LoadTreeByParents(ismenu, PortalID, parentCat);
            }

            XmlDocument doc = new XmlDocument();
            doc.LoadXml("<categories></categories>");
            XmlElement root = doc.DocumentElement;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                XmlElement category = doc.CreateElement("category");

                int tabid = Convert.ToInt32(dt.Rows[i]["DesktopListID"]);
                string link = DotNetNuke.Common.Globals.NavigateURL(tabid, "", "categoryid/" + dt.Rows[i]["CatID"].ToString());
                if (dt.Rows[i]["NewsID"].ToString() != "0")
                {
                    tabid = Convert.ToInt32(dt.Rows[i]["DesktopViewID"]);
                    link = DotNetNuke.Common.Globals.NavigateURL(tabid, "", "id/" + dt.Rows[i]["NewsID"].ToString());
                }
                string url_edit = editFormatUrl.Replace("@@catid", dt.Rows[i]["CatID"].ToString());

                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "ImgLevel1", DotNetNuke.Common.Globals.ApplicationPath + "/images/action_right.gif");
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "ImgLevel2", DotNetNuke.Common.Globals.ApplicationPath + "/images/edit.gif");
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "OrderNumber", dt.Rows[i]["OrderNumber"].ToString());
                MLCategoryInfo fMLCat = MLCategoryController.GetCategory(dt.Rows[i]["CatID"].ToString(), Locale, false);
                if (fMLCat != null)
                {
                    if (fMLCat.MLCatName != null)
                    {
                        DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "CatName", fMLCat.MLCatName.StringTextOrFallBack);
                    }
                    else
                    {
                        DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "CatName", fMLCat.CatName);
                    }
                }
                else
                {
                    DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "CatName", dt.Rows[i]["CatName"].ToString());
                }
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "Level", dt.Rows[i]["Level"].ToString());
                string indent = "";
                int level = int.Parse(dt.Rows[i]["Level"].ToString());

                for (int j = 1; j < level; j++)
                {
                    indent += HttpContext.Current.Server.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;");
                }
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "Indent", indent);
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "CatCode", dt.Rows[i]["CatCode"].ToString());
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "PortalID", dt.Rows[i]["PortalID"].ToString());
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "link", link);
                DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "url_edit", url_edit);
                if (i % 2 == 1)
                    DotNetNuke.NewsProvider.Utils.AddNode(doc, category, "odd", "true");

                root.AppendChild(category);
            }

            return doc;
        }