Esempio n. 1
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:
                InputDataProxy proxy;
                if (MetaDataUtil.StartsWith(input.Style, "DetailList"))
                {
                    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);
        }
        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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        internal static IMetaData CreateDetailListMeta(IInputData input, List <DetailSingleMetaDataConfig> detailItems,
                                                       out bool shouldReturn)
        {
            shouldReturn = false;

            if (MetaDataUtil.StartsWith(input.Style, "DetailList"))
            {
                int index = input.QueryString["Index"].Value <int>(0);
                if (index < detailItems.Count)
                {
                    var            detailMeta = detailItems[index].CreateSingleMetaData();
                    var            scheme     = detailMeta.CreateSourceScheme(input);
                    InputDataProxy proxy      = new InputDataProxy(input, (PageStyleClass)PageStyle.List);
                    shouldReturn = true;
                    return(new Tk5ListMetaData(scheme, proxy, detailMeta,
                                               detailItems[index].TableOutput?.CreateObject()));
                }
            }
            return(null);
        }