Exemplo n.º 1
0
        public override void Fill(params object[] args)
        {
            FillData(args);

            DataSet ds = ObjectUtil.QueryObject <DataSet>(args);

            if (ds != null)
            {
                string regName = RegName;
                if (!ds.Tables.Contains(regName))
                {
                    DataTable table = fDataTable.Copy();
                    ds.Tables.Add(table);
                }
                return;
            }

            CodeTableContainer container = ObjectUtil.QueryObject <CodeTableContainer>(args);

            if (container != null)
            {
                List <CodeItem> result = new List <CodeItem>(fDataTable.Rows.Count);
                foreach (DataRow row in fDataTable.Rows)
                {
                    CodeItem item = new CodeItem(row[DecoderConst.CODE_NICK_NAME].ToString(),
                                                 row[DecoderConst.NAME_NICK_NAME].ToString());
                    result.Add(item);
                }
                container.Add(RegName, result);
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public override void Fill(params object[] args)
        {
            DataSet ds = ObjectUtil.QueryObject <DataSet>(args);

            if (ds != null)
            {
                string regName = RegName;
                if (!ds.Tables.Contains(regName))
                {
                    DataTable table = fData.CreateTable(regName);
                    ds.Tables.Add(table);
                }
                return;
            }

            CodeTableContainer container = ObjectUtil.QueryObject <CodeTableContainer>(args);

            if (container != null)
            {
                container.Add(RegName, fData);
            }
        }
Exemplo n.º 4
0
        public override void Fill(params object[] args)
        {
            DataSet ds = ObjectUtil.QueryObject <DataSet>(args);

            if (ds != null)
            {
                string regName = RegName;
                if (!ds.Tables.Contains(regName))
                {
                    var fields = from item in fList
                                 select new CodeItem(item);
                    DataTable table = fields.CreateTable(regName);
                    ds.Tables.Add(table);
                }
                return;
            }

            CodeTableContainer container = ObjectUtil.QueryObject <CodeTableContainer>(args);

            if (container != null)
            {
                container.Add(RegName, fList);
            }
        }