/// <summary> /// 拼接数据项的设置参数 /// </summary> /// <returns></returns> public String SetItemSettings(ref List <KeyValueEntity> list, List <SettingEntity> x_OptionList) { //获取效果参数 List <SettingEntity> ItemSettingDB = x_OptionList; if (ItemSettingDB != null && ItemSettingDB.Count > 0) { ControlHelper ControlItem = new ControlHelper(PortalId); foreach (SettingEntity ri in ItemSettingDB) { KeyValueEntity OldKV = ItemValues.Find(r1 => r1.Key == ri.Name); if (OldKV != null && !String.IsNullOrEmpty(OldKV.Value)) { ri.DefaultValue = OldKV.Value; } KeyValueEntity item = new KeyValueEntity(); item.Key = ri.Name; item.Value = ControlHelper.GetWebFormValue(ri, this); list.Add(item); } } return(ConvertTo.Serialize <List <KeyValueEntity> >(list)); }
protected void RepeaterOptions_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { SettingEntity ThemeSetting = (e.Item.DataItem as SettingEntity).Clone(); KeyValueEntity KeyValue = ItemValues.Find(r1 => r1.Key == ThemeSetting.Name); if (KeyValue != null && !String.IsNullOrEmpty(KeyValue.Key)) { ThemeSetting.DefaultValue = KeyValue.Value.ToString(); } //构造输入控件 PlaceHolder ThemePH = e.Item.FindControl("ThemePH") as PlaceHolder; #region "创建控件" ControlHelper ctl = new ControlHelper(this); ThemePH.Controls.Add((Control)ctl.ViewControl(ThemeSetting)); #endregion Literal liTitle = e.Item.FindControl("liTitle") as Literal; liTitle.Text = ViewTitleAndHelp(ThemeSetting); if (!String.IsNullOrEmpty(ThemeSetting.Description)) { Literal liHelp = e.Item.FindControl("liHelp") as Literal; liHelp.Text = String.Format("<span class=\"help-block\"><i class=\"fa fa-info-circle\"></i> {0}</span>", ThemeSetting.Description); } } }
/// <summary> /// 读取XML参数 /// </summary> /// <param name="Name">参数名</param> /// <param name="DefaultValue">默认值</param> /// <returns></returns> public object ViewXmlSetting(String Name, object DefaultValue) { String o = String.Empty; if (!String.IsNullOrEmpty(Name) && ItemValues != null && ItemValues.Count > 0) { KeyValueEntity item = ItemValues.Find(r1 => r1.Key == Name); if (item != null && item.Key == Name) { o = item.Value.ToString(); } } return(!String.IsNullOrEmpty(o) ? ConvertTo.FormatValue(o, DefaultValue.GetType()) : DefaultValue); }