Beispiel #1
0
        public static string Execute(MarcoConfigItem item, params object[] customData)
        {
            TkDebug.AssertArgumentNull(item, "item", null);

            if (string.IsNullOrEmpty(item.Value))
            {
                return(string.Empty);
            }
            if (!item.NeedParse)
            {
                return(item.Value);
            }
            Expression expression = new Expression(item.Value);

            string[] emptyMarcoes;
            if (item.EmptyMarcoes != null)
            {
                emptyMarcoes = item.EmptyMarcoes as string[];
            }
            else
            {
                emptyMarcoes = null;
            }
            return(expression.Execute(item.SqlInject, emptyMarcoes, customData));
        }
Beispiel #2
0
        public TableRelation(string masterField, string detailField, MarcoConfigItem filterSql,
                             string order, ManyToManyRelation manyToMany)
            : this(masterField, detailField, RelationType.OnlyFill, filterSql, order)
        {
            TkDebug.AssertArgumentNull(manyToMany, "manyToMany", null);

            fManyToMany = manyToMany;
        }
Beispiel #3
0
        public TableRelation(string[] masterFields, string[] detailFields,
                             RelationType type, MarcoConfigItem filterSql, string order)
        {
            TkDebug.AssertEnumerableArgumentNullOrEmpty(masterFields, "masterFields", null);
            TkDebug.AssertEnumerableArgumentNullOrEmpty(detailFields, "detailFields", null);

            fMasterFields = masterFields;
            fDetailFields = detailFields;
            fType         = type;
            FilterSql     = filterSql;
            OrderBy       = order;
        }
Beispiel #4
0
            public StdCodeTableListSource(StdCodeTableSourceConfig config, string tableName)
            {
                if (!string.IsNullOrEmpty(config.Context))
                {
                    Context = DbContextUtil.CreateDbContext(config.Context);
                }

                MainResolver = config.CreateTableRsolver(this, tableName);
                UseMetaData  = false;
                PageSize     = int.MaxValue;
                SortQuery    = true;
                OrderBy      = "ORDER BY " + DecoderConst.DEFAULT_ORDER;
                if (config.UseQueryString)
                {
                    var operators = new StandardOperatorsConfig
                    {
                        Right = new SimpleListOperateRightConfig {
                            Operators = UpdateKind.All
                        },
                        Operators = new List <IConfigCreator <OperatorConfig> >()
                    };
                    var url = new MarcoConfigItem(true, true,
                                                  string.Format("~/c/{{ModuleCreator}}/insert/{{CcSource}}?{0}={{#{0}}}", config.TableName));
                    operators.Operators.Add(new OperatorConfig(RightConst.INSERT, "新建", OperatorPosition.Global,
                                                               "Dialog", null, "icon-plus", url));
                    url = new MarcoConfigItem(true, true,
                                              string.Format("~/c/{{ModuleCreator}}/update/{{CcSource}}?{0}={{#{0}}}", config.TableName));
                    operators.Operators.Add(new OperatorConfig(RightConst.UPDATE, "修改", OperatorPosition.Row,
                                                               "Dialog", null, "icon-edit", url)
                    {
                        UseKey = true
                    });
                    operators.Operators.Add(OperatorConfig.DeleteOperator);
                    Operators = operators;
                }
                else
                {
                    var    pinyinOper = config.AutoPinyin ? DataString.AutoPinyinOperator : string.Empty;
                    string oper       = string.Format(ObjectUtil.SysCulture, DataString.StdCodeOperators, pinyinOper);
                    var    operators  = oper.ReadXmlFromFactory
                                        <IConfigCreator <IOperatorsConfig> >(OperatorsConfigFactory.REG_NAME);
                    Operators = operators.CreateObject();
                }
            }
Beispiel #5
0
 public TableRelation(string masterField, string detailField,
                      RelationType type, MarcoConfigItem filterSql, string order)
     : this(new string[] { masterField }, new string[] { detailField }, type, filterSql, order)
 {
 }