예제 #1
0
        public Tk5TableScheme(ITableSchemeEx scheme, IInputData input, ISingleMetaData config,
                              Func <ITableSchemeEx, IFieldInfoEx, IInputData, ISingleMetaData, Tk5FieldInfoEx> createFunc)
            : this()
        {
            TkDebug.AssertArgumentNull(scheme, "scheme", null);
            TkDebug.AssertArgumentNull(input, "input", null);
            TkDebug.AssertArgumentNull(config, "config", null);
            TkDebug.AssertArgumentNull(createFunc, "createFunc", null);

            SetFileDependency(scheme);
            TableName = scheme.TableName;
            TableDesc = scheme.TableDesc;
            NameField = scheme.NameField;

            PageStyle pageStyle = input.Style.Style;
            var       list      = from item in scheme.Fields
                                  where (item.Control.DefaultShow & pageStyle) == pageStyle
                                  select item;

            foreach (var item in list)
            {
                Tk5FieldInfoEx fieldInfo = createFunc(scheme, item, input, config);
                fList.Add(fieldInfo);
            }

            ProcessRefField();
        }
예제 #2
0
        public UnionScheme(string tableName, string tableDesc, string nameField, IEnumerable <ITableSchemeEx> schemes)
        {
            TkDebug.AssertArgumentNullOrEmpty(tableName, "tableName", null);
            TkDebug.AssertArgumentNullOrEmpty(tableDesc, "tableDesc", null);
            TkDebug.AssertArgumentNull(schemes, "schemes", null);

            TableName = tableName;
            TableDesc = tableDesc;
            fFields   = new RegNameList <UnionFieldInfoEx>();
            foreach (var scheme in schemes)
            {
                foreach (var field in scheme.Fields)
                {
                    if (!fFields.ConstainsKey(field.NickName))
                    {
                        if (field is UnionFieldInfoEx)
                        {
                            fFields.Add((UnionFieldInfoEx)field);
                        }
                        else
                        {
                            fFields.Add(new UnionFieldInfoEx(field, null));
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(nameField))
            {
                NameField = schemes.FirstOrDefault()?.NameField;
            }
            else
            {
                NameField = fFields[nameField];
            }
        }
예제 #3
0
 public string Creator(string workflowDefine, string key, string paramList)
 {
     try
     {
         WorkflowDbContext source = new WorkflowDbContext(connStr);
         WorkflowConfig.ConnString = connStr;
         RegNameList <KeyValueItem> param = new RegNameList <KeyValueItem>();
         if (!string.IsNullOrEmpty(paramList))
         {
             List <KeyValueItem> list = new List <KeyValueItem>();
             list = FastToObject <List <KeyValueItem> >(paramList);
             list.ForEach(a => param.Add(a));
         }
         param.Add(new KeyValueItem()
         {
             Key   = "MainKey",
             Value = key
         });
         var wf = Ataw.Workflow.Core.Workflow.CreateWorkflow(source, workflowDefine, param,
                                                             GlobalVariable.UserId.ToString(), null);
         return("OK" + wf.GetWorkflowUrl());
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
예제 #4
0
        public LevelScheme(ITableScheme sourceScheme, LevelTreeDefinition levelDef)
        {
            fFields = new RegNameList <FieldItem>();

            fFields.Add(new KeyFieldItem(sourceScheme[levelDef.IdField]));
            fFields.Add(new FieldItem(sourceScheme[levelDef.NameField]));
            TreeScheme.AddFakeField(fFields, sourceScheme);
            TableName = sourceScheme.TableName;
        }
예제 #5
0
        public TreeScheme(ITableScheme sourceScheme, DbTreeDefinition treeDef)
        {
            fFields = new RegNameList <FieldItem>();

            TableName = sourceScheme.TableName;
            fFields.Add(new KeyFieldItem(sourceScheme[treeDef.IdField]));
            fFields.Add(new FieldItem(sourceScheme[treeDef.NameField]));
            fFields.Add(new FieldItem(sourceScheme[treeDef.ParentIdField]));
            fFields.Add(new FieldItem(sourceScheme[treeDef.LeafField]));
            fFields.Add(new FieldItem(sourceScheme[treeDef.LayerField]));
            AddFakeField(fFields, sourceScheme);
        }
예제 #6
0
        public bool Add(TableResolver resolver)
        {
            if (fList.Contains(resolver))
            {
                var srcResolver = fList[resolver.TableName];
                srcResolver.MergeCommand(resolver);
                return(false);
            }

            fList.Add(resolver);
            return(true);
        }
예제 #7
0
        public static RegNameList <ListTabSheet> CreateTabSheets(this CodeTable codeTable,
                                                                 TkDbContext context, IFieldInfo field)
        {
            DataSet ds = new DataSet()
            {
                Locale = ObjectUtil.SysCulture
            };

            using (ds)
            {
                codeTable.Fill(ds, context);
                if (ds.Tables.Count == 0)
                {
                    return(null);
                }
                DataTable table = ds.Tables[0];
                if (table.Rows.Count == 0)
                {
                    return(null);
                }

                RegNameList <ListTabSheet> result = new RegNameList <ListTabSheet>();
                foreach (DataRow row in table.Rows)
                {
                    object        value   = row[DecoderConst.CODE_NICK_NAME];
                    IParamBuilder builder = SqlParamBuilder.CreateEqualSql(context, field,
                                                                           value);
                    ListTabSheet tab = new ListTabSheet(value.ToString(),
                                                        row[DecoderConst.NAME_NICK_NAME].ToString(), builder);
                    result.Add(tab);
                }

                return(result);
            }
        }
예제 #8
0
        public void Add(SingleTableDetailData tableData)
        {
            TkDebug.AssertArgumentNull(tableData, "tableData", this);

            fTableDatas.Add(tableData);
            tableData.Initialize();
        }
예제 #9
0
        internal TypeTableScheme(Type type)
        {
            TkDebug.AssertArgumentNull(type, "type", null);

            TableName = type.Name;
            DisplayNameAttribute dispAttr = Attribute.GetCustomAttribute(type,
                                                                         typeof(DisplayNameAttribute), false) as DisplayNameAttribute;

            if (dispAttr != null)
            {
                TableDesc = dispAttr.DisplayName;
            }
            else
            {
                TableDesc = TableName;
            }
            fList = new RegNameList <PropertyFieldInfo>();
            PropertyInfo[] props = type.GetProperties(BIND_ATTRIBUTE);
            if (props != null)
            {
                foreach (var prop in props)
                {
                    PropertyFieldInfo info = PropertyFieldInfo.Create(prop);
                    if (info != null)
                    {
                        fList.Add(info);
                    }
                }
            }

            NameField = MetaDataUtil.GetNameField(fList);
        }
예제 #10
0
        // public

        public Workflow StartWorkFlow(string key, string defineName, string creatorId)
        {
            // throw new NotImplementedException();
            WorkflowDbContext source = new WorkflowDbContext(AtawAppContext.Current.DefaultConnString);

            WorkflowConfig.ConnString = AtawAppContext.Current.DefaultConnString;
            RegNameList <KeyValueItem> param = new RegNameList <KeyValueItem>();

            //if (!string.IsNullOrEmpty(paramList))
            //{
            //    List<KeyValueItem> list = new List<KeyValueItem>();
            //    list = FastToObject<List<KeyValueItem>>(paramList);
            //    list.ForEach(a => param.Add(a));
            //}
            param.Add(new KeyValueItem()
            {
                Key   = "MainKey",
                Value = key
            });
            var wf = Workflow.CreateWorkflow(source, defineName, param,
                                             creatorId, null);

            wf.Run();
            // return wf.WorkflowId;
            return(wf);
        }
예제 #11
0
        private Tk5TableScheme CreateTableScheme(IInputData input, ISingleMetaData item)
        {
            ITableSchemeEx sourceScheme = item.CreateSourceScheme(input);
            Tk5TableScheme scheme       = item.CreateTableScheme(sourceScheme, input);

            fSchemes.Add(scheme);
            return(scheme);
        }
예제 #12
0
        public void Add(T item)
        {
            if (item == null)
            {
                return;
            }

            fList.Add(new EasySearchDataItem <T>(item));
        }
예제 #13
0
        public void AddItem(FieldOperateRightItem item)
        {
            TkDebug.AssertArgumentNull(item, "item", this);

            fList.Add(item);
            if (fNullItem == null && item.ContainsNull)
            {
                fNullItem = item;
            }
        }
예제 #14
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);
        }
예제 #15
0
        private void Initialize(string tableName, DataTable table, string[] keyFieldArray)
        {
            TableName = tableName;
            DataColumnCollection columns = table.Columns;

            fFieldInfos = new RegNameList <InternalFieldConfigItem>();
            foreach (DataColumn column in columns)
            {
                fFieldInfos.Add(new InternalFieldConfigItem(column, keyFieldArray));
            }
        }
예제 #16
0
        public static void AddFakeField(RegNameList <FieldItem> fields, ITableScheme scheme)
        {
            Tk5DataXml dataXml = scheme as Tk5DataXml;

            if (dataXml != null)
            {
                if (dataXml.FakeDeleteInfo != null)
                {
                    fields.Add(new FieldItem(scheme[dataXml.FakeDeleteInfo.FieldName]));
                }
            }
        }
예제 #17
0
        public Tk5TableScheme(Tk5TableScheme scheme, IEnumerable <Tk5FieldInfoEx> fields)
        {
            TkDebug.AssertArgumentNull(scheme, "scheme", null);
            TkDebug.AssertArgumentNull(fields, "fields", null);

            SetFileDependency(scheme);
            fList     = scheme.fList;
            TableName = scheme.TableName;
            TableDesc = scheme.TableDesc;
            NameField = scheme.NameField;
            foreach (var item in fields)
            {
                fList.Add(item);
            }

            ProcessRefField();
        }
예제 #18
0
        private void AddAttribute(HtmlAttribute attr)
        {
            if (attr == null)
            {
                return;
            }

            if (fAttrs.Contains(attr))
            {
                HtmlAttribute curAttr = fAttrs[attr.Name];
                curAttr.Value = attr.Value;
            }
            else
            {
                fAttrs.Add(attr);
            }
        }
예제 #19
0
        internal static IEnumerable <ITreeNode> GetDisplayTreeNodes(IEnumerable <ITreeNode> data, string id)
        {
            RegNameList <DataRowTreeNode> list = new RegNameList <DataRowTreeNode>();

            foreach (DataRowTreeNode item in data)
            {
                list.Add(item);
            }

            DataRowTreeNode newNode = list[id];

            while (newNode != null)
            {
                newNode = list[newNode.ParentId];
                if (newNode != null)
                {
                    newNode.HasChild = null;
                }
            }

            return(list);
        }
예제 #20
0
        internal MultipleMixDbDetailSource(IDetailDbConfig config)
            : base(config)
        {
            OneToOneTables = new RegNameList <OneToOneChildTableInfo>();
            IMultipleMixDbSourceConfig mix = config as IMultipleMixDbSourceConfig;

            if (mix != null)
            {
                var tableInfos = mix.OneToOneTables;
                if (tableInfos != null)
                {
                    foreach (var item in tableInfos)
                    {
                        var info = new OneToOneChildTableInfo(this, item);
                        OneToOneTables.Add(info);
                    }
                }
            }
            if (config.DetailOperators != null)
            {
                Operators = config.DetailOperators.CreateObject();
            }
        }
예제 #21
0
        protected void Add(CodeItem item)
        {
            TkDebug.AssertArgumentNull(item, "item", this);

            fData.Add(item);
        }
예제 #22
0
        public void AddChildTable(ChildTableInfo childTable)
        {
            TkDebug.AssertArgumentNull(childTable, "childTable", this);

            fChildTables.Add(childTable);
        }
예제 #23
0
 public void AddToken(CorpAccessToken token)
 {
     fList.Add(token);
 }