Esempio n. 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();
        }
Esempio n. 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];
            }
        }
 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);
     }
 }
Esempio n. 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;
        }
Esempio n. 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);
        }
        public bool Add(TableResolver resolver)
        {
            if (fList.Contains(resolver))
            {
                var srcResolver = fList[resolver.TableName];
                srcResolver.MergeCommand(resolver);
                return(false);
            }

            fList.Add(resolver);
            return(true);
        }
Esempio n. 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);
            }
        }
Esempio n. 8
0
        public void Add(SingleTableDetailData tableData)
        {
            TkDebug.AssertArgumentNull(tableData, "tableData", this);

            fTableDatas.Add(tableData);
            tableData.Initialize();
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 12
0
        public void Add(T item)
        {
            if (item == null)
            {
                return;
            }

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

            fList.Add(item);
            if (fNullItem == null && item.ContainsNull)
            {
                fNullItem = item;
            }
        }
Esempio n. 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);
        }
Esempio n. 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));
            }
        }
Esempio n. 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]));
                }
            }
        }
Esempio n. 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();
        }
Esempio n. 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);
            }
        }
Esempio n. 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);
        }
Esempio n. 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();
            }
        }
Esempio n. 21
0
        protected void Add(CodeItem item)
        {
            TkDebug.AssertArgumentNull(item, "item", this);

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

            fChildTables.Add(childTable);
        }
Esempio n. 23
0
 public void AddToken(CorpAccessToken token)
 {
     fList.Add(token);
 }