private static string InternalMultiEasySearch(Tk5FieldInfoEx field, string nickName, IFieldValueProvider row, bool needId) { HtmlAttributeBuilder textBuilder = new HtmlAttributeBuilder(); textBuilder.Add("type", "text"); textBuilder.Add("data-regName", field.Decoder.RegName); AddInputAttribute(field, textBuilder, false); AddNormalAttribute(field, textBuilder, nickName, needId); SimpleFieldDecoder decoder = field.Decoder as SimpleFieldDecoder; if (decoder != null && decoder.RefFields != null) { EasySearchRefConfig[] config = decoder.RefFields.ToArray(); textBuilder.Add("data-refFields", config.WriteJson(WriteSettings.Default)); } StringBuilder multiItems = new StringBuilder(); string decodeValue = row[DecoderConst.DECODER_TAG + nickName].ToString(); if (string.IsNullOrEmpty(decodeValue)) { multiItems.AppendFormat(Html.MultiEasySearchItem, "hidden", string.Empty, string.Empty); } else { MultipleDecoderData data = MultipleDecoderData.ReadFromString(decodeValue); HtmlAttributeBuilder decodeBuilder = new HtmlAttributeBuilder(); foreach (var item in data) { decodeBuilder.Clear(); decodeBuilder.Add("data-id", item.Value); decodeBuilder.Add("data-name", item.Name); multiItems.AppendFormat(Html.MultiEasySearchItem, "multi-item", item.Name, decodeBuilder.CreateAttribute()); } } string easyUrl = "c/source/C/EasySearch".AppVirutalPath(); string dialogUrl = ("c/~source/C/EasySearchRedirect?RegName=" + field.Decoder.RegName).AppVirutalPath(); return(string.Format(ObjectUtil.SysCulture, Html.MultipleEasySearch, multiItems, textBuilder.CreateAttribute(), ERROR_LABEL, StringUtil.EscapeHtmlAttribute(easyUrl), StringUtil.EscapeHtmlAttribute(dialogUrl))); }
internal Tk5FieldInfoEx(AddFieldConfig field, IPageStyle style) { FieldName = field.FieldName; NickName = field.NickName; DataType = field.DataType; Length = field.Length; IsEmpty = field.IsEmpty; PlaceHolder = field.PlaceHolder; Kind = field.Kind; Hint = FieldConfigItem.ToString(field.Hint, null); if (field.Hint != null) { HintPosition = field.Hint.Position; } DisplayName = FieldConfigItem.ToString(field.DisplayName, string.Empty); InternalControl = new SimpleFieldControl(field.Control, field.Order, style.Style); if (field.CodeTable != null) { Decoder = new SimpleFieldDecoder(field.CodeTable, DecoderType.CodeTable); } else if (field.EasySearch != null) { Decoder = new SimpleFieldDecoder(field.EasySearch, DecoderType.EasySearch); } else { Decoder = new SimpleFieldDecoder(); } Extension = field.Extension; Layout = field.Layout; ResetExpression(); SetPageProperties(field.Edit, field.ListDetail, style); if (ListDetail != null) { ListDetail.TextHead = true; } else { ListDetail = new Tk5ListDetailConfig { TextHead = true } }; SetDisplay(style); }
private static string InternalEasySearch(Tk5FieldInfoEx field, string nickName, IFieldValueProvider row, bool needId, bool isSearchCtrl) { HtmlAttributeBuilder hiddenBuilder = new HtmlAttributeBuilder(); hiddenBuilder.Add("type", "hidden"); hiddenBuilder.Add("value", row[nickName].ToString()); string hiddenName = "hd" + nickName; if (needId) { hiddenBuilder.Add("id", hiddenName); } hiddenBuilder.Add("name", hiddenName); HtmlAttributeBuilder textBuilder = new HtmlAttributeBuilder(); textBuilder.Add("type", "text"); textBuilder.Add("data-regName", field.Decoder.RegName); AddInputAttribute(field, textBuilder, isSearchCtrl); AddNormalAttribute(field, textBuilder, nickName, needId); textBuilder.Add("value", row[DecoderConst.DECODER_TAG + nickName]); SimpleFieldDecoder decoder = field.Decoder as SimpleFieldDecoder; if (decoder != null) { if (decoder.RefFields != null) { EasySearchRefConfig[] config = decoder.RefFields.ToArray(); textBuilder.Add("data-refFields", config.WriteJson(WriteSettings.Default)); } if (decoder.Additions != null) { textBuilder.Add("data-addition", decoder.Additions.WriteJson(WriteSettings.Default)); } } string easyUrl = "c/source/C/EasySearch".AppVirutalPath(); string dialogUrl = ("c/~source/C/EasySearchRedirect?RegName=" + field.Decoder.RegName).AppVirutalPath(); return(string.Format(ObjectUtil.SysCulture, Html.EasySearch, hiddenBuilder.CreateAttribute(), textBuilder.CreateAttribute(), ERROR_LABEL, StringUtil.EscapeHtmlAttribute(easyUrl), StringUtil.EscapeHtmlAttribute(dialogUrl))); }