public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            ITableSchemeEx scheme  = Scheme.CreateObject();
            Tk5DataXml     dataXml = scheme as Tk5DataXml;

            if (dataXml == null)
            {
                return new MetaDataTableResolver(scheme, source)
                       {
                           AutoTrackField = AutoTrackField,
                           AutoUpdateKey  = AutoUpdateKey
                       }
            }
            ;
            else
            {
                return new Tk5TableResolver(dataXml, source)
                       {
                           AutoTrackField = AutoTrackField,
                           AutoUpdateKey  = AutoUpdateKey
                       }
            };
        }
    }
Exemple #2
0
        public IMetaData CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            ITableSchemeEx scheme = CreateSourceScheme(input);

            switch (input.Style.Style)
            {
            case PageStyle.Insert:
            case PageStyle.Update:
            case PageStyle.Detail:
                return(new Tk5SingleNormalMetaData(scheme, input, this));

            case PageStyle.List:
                return(new Tk5ListMetaData(scheme, input, this));

            case PageStyle.Custom:
                if (input.Style.Operation == "DetailList")
                {
                    InputDataProxy proxy = new InputDataProxy(input, (PageStyleClass)PageStyle.List);
                    return(new Tk5ListMetaData(scheme, proxy, this));
                }
                else
                {
                    var metaData = SchemeUtil.CreateVueMetaData(input, scheme, this);
                    if (metaData != null)
                    {
                        return(metaData);
                    }
                }
                break;
            }
            return(null);
        }
Exemple #3
0
        protected override FieldErrorInfo CheckError(IInputData inputData, string value,
                                                     int position, params object[] args)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }
            string original = null;

            try
            {
                DataRow row = HostDataSet.Tables[TableName].Rows[position];
                original = row[Field.NickName, DataRowVersion.Original].ToString();
            }
            catch
            {
            }
            if (!string.IsNullOrEmpty(original) && original == value)
            {
                return(null);
            }
            else
            {
                TkDbContext context = ObjectUtil.ConfirmQueryObject <TkDbContext>(this, args);

                IParamBuilder builder = SqlParamBuilder.CreateEqualSql(context, Field, value);
                int           count   = DbUtil.ExecuteScalar("SELECT COUNT(*) FROM " + TableName,
                                                             context, builder).Value <int>();
                if (count > 0)
                {
                    return(CreateErrorObject(Message));
                }
                return(null);
            }
        }
        public IPageMaker CreateObject(params object[] args)
        {
            IPageData pageData = ObjectUtil.ConfirmQueryObject <IPageData>(this, args);

            CompositePageMaker pageMaker = new CompositePageMaker(pageData);

            if (Items != null)
            {
                foreach (var item in Items)
                {
                    try
                    {
                        IPageMaker itemMaker = item.PageMaker.CreateObject(args);
                        pageMaker.Add(item.Condition.UseCondition, itemMaker);
                    }
                    catch
                    {
                    }
                }
            }

            pageMaker.InternalSetCallInfo(pageData);

            return(pageMaker);
        }
Exemple #5
0
        public IMetaData CreateObject(params object[] args)
        {
            IInputData      input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);
            ITableSchemeEx  scheme;
            ISingleMetaData masterMeta;

            switch (input.Style.Style)
            {
            case PageStyle.Insert:
            case PageStyle.Update:
            case PageStyle.Detail:
                masterMeta = Master.CreateSingleMetaData();
                return(new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta),
                                               DetailItems));

            //return new Tk5SingleNormalMetaData(scheme, input, this);
            //break;
            case PageStyle.List:
                masterMeta = Master.CreateSingleMetaData();
                scheme     = masterMeta.CreateSourceScheme(input);
                return(new Tk5ListMetaData(scheme, input, masterMeta));

            case PageStyle.Custom:
                bool      shouldReturn;
                IMetaData result = CreateDetailListMeta(input, DetailItems, out shouldReturn);
                if (shouldReturn)
                {
                    return(result);
                }
                break;
            }
            return(null);
        }
Exemple #6
0
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            return(PlugInFactoryManager.CreateInstance <TableResolver>(
                       ResolverPlugInFactory.REG_NAME, Content, source));
        }
Exemple #7
0
        public ITree CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            LevelTreeDefinition treeDef = fConfig.TreeDefinition;

            return(CreateTree(SourceScheme, treeDef, source));
        }
Exemple #8
0
        public ITree CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            ITableScheme scheme = TableScheme.CreateObject();

            return(CreateTree(scheme, LevelTree, source));
        }
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            ITableScheme scheme = Scheme.CreateObject();

            return(new TableResolver(scheme, source));
        }
Exemple #10
0
        public BaseListSearch CreateObject(params object[] args)
        {
            IFieldInfoIndexer indexer = ObjectUtil.ConfirmQueryObject <IFieldInfoIndexer>(this, args);
            IFieldInfo        current = ObjectUtil.ConfirmQueryObject <IFieldInfo>(this, args);

            var fields = EnumUtil.Convert(current, GetFieldInfoList(indexer));

            return(new MultipleFieldListSearch(fields.ToArray()));
        }
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            ITableSchemeEx   scheme   = Scheme.CreateObject();
            SqlTableResolver resolver = new SqlTableResolver(Sql, scheme, source);

            return(resolver);
        }
Exemple #12
0
        public IDataRight CreateObject(params object[] args)
        {
            IFieldInfoIndexer indexer = ObjectUtil.ConfirmQueryObject <IFieldInfoIndexer>(this, args);

            IFieldInfo ownerField = indexer[NickName];

            TkDebug.AssertNotNull(ownerField, string.Format(ObjectUtil.SysCulture,
                                                            "没有找到昵称为{0}的字段", NickName), indexer);
            return(CreateDataRight(ownerField).SetErrorText(ErrorMessage));
        }
Exemple #13
0
        public ISource CreateObject(params object[] args)
        {
            IInputData input     = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);
            string     tableName = UseQueryString ? input.QueryString[TableName] : TableName;

            var style = input.Style.Style;

            if (!input.IsPost)
            {
                switch (style)
                {
                case PageStyle.Insert:
                    return(new StdCodeTableInsertSource(this, tableName));

                case PageStyle.Delete:
                    return(new StdCodeTableDeleteSource(this, tableName));

                case PageStyle.Update:
                case PageStyle.Detail:
                    return(new StdCodeTableDetailSource(this, tableName));

                case PageStyle.List:
                    return(new StdCodeTableListSource(this, tableName));

                case PageStyle.Custom:
                    switch (input.Style.Operation)
                    {
                    case "Pinyin":
                        return(new PinyinSource(this, tableName));

                    case "FakeDelete":
                        return(new ChangeDelSource(this, tableName, "1"));

                    case "Restore":
                        return(new ChangeDelSource(this, tableName, "0"));
                    }
                    break;
                }
            }
            else
            {
                switch (style)
                {
                case PageStyle.Insert:
                case PageStyle.Update:
                    return(new StdCodeTableEditSource(this, tableName));

                case PageStyle.List:
                    return(new StdCodeTableListSource(this, tableName));
                }
            }

            return(null);
        }
        public BaseListSearch CreateObject(params object[] args)
        {
            IFieldInfoIndexer indexer = ObjectUtil.ConfirmQueryObject <IFieldInfoIndexer>(this, args);
            IFieldInfo        current = ObjectUtil.ConfirmQueryObject <IFieldInfo>(this, args);

            IFieldInfo other = indexer[OtherNickName];

            TkDebug.AssertNotNull(other, string.Format(ObjectUtil.SysCulture,
                                                       "{0}不存在,请确认配置是否正确", OtherNickName), this);
            return(new TwoFieldListSearch(current, other));
        }
Exemple #15
0
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source  = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);
            TkDbContext   context = string.IsNullOrEmpty(Context) ? DbContextUtil.CreateDefault()
                : DbContextUtil.CreateDbContext(Context);

            using (context)
            {
                var scheme   = DbUtil.CreateSqlTableScheme(Sql, TableName, KeyFields, context);
                var schemeEx = MetaDataUtil.ConvertToTableSchemeEx(scheme);
                return(new SqlTableResolver(Sql, schemeEx, source));
            }
        }
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            if (string.IsNullOrEmpty(TableName))
            {
                return(new Tk5TreeTableResolver(DataXml, source));
            }
            else
            {
                return(new Tk5TreeTableResolver(DataXml, TableName, source));
            }
        }
        public ITree CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            ITableScheme scheme = TableScheme.CreateObject();
            NormalDbTree dbTree = new NormalDbTree(scheme, DbTree, source);

            if (DataRight != null)
            {
                dbTree.DataRight = DataRight.CreateObject(dbTree);
            }
            return(dbTree);
        }
        public IMetaData CreateObject(params object[] args)
        {
            IInputData      input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);
            ITableSchemeEx  scheme;
            ISingleMetaData masterMeta;

            switch (input.Style.Style)
            {
            case PageStyle.Insert:
            case PageStyle.Update:
            case PageStyle.Detail:
                masterMeta = Master.CreateSingleMetaData();
                IEnumerable <ISingleMetaData> oneToOneMeta;
                if (OneToOneTables == null)
                {
                    oneToOneMeta = null;
                }
                else
                {
                    oneToOneMeta = (from item in OneToOneTables
                                    select item.CreateSingleMetaData());
                }
                var data = new Tk5MultipleMetaData(input,
                                                   EnumUtil.Convert(masterMeta, oneToOneMeta), OneToManyTables);
                return(data);

            case PageStyle.List:
                masterMeta = Master.CreateSingleMetaData();
                scheme     = masterMeta.CreateSourceScheme(input);
                return(new Tk5ListMetaData(scheme, input, masterMeta));

            case PageStyle.Custom:
                if (MetaDataUtil.StartsWith(input.Style, "DetailList"))
                {
                    int index = input.QueryString["Index"].Value <int>();
                    TkDebug.Assert(OneToManyTables != null && OneToManyTables.Count > index,
                                   string.Format(ObjectUtil.SysCulture, "第{0}项metaData配置不存在", index + 1), this);
                    var config         = OneToManyTables[index];
                    var detailMetaData = config.CreateSingleMetaData();
                    scheme = detailMetaData.CreateSourceScheme(input);
                    InputDataProxy  proxy = new InputDataProxy(input, (PageStyleClass)PageStyle.List);
                    Tk5ListMetaData meta  = new Tk5ListMetaData(scheme, proxy, detailMetaData,
                                                                config.TableOutput?.CreateObject());
                    return(meta);
                }
                break;
            }
            return(null);
        }
Exemple #19
0
        public IMetaData CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            InputDataProxy inputProxy = new InputDataProxy(input, (PageStyleClass)PageStyle.List);

            if (input.IsPost)
            {
                return(CreateListMetaData(inputProxy, Result));
            }
            else
            {
                return(CreateListMetaData(inputProxy, Condition));
            }
        }
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            ITableSchemeEx scheme  = Scheme.CreateObject();
            Tk5DataXml     dataXml = scheme as Tk5DataXml;

            TkDebug.AssertNotNull(dataXml, string.Format(ObjectUtil.SysCulture,
                                                         "模型需要Tk5DataXml,当前的Scheme是{0},不适配", scheme.GetType()), Scheme);
            return(new Tk5TreeTableResolver(dataXml, source)
            {
                AutoTrackField = AutoTrackField,
                AutoUpdateKey = AutoUpdateKey
            });
        }
Exemple #21
0
        public IMetaData CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            ITableSchemeEx  scheme;
            ISingleMetaData masterMeta;

            switch (input.Style.Style)
            {
            case PageStyle.Insert:
            case PageStyle.Update:
                masterMeta = Main.CreateSingleMetaData();
                scheme     = masterMeta.CreateSourceScheme(input);
                return(new Tk5SingleNormalMetaData(scheme, input, masterMeta));

            case PageStyle.List:
                masterMeta = Main.CreateSingleMetaData();
                scheme     = masterMeta.CreateSourceScheme(input);
                return(new Tk5ListMetaData(scheme, input, masterMeta));

            case PageStyle.Detail:
                masterMeta = Main.CreateSingleMetaData();
                return(new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta),
                                               Details));

            case PageStyle.Custom:
                if (Details == null)
                {
                    return(null);
                }
                if (MetaDataUtil.StartsWith(input.Style, "DetailList"))
                {
                    int index = input.QueryString["Index"].Value <int>();
                    if (index < Details.Count)
                    {
                        var            detail = Details[index];
                        InputDataProxy proxy  = new InputDataProxy(input, (PageStyleClass)PageStyle.List);
                        masterMeta = detail.CreateSingleMetaData();
                        scheme     = masterMeta.CreateSourceScheme(input);
                        return(new Tk5ListMetaData(scheme, proxy, masterMeta,
                                                   detail.TableOutput?.CreateObject()));
                    }
                    return(null);
                }
                break;
            }
            return(null);
        }
        public IMetaData CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            if (Items != null)
            {
                foreach (CompositeMetaDataItemConfig item in Items)
                {
                    if (item.Condition.UseCondition(input))
                    {
                        return(item.MetaData.CreateObject(args));
                    }
                }
            }

            return(null);
        }
        public IPageMaker CreateObject(params object[] args)
        {
            IPageData pageData = ObjectUtil.ConfirmQueryObject <IPageData>(this, args);

            IConfigCreator <IPageMaker> creator;

            if (pageData.IsMobileDevice)
            {
                creator = Mobile ?? PC;
            }
            else
            {
                creator = PC;
            }

            return(creator.CreateObject(args));
        }
Exemple #24
0
        public override ISource CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            if ((input.Style.Style & DisablePage) == input.Style.Style)
            {
                throw new ErrorOperationException("该页面被禁止,无法访问", this);
            }

            if (input.IsPost)
            {
                return(CreatePostSource(input.Style.Style, input));
            }
            else
            {
                return(CreateGetSource(input.Style.Style, input));
            }
        }
        public IMetaData CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            switch (input.Style.Style)
            {
            case PageStyle.Insert:
            case PageStyle.Update:
            case PageStyle.Detail:
                return(new Tk5MultipleMetaData(input, this));

            case PageStyle.List:
                var singleMetaData = CreateSingleMetaData();
                var scheme         = singleMetaData.CreateSourceScheme(input);
                return(new Tk5ListMetaData(scheme, input, singleMetaData));
            }
            return(null);
        }
        public IMetaData CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            ITableSchemeEx scheme = CreateSourceScheme(input);

            switch (input.Style.Style)
            {
            case PageStyle.Insert:
            case PageStyle.Update:
            case PageStyle.Detail:
                return(new Tk5SingleNormalMetaData(scheme, input, this));

            case PageStyle.List:
                return(new Tk5ListMetaData(scheme, input, this));
            }
            return(null);
        }
Exemple #27
0
        public TableResolver CreateObject(params object[] args)
        {
            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);

            Tk5TableResolver resolver;

            if (string.IsNullOrEmpty(TableName))
            {
                resolver = new Tk5TableResolver(DataXml, source);
            }
            else
            {
                resolver = new Tk5TableResolver(DataXml, TableName, source);
            }
            resolver.AutoUpdateKey  = AutoUpdateKey;
            resolver.AutoTrackField = AutoTrackField;

            return(resolver);
        }
Exemple #28
0
        public ITree CreateObject(params object[] args)
        {
            if (fDataXml.TreeDefinition == null)
            {
                return(null);
            }

            IDbDataSource source = ObjectUtil.ConfirmQueryObject <IDbDataSource>(this, args);
            NormalDbTree  dbTree = new NormalDbTree(fDataXml, fDataXml.TreeDefinition, source);

            if (DataRight != null)
            {
                dbTree.DataRight = DataRight;
            }
            if (FilterSql != null)
            {
                dbTree.CustomCondition = ParamBuilder.CreateSql(Expression.Execute(FilterSql, source.Context, source));
            }
            return(dbTree);
        }
Exemple #29
0
        public IMetaData CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            ITableSchemeEx  scheme;
            ISingleMetaData masterMeta;

            switch (input.Style.Style)
            {
            case PageStyle.Insert:
            case PageStyle.Update:
            case PageStyle.Detail:
                masterMeta = Master.CreateSingleMetaData();
                return(new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta),
                                               EnumUtil.Convert(Detail)));

            //return new Tk5SingleNormalMetaData(scheme, input, this);
            //break;
            case PageStyle.List:
                masterMeta = Master.CreateSingleMetaData();
                scheme     = masterMeta.CreateSourceScheme(input);
                return(new Tk5ListMetaData(scheme, input, masterMeta));

            case PageStyle.Custom:
                if (input.Style.Operation == "DetailList")
                {
                    var detailMeta = Detail.CreateSingleMetaData();
                    scheme = detailMeta.CreateSourceScheme(input);
                    InputDataProxy proxy = new InputDataProxy(input, (PageStyleClass)PageStyle.List);
                    return(new Tk5ListMetaData(scheme, proxy, detailMeta, Detail.TableOutput?.CreateObject()));
                }
                var metaData = SchemeUtil.CreateVueMetaData(input, Master, EnumUtil.Convert(Detail));
                if (metaData != null)
                {
                    return(metaData);
                }
                break;
            }
            return(null);
        }
Exemple #30
0
        public override ISource CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args);

            if (input.IsPost)
            {
                switch (input.Style.Style)
                {
                case PageStyle.Insert:
                case PageStyle.Update:
                    return(new SingleDbEditSource(this));
                }
            }
            else
            {
                switch (input.Style.Style)
                {
                case PageStyle.Custom:
                    return(new TreeOperationSource(this));

                case PageStyle.Insert:
                    return(new SingleDbInsertSource(this));

                case PageStyle.Update:
                    return(new SingleDbDetailSource(this));

                case PageStyle.Delete:
                    return(new SingleDbDeleteSource(this));

                case PageStyle.Detail:
                    return(new SingleDbDetailSource(this));

                case PageStyle.List:
                    return(new TreeSource(this));
                }
            }

            return(null);
        }