Beispiel #1
0
        public override void FillCodeTable(IPageStyle style)
        {
            TkDebug.AssertArgumentNull(style, "style", this);

            if (style.Style == PageStyle.List)
            {
                var queryCodeTables = (from field in CurrentSchemeEx.Fields
                                       let tk5Field = field as ITk5FieldInfo
                                                      where IsQueryField(tk5Field)
                                                      select tk5Field.Decoder.RegName).Distinct().ToArray();
                if (queryCodeTables.Length == 0)
                {
                    return;
                }

                InitializeCodeTable(style);
                foreach (string regName in queryCodeTables)
                {
                    CodeTable code = CodeTables.GetFilledCodeTable(regName);
                    if (code != null)
                    {
                        code.Fill(HostDataSet, Context);
                    }
                }
            }
            else
            {
                base.FillCodeTable(style);
            }
        }
Beispiel #2
0
        public override OutputData DoAction(IInputData input)
        {
            CodeTable table = PlugInFactoryManager.CreateInstance <CodeTable>(
                CodeTablePlugInFactory.REG_NAME, RegName);

            table.Fill(DataSet, Context);
            return(OutputData.Create(DataSet));
        }
Beispiel #3
0
        // checkbox下拉菜单选项值
        public static IEnumerable <IDecoderItem> GetDecoderItem(Tk5FieldInfoEx fieldInfo)
        {
            CodeTableContainer ctContainer = new CodeTableContainer();
            string             regName     = fieldInfo.Decoder.RegName;
            CodeTable          codeTable   = PlugInFactoryManager.CreateInstance <CodeTable>(
                CodeTablePlugInFactory.REG_NAME, regName);

            codeTable.Fill(ctContainer);
            IEnumerable <IDecoderItem> data = ctContainer[regName];

            return(data);
        }
        public CodeTableColumnReader(Tk5FieldInfoEx fieldInfo, TkDbContext context, int cellIndex)
            : base(fieldInfo, cellIndex)
        {
            CodeTableContainer ctContainer = new CodeTableContainer();
            string             regName     = fieldInfo.Decoder.RegName;
            CodeTable          codeTable   = PlugInFactoryManager.CreateInstance <CodeTable>(
                CodeTablePlugInFactory.REG_NAME, regName);

            codeTable.Fill(ctContainer, context);
            IEnumerable <IDecoderItem> data = ctContainer[regName];

            fCodeTable = new Dictionary <string, IDecoderItem>();
            foreach (var item in data)
            {
                fCodeTable[item.Name] = item;
            }
        }
Beispiel #5
0
        public RegNameList <ListTabSheet> CreateTabSheet(IDbDataSource dataSource,
                                                         IFieldInfoIndexer indexer)
        {
            if (TabSheets != null)
            {
                RegNameList <ListTabSheet> result = new RegNameList <ListTabSheet>();
                foreach (var item in TabSheets)
                {
                    string sql = item.Condition == null ? null :
                                 Expression.Execute(item.Condition, dataSource);
                    IParamBuilder builder = string.IsNullOrEmpty(sql) ? null :
                                            SqlParamBuilder.CreateSql(sql);
                    result.Add(new ListTabSheet(item.Id,
                                                item.Caption.ToString(ObjectUtil.SysCulture), builder));
                }
                return(result);
            }
            if (CodeTabSheet != null)
            {
                RegNameList <ListTabSheet> result = new RegNameList <ListTabSheet>();
                if (CodeTabSheet.NeedAllTab)
                {
                    result.Add(new ListTabSheet("_All", "全部", null));
                }
                CodeTable table = PlugInFactoryManager.CreateInstance <CodeTable>(
                    CodeTablePlugInFactory.REG_NAME, CodeTabSheet.CodeRegName);
                YJC.Toolkit.Decoder.CodeTableContainer data = new YJC.Toolkit.Decoder.CodeTableContainer();
                table.Fill(data, dataSource.Context);

                var        tableData = data[CodeTabSheet.CodeRegName];
                IFieldInfo info      = indexer[CodeTabSheet.NickName];
                TkDebug.AssertNotNull(info, "", this);
                foreach (var item in tableData)
                {
                    IParamBuilder builder  = SqlParamBuilder.CreateEqualSql(dataSource.Context, info, item.Value);
                    var           tabSheet = new ListTabSheet(item.Value, item.Name, builder);
                    result.Add(tabSheet);
                }
                return(result);
            }

            return(null);
        }