コード例 #1
0
        public static Dictionary <string, string> GetProfileDataNames(string vRoot, UserProfileDataKey key)
        {
            XDocument doc = null;

            if (HttpRuntime.Cache["ProfileData"] != null)
            {
                doc = (XDocument)HttpRuntime.Cache["ProfileData"];
            }
            else
            {
                doc = XDocument.Load(HttpContext.Current.Server.MapPath(string.Format("{0}/Configurations/ProfileData.config", vRoot)));
                HttpRuntime.Cache.Insert("ProfileData", doc);
            }

            var config = doc.Element("Root");
            var names  = from personalItems in config.Elements("Personal").Where(p => p.Attribute("DBField").Value == key.ToString()) from personalItem in personalItems.Elements("PeronalItem").Where(p => p.Attribute("Condition").Value == "Update" || p.Attribute("Condition").Value == "None") from friendlyName in personalItem.Elements("FriendlyName").Where(f => f.Attribute("Lang").Value == "de-ch") select new { Name = friendlyName.Value, Value = personalItem.Element("Value").Value };

            return(names.ToDictionary(k => k.Value, k => k.Name));
        }
コード例 #2
0
        public static void FillProfileDataList(string vRoot, DropDownList ddl, UserProfileDataKey key, bool isSearch)
        {
            XDocument doc = null;

            if (HttpRuntime.Cache["ProfileData"] != null)
            {
                doc = (XDocument)HttpRuntime.Cache["ProfileData"];
            }
            else
            {
                doc = XDocument.Load(HttpContext.Current.Server.MapPath(string.Format("{0}/Configurations/ProfileData.config", vRoot)));
                HttpRuntime.Cache.Insert("ProfileData", doc);
            }

            var config       = doc.Element("Root");
            var dropDownList = from personalItems in config.Elements("Personal").Where(p => p.Attribute("DBField").Value == key.ToString()) from personalItem in personalItems.Elements("PeronalItem").Where(p => (isSearch && p.Attribute("Condition").Value == "Search") || (!isSearch && p.Attribute("Condition").Value == "Update") || p.Attribute("Condition").Value == "None") from friendlyName in personalItem.Elements("FriendlyName").Where(f => f.Attribute("Lang").Value == "de-ch") select new { Text = friendlyName.Value, Value = personalItem.Element("Value").Value };

            ddl.Items.Clear();
            foreach (var item in dropDownList)
            {
                ddl.Items.Add(new ListItem()
                {
                    Text = item.Text, Value = item.Value
                });
            }
        }
コード例 #3
0
        public static string GetProfileDataTitle(string vRoot, UserProfileDataKey key)
        {
            XDocument doc = null;

            if (HttpRuntime.Cache["ProfileData"] != null)
            {
                doc = (XDocument)HttpRuntime.Cache["ProfileData"];
            }
            else
            {
                doc = XDocument.Load(HttpContext.Current.Server.MapPath(string.Format("{0}/Configurations/ProfileData.config", vRoot)));
                HttpRuntime.Cache.Insert("ProfileData", doc);
            }

            var config = doc.Element("Root");
            var name   = from personalItems in config.Elements("Personal").Where(p => p.Attribute("DBField").Value == key.ToString()) from friendlyName in personalItems.Elements("FriendlyName").Where(f => f.Attribute("Lang").Value == "de-ch") select friendlyName.Value;

            return(name.SingleOrDefault());
        }