コード例 #1
0
ファイル: ListsManager.cs プロジェクト: gvhung/nokta-crm
        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("�", ""));
        }
コード例 #2
0
ファイル: ResourceManager.cs プロジェクト: gvhung/nokta-crm
        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);
        }