示例#1
0
 private static string ExecuteMarco(MarcoConfigItem marco, IDbDataSource source,
     DataRow row, ReceiveMessage message)
 {
     if (marco == null)
         return null;
     return Expression.Execute(marco, source, row, message);
 }
示例#2
0
 private static string ExecuteUrl(UrlMacroConfig marco, IDbDataSource source,
     DataRow row, ReceiveMessage message)
 {
     if (marco == null)
         return null;
     string content = Expression.Execute(marco, source, row, message);
     return marco.ToUri(content);
 }
 /// <summary>
 /// 建构函数,设置附着的Xml文件。
 /// </summary>
 /// <param name="context">数据库连接上下文</param>
 /// <param name="source">附着的数据源</param>
 public ReportDataResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
     AutoUpdateKey = true;
     AutoTrackField = true;
     if (ListSource != null)
         ListSource.FilledListTables += ListSource_FilledListTables;
 }
 /// <summary>
 /// 建构函数,设置附着的Xml文件。
 /// </summary>
 /// <param name="context">数据库连接上下文</param>
 /// <param name="source">附着的数据源</param>
 public CorpUserResolver(IDbDataSource source)
     : base(CreateSchema(), source)
 {
     FakeDelete = new FakeDeleteInfo("ValidFlag", "1");
     AutoUpdateKey = true;
     AutoTrackField = true;
     fUserList = new CorpUserStatusList();
     if (CommitSource != null)
         CommitSource.CommittedData += CommitSource_CommittedData;
 }
示例#5
0
        public ITree CreateTree(IDbDataSource source)
        {
            ResolverTreeConfig config = new ResolverTreeConfig
            {
                Resolver  = Resolver,
                DataRight = DataRight
            };

            return(config.CreateObject(source));
        }
示例#6
0
 public Article CreateArticle(IDbDataSource source, DataRow row, ReceiveMessage message)
 {
     Article result = new Article
     {
         Title = ExecuteMarco(Title, source, row, message),
         Description = ExecuteMarco(Description, source, row, message),
         PicUrl = ExecuteUrl(PicUrl, source, row, message),
         Url = ExecuteUrl(Url, source, row, message)
     };
     return result;
 }
示例#7
0
        private static string ExecuteUrl(UrlMacroConfig marco, IDbDataSource source,
                                         DataRow row, ReceiveMessage message)
        {
            if (marco == null)
            {
                return(null);
            }
            string content = Expression.Execute(marco, source, row, message);

            return(marco.ToUri(content));
        }
示例#8
0
 /// <summary>
 /// 建构函数,设置附着的Xml文件。
 /// </summary>
 /// <param name="context">数据库连接上下文</param>
 /// <param name="source">附着的数据源</param>
 public CorpUserResolver(IDbDataSource source)
     : base(CreateSchema(), source)
 {
     FakeDelete     = new FakeDeleteInfo("ValidFlag", "1");
     AutoUpdateKey  = true;
     AutoTrackField = true;
     fUserList      = new CorpUserStatusList();
     if (CommitSource != null)
     {
         CommitSource.CommittedData += CommitSource_CommittedData;
     }
 }
示例#9
0
        protected override object InsertAttachment(IDbDataSource host, IFieldUpload upload,
                                                   IFieldValueAccessor accessor, string path)
        {
            string fileName = Path.GetFileName(path);
            string newPath  = Path.Combine(fUploadPath, fileName);

            accessor.SetValue(upload.ServerPathField, newPath);
            accessor.SetValue(upload.ContentField, fVirtualPath + fileName);

            CopyFile(path, newPath);
            return(null);
        }
示例#10
0
        protected override object InsertAttachment(IDbDataSource host, IFieldUpload upload,
                                                   DataRow row, string path)
        {
            string fileName = Path.GetFileName(path);
            string newPath  = Path.Combine(fUploadPath, fileName);

            row[upload.ServerPathField] = newPath;
            row[upload.ContentField]    = fVirtualPath + fileName;

            CopyFile(path, newPath);
            return(null);
        }
示例#11
0
 protected override object DeleteAttachment(IDbDataSource host, IFieldUpload upload,
                                            DataRow row, string path)
 {
     try
     {
         File.Delete(path);
     }
     catch
     {
     }
     return(null);
 }
示例#12
0
        public Article CreateArticle(IDbDataSource source, DataRow row, ReceiveMessage message)
        {
            Article result = new Article
            {
                Title       = ExecuteMarco(Title, source, row, message),
                Description = ExecuteMarco(Description, source, row, message),
                PicUrl      = ExecuteUrl(PicUrl, source, row, message),
                Url         = ExecuteUrl(Url, source, row, message)
            };

            return(result);
        }
示例#13
0
        protected override object UpdateAttachment(IDbDataSource host,
                                                   IFieldUpload upload, DataRow row, string oldPath, string newPath)
        {
            AttachmentResolver resolver = new AttachmentResolver(host);

            resolver.SetCommands(AdapterCommand.Update);
            resolver.Update(row[upload.ContentField].Value <int>(), row[upload.FileNameField].ToString(), newPath,
                            row[upload.MimeTypeField].ToString(),
                            File.ReadAllBytes(newPath), false);

            fDelFile = newPath;
            return(resolver);
        }
示例#14
0
        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));
            }
        }
示例#15
0
        internal NormalDbTree(ITableScheme scheme, DbTreeDefinition treeDef, IDbDataSource source, ITreeOperation operation)
        {
            TkDebug.AssertArgumentNull(source, "source", null);
            TkDebug.AssertArgumentNull(scheme, "scheme", null);
            TkDebug.AssertArgumentNull(treeDef, "treeDef", null);

            fSource        = source;
            fScheme        = scheme;
            fDefinition    = treeDef;
            fOrder         = "ORDER BY " + fScheme[treeDef.LayerField].FieldName;
            fSelector      = new TreeSelector(scheme, treeDef, source);
            fTreeOperation = operation;
        }
示例#16
0
        protected override object UpdateAttachment(IDbDataSource host, IFieldUpload upload,
                                                   DataRow row, string oldPath, string newPath)
        {
            string fileName = Path.GetFileName(newPath);

            row[upload.ContentField] = fVirtualPath + fileName;
            //Add By Gaolq 2018/8/15
            string toPath = Path.Combine(fUploadPath, fileName);

            row[upload.ServerPathField] = toPath;
            CopyFile(newPath, toPath);
            return(null);
        }
示例#17
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));
            }
        }
示例#18
0
        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);
        }
示例#19
0
 protected override object DeleteAttachment(IDbDataSource host, IFieldUpload upload,
                                            IFieldValueAccessor accessor, string path)
 {
     try
     {
         accessor.SetValue(upload.ContentField, DBNull.Value);
         File.Delete(path);
     }
     catch
     {
     }
     return(null);
 }
示例#20
0
        protected override object UpdateAttachment(IDbDataSource host, IFieldUpload upload,
                                                   IFieldValueAccessor accessor, string oldPath, string newPath)
        {
            string fileName = Path.GetFileName(newPath);

            accessor.SetValue(upload.ContentField, fVirtualPath + fileName);
            //Add By Gaolq 2018/8/15
            string toPath = Path.Combine(fUploadPath, fileName);

            accessor.SetValue(upload.ServerPathField, toPath);

            CopyFile(newPath, toPath);
            return(null);
        }
示例#21
0
        protected override object InsertAttachment(IDbDataSource host,
                                                   IFieldUpload upload, DataRow row, string path)
        {
            AttachmentResolver resolver = new AttachmentResolver(host);

            resolver.SetCommands(AdapterCommand.Insert);
            byte[] fileData = File.ReadAllBytes(path);
            row[upload.ContentField] = resolver.Insert(
                row[upload.FileNameField].ToString(), path,
                row[upload.MimeTypeField].ToString(), fileData, false);

            fDelFile = path;
            return(resolver);
        }
示例#22
0
        void ICustomData.SetData(params object[] args)
        {
            IDbDataSource data = ObjectUtil.QueryObject <IDbDataSource>(args);

            if (data != null)
            {
                fContext = data.Context;
            }
            if (fContext == null)
            {
                fContext = ObjectUtil.QueryObject <TkDbContext>(args);
            }
            TkDebug.AssertNotNull(fContext, "参数宏(@)需要DbContext对象,但是没有从外部对象中找到", this);
        }
示例#23
0
 private DataSourceBase CreateDataSource(IDbDataSource dsEntry)
 {
     if (dsEntry is IDbFileDataSource)
     {
         return(CreateFileDataSource((IDbFileDataSource)dsEntry));
     }
     else if (dsEntry is IDbEpfArchiveDataSource)
     {
         return(CreateEPFArchiveDataSource((IDbEpfArchiveDataSource)dsEntry));
     }
     else
     {
         throw new NotImplementedException("Unknown sourceDef");
     }
 }
 protected override object DeleteAttachment(IDbDataSource host, IFieldUpload upload,
                                            IFieldValueAccessor accessor, string path)
 {
     try
     {
         var json = accessor.GetValue(upload.ContentField);
         accessor.SetValue(upload.ContentField, DBNull.Value);
         FileConfig config = FileConfig.ReadFromJson(json);
         config.Delete();
     }
     catch
     {
     }
     return(null);
 }
 protected override object DeleteAttachment(IDbDataSource host, IFieldUpload upload,
                                            DataRow row, string path)
 {
     try
     {
         var json = row[upload.ContentField].ToString();
         row[upload.ContentField] = DBNull.Value;
         FileConfig config = FileConfig.ReadFromJson(json);
         config.Delete();
     }
     catch
     {
     }
     return(null);
 }
示例#26
0
 internal StdCodeTableResolver(string tableName, SimpleIdCreator creator, IDbDataSource source)
     : base(new StdCodeTableScheme(tableName, false, true, false, null), source)
 {
     //FakeDelete = new FakeDeleteInfo("Del", "1");
     fCreator = creator;
     if (fCreator == null)
     {
         AutoCreatekey = false;
         fCreator      = new SimpleIdCreator();
     }
     else
     {
         AutoCreatekey = true;
     }
 }
        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
            });
        }
示例#28
0
        public object Process(IDbDataSource host, IFieldUpload upload, IFieldValueAccessor provider, UpdateKind kind)
        {
            switch (kind)
            {
            case UpdateKind.Insert:
                string path = provider[upload.ServerPathField].ToString();
                if (!string.IsNullOrEmpty(path))
                {
                    return(InsertAttachment(host, upload, provider, path));
                }
                break;

            case UpdateKind.Update:
                string originalPath = provider.GetOriginValue(upload.ServerPathField).ToString();
                string newPath      = provider[upload.ServerPathField].ToString();
                if (originalPath != newPath)
                {
                    if (string.IsNullOrEmpty(originalPath))
                    {
                        // 原先没有,当前实际是新建
                        return(InsertAttachment(host, upload, provider, newPath));
                    }
                    else if (string.IsNullOrEmpty(newPath))
                    {
                        // 现在没有,当前实际是删除
                        var result = DeleteAttachment(host, upload, provider, originalPath);
                        provider.SetValue(upload.FileNameField, DBNull.Value);
                        return(result);
                    }
                    else
                    {
                        // 原先和现在都有,当前实际是覆盖
                        return(UpdateAttachment(host, upload, provider, originalPath, newPath));
                    }
                }

                break;

            case UpdateKind.Delete:
                if (provider[upload.ContentField] != DBNull.Value)
                {
                    return(DeleteAttachment(host, upload, provider,
                                            provider[upload.ServerPathField].ToString()));
                }
                break;
            }
            return(null);
        }
示例#29
0
        public object Process(IDbDataSource host, IFieldUpload upload, DataRow row, UpdateKind kind)
        {
            switch (kind)
            {
            case UpdateKind.Insert:
                string path = row[upload.ServerPathField].ToString();
                if (!string.IsNullOrEmpty(path))
                {
                    return(InsertAttachment(host, upload, row, path));
                }
                break;

            case UpdateKind.Update:
                string originalPath = row[upload.ServerPathField, DataRowVersion.Original].ToString();
                string newPath      = row[upload.ServerPathField].ToString();
                if (originalPath != newPath)
                {
                    if (string.IsNullOrEmpty(originalPath))
                    {
                        // 原先没有,当前实际是新建
                        return(InsertAttachment(host, upload, row, newPath));
                    }
                    else if (string.IsNullOrEmpty(newPath))
                    {
                        // 现在没有,当前实际是删除
                        var result = DeleteAttachment(host, upload, row, originalPath);
                        row[upload.FileNameField] = DBNull.Value;
                        return(result);
                    }
                    else
                    {
                        // 原先和现在都有,当前实际是覆盖
                        return(UpdateAttachment(host, upload, row, originalPath, newPath));
                    }
                }

                break;

            case UpdateKind.Delete:
                if (row[upload.ContentField] != DBNull.Value)
                {
                    return(DeleteAttachment(host, upload, row,
                                            row[upload.ServerPathField].ToString()));
                }
                break;
            }
            return(null);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SqLiteRpcConnection" /> class.
        /// </summary>
        /// <param name="sendConnection">The send connection.</param>
        /// <param name="sendQueue">The send queue.</param>
        /// <param name="receiveConnection">The receive connection.</param>
        /// <param name="receiveQueue">The receive queue.</param>
        /// <param name="dataSource">The data source.</param>
        public SqLiteRpcConnection(string sendConnection, string sendQueue,
                                   string receiveConnection, string receiveQueue,
                                   IDbDataSource dataSource)
        {
            Guard.NotNullOrEmpty(() => sendConnection, sendConnection);
            Guard.NotNullOrEmpty(() => sendQueue, sendQueue);
            Guard.NotNullOrEmpty(() => receiveConnection, receiveConnection);
            Guard.NotNullOrEmpty(() => receiveQueue, receiveQueue);
            Guard.NotNull(() => dataSource, dataSource);

            _sendConnection    = sendConnection;
            _sendQueue         = sendQueue;
            _receiveConnection = receiveConnection;
            _receiveQueue      = receiveQueue;
            _dataSource        = dataSource;
        }
示例#31
0
        private TableSelector(ITableScheme scheme, IDbDataSource source, bool useCache)
        {
            TkDebug.AssertArgumentNull(scheme, nameof(scheme), null);
            TkDebug.AssertArgumentNull(source, nameof(source), null);

            fSourceScheme = fScheme = scheme;
            Source        = source;

            Context      = source.Context;
            HostDataSet  = source.DataSet;
            fDataAdapter = Context.CreateDataAdapter();
            TableSchemeData schemaData = useCache ? TableSchemeData.Create(Context, scheme)
                : new TableSchemeData(Context, scheme);

            SetSchemeData(schemaData);
        }
示例#32
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);
        }
示例#33
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);
        }
示例#34
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);
        }
        protected override object UpdateAttachment(IDbDataSource host, IFieldUpload upload,
                                                   DataRow row, string oldPath, string newPath)
        {
            if (UseAliyunUploadMode)
            {
                FileConfig temp   = FileConfig.ReadFromJson(newPath);
                string     json   = row[upload.ContentField].ToString();
                FileConfig config = FileConfig.ReadFromJson(json);
                row[upload.ServerPathField] = config.AccessUrl;

                temp.RemoveTo(config);
            }
            else
            {
                string     json   = row[upload.ContentField].ToString();
                FileConfig config = FileConfig.ReadFromJson(json);
                row[upload.ServerPathField] = config.AccessUrl;
                string originFileName = row[upload.FileNameField].ToString();

                config.UploadFile(newPath, originFileName);
            }
            return(null);
        }
示例#36
0
        /// <summary>
        /// 建构函数,设置附着的Xml文件。
        /// </summary>
        /// <param name="context">数据库连接上下文</param>
        /// <param name="source">附着的数据源</param>
        public MessageResolver(IDbDataSource source)
            : base(MetaDataUtil.CreateTableScheme("Message.xml"), source)
        {

        }
示例#37
0
 public FunctionResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
 }
示例#38
0
 /// <summary>
 /// 建构函数,设置附着的Xml文件。
 /// </summary>
 /// <param name="context">数据库连接上下文</param>
 /// <param name="source">附着的数据源</param>
 public CompanyResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
     AutoUpdateKey = true;
     AutoTrackField = true;
 }
 public InternalCorpUserResolver(IDbDataSource source)
     : base(MetaDataUtil.CreateTableScheme("CorpUser.xml"), source)
 {
 }
 public SuggestionResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
 }
示例#41
0
 public GroupResolver(IDbDataSource source)
     : base(MetaDataUtil.CreateTableScheme("Group.xml"), source)
 {
 }
示例#42
0
 public UserInfoResolver(IDbDataSource source)
     : base(source)
 {
     if (DetailSource != null)
         DetailSource.FillingUpdateTables += DetailSource_FillingUpdateTables;
 }
示例#43
0
 public PartResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
 }
        /// <summary>
        /// 建构函数,设置附着的Xml文件。
        /// </summary>
        /// <param name="context">数据库连接上下文</param>
        /// <param name="source">附着的数据源</param>
        public UserLocationResolver(IDbDataSource source)
            : base(MetaDataUtil.CreateTableScheme("UserLocation.xml"), source)
        {

        }
 public OrganizationResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
 }
 public CacheDataResolver(IDbDataSource source)
     : base(MetaDataUtil.CreateTableScheme("CacheData.xml"), source)
 {
 }
 public CorpAppLogResolver(IDbDataSource source)
     : base(MetaDataUtil.CreateTableScheme("CorpAppLog.xml"), source)
 {
     AutoUpdateKey = true;
 }
 public SubFunctionResolver(IDbDataSource dataSource)
     : base(DATAXML, dataSource)
 {
 }
 public WeixinMassDetailResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
     if (EditSource != null)
         EditSource.PreparedPostObject += EditSource_PreparedPostObject;
 }
示例#50
0
 public BindingResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
 }
示例#51
0
 /// <summary>
 /// 建构函数,设置附着的Xml文件。
 /// </summary>
 /// <param name="context">数据库连接上下文</param>
 /// <param name="source">附着的数据源</param>
 public UserResolver(IDbDataSource source)
     : base(MetaDataUtil.CreateTableScheme("WeUser.xml"), source)
 {
 }
 public WeixinMassResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
     AutoTrackField = true;
     AutoUpdateKey = true;
 }
 public TaxDocumentResolver(IDbDataSource source)
     : base(DATAXML, source)
 {
     AutoTrackField = true;
     AutoUpdateKey = true;
 }