Exemple #1
0
        public JsonFieldList(string tableName, IEnumerable <Tk5FieldInfoEx> fields)
        {
            Table = tableName;
            var regList = new RegNameList <JsonField>();

            Fields = regList;
            if (fields == null)
            {
                return;
            }

            foreach (var field in fields)
            {
                ControlHtmlPlugInFactory factroy = BaseGlobalVariable.Current
                                                   .FactoryManager.GetCodeFactory(ControlHtmlPlugInFactory.REG_NAME)
                                                   .Convert <ControlHtmlPlugInFactory>();
                string ctrl       = field.ControlName;
                var    searchCtrl = factroy.GetSearchControl(ctrl, field);

                Fields.Add(new JsonField(field.NickName, searchCtrl));
                if (field.ListDetail != null && field.ListDetail.Span)
                {
                    Fields.Add(new JsonField(field.NickName + "END", searchCtrl));
                }
            }
        }
Exemple #2
0
        public static string SearchControlHtml(this Tk5FieldInfoEx field, IFieldValueProvider provider)
        {
            ControlHtmlPlugInFactory factroy = BaseGlobalVariable.Current
                                               .FactoryManager.GetCodeFactory(ControlHtmlPlugInFactory.REG_NAME)
                                               .Convert <ControlHtmlPlugInFactory>();
            string ctrl = field.ControlName;
            string searchCtrl;
            bool   isRange;

            if (field.ListDetail != null && field.ListDetail.Span)
            {
                searchCtrl = factroy.GetRangeControl(ctrl, field);
                isRange    = true;
            }
            else
            {
                searchCtrl = factroy.GetSearchControl(ctrl, field);
                isRange    = false;
            }
            bool changeEmpty = !field.IsEmpty;

            if (changeEmpty)
            {
                field.IsEmpty = true;
            }

            string res = GetCtrlHtml(field, provider, searchCtrl, factroy, true);

            if (!isRange)
            {
                res = string.Format(ObjectUtil.SysCulture, SPAN_CTRL, res);
            }

            if (changeEmpty)
            {
                field.IsEmpty = false;
            }
            return(res);
        }