예제 #1
0
        public static SortedList GetListItemsByListType(string DropDownType, string Filter, string defValue = "--")
        {
            string lang   = "@Name";
            string xQuery = String.Format("Lists/List[@Key='{0}']/Item", DropDownType);

            if (!string.IsNullOrEmpty(Filter))
            {
                xQuery += string.Format("[@Relation='{0}']", Filter);
            }
            SortedList htResult = new SortedList();
            string     filePath = string.Format(ConfigManager.Current.pathForLists, Util.CurrentUserLang);

            foreach (XmlNode node in CachedDocumentManager.GetXmlNodeList(filePath, xQuery))
            {
                string  v = node.SelectSingleNode("@Value").InnerText;
                string  n;
                XmlNode nameNode = node.SelectSingleNode(lang);
                if (nameNode == null)
                {
                    nameNode = node.SelectSingleNode("@Name");
                }
                n = (nameNode == null) ? defValue : nameNode.InnerText;

                if (!htResult.ContainsKey(n))
                {
                    htResult.Add(n, v);
                }
            }
            return(htResult);
        }
예제 #2
0
        public static string GetLookupText(string Value, string DropDownType, string defValue = "--")
        {
            string      text     = string.Empty;
            XmlDocument Document = CachedDocumentManager.GetCachedDocument(string.Format(ConfigManager.Current.pathForLists, Util.CurrentUserLang));

            if (Document != null)
            {
                string xPath = "Lists/List[@Key='{0}']/Item[@Value='{1}']";
                string lang  = "@Name";

                XmlNode node = Document.SelectSingleNode(String.Format(xPath, DropDownType.ToString(), Value));
                if (node != null)
                {
                    XmlNode nLang = node.SelectSingleNode(lang);
                    if (nLang == null)
                    {
                        text = defValue;
                    }
                    else
                    {
                        text = nLang.InnerText.Trim();
                    }
                }

                else
                {
                    text = defValue;
                }
            }
            return(text.Replace("�", ""));
        }
예제 #3
0
        private static Dictionary <string, Dictionary <string, string> > GetResourceContainer(string [] Languages,
                                                                                              string xpath = "Items/Item", string nameKey = "@Name", string valKey = "@Value")
        {
            Dictionary <string, Dictionary <string, string> > Container = new Dictionary <string, Dictionary <string, string> >();

            foreach (string lang in Languages)
            {
                XmlDocument wordDoc = CachedDocumentManager.GetCachedDocument(string.Format(ConfigManager.Current.pathForResources, lang));
                Dictionary <string, string> words = new Dictionary <string, string>();

                foreach (XmlNode oNode in wordDoc.SelectNodes(xpath))
                {
                    try { words.Add(oNode.SelectSingleNode(nameKey).InnerText, oNode.SelectSingleNode(valKey).InnerText); }
                    catch (Exception) { }
                }

                Container.Add(lang, words);
            }
            return(Container);
        }
예제 #4
0
        public static Dictionary <string, int> GetItemsByListType(string DropDownType)
        {
            string lang   = "@Name";
            string xQuery = String.Format("Lists/List[@Key='{0}']/Item", DropDownType);

            var    htResult = new Dictionary <string, int>();
            string filePath = string.Format(ConfigManager.Current.pathForLists, Util.CurrentUserLang);

            foreach (XmlNode node in CachedDocumentManager.GetXmlNodeList(filePath, xQuery))
            {
                string  v        = node.SelectSingleNode("@Value").InnerText;
                XmlNode nameNode = node.SelectSingleNode(lang);
                nameNode = nameNode ?? node.SelectSingleNode("@Name");
                if (nameNode == null || nameNode.InnerText.NullOrEmpty())
                {
                    continue;
                }

                htResult[nameNode.InnerText] = v.ToInt();
            }
            return(htResult);
        }