private static string ExecuteMarco(MarcoConfigItem marco, IDbDataSource source, DataRow row, ReceiveMessage message) { if (marco == null) return null; return Expression.Execute(marco, source, row, message); }
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; }
public ITree CreateTree(IDbDataSource source) { ResolverTreeConfig config = new ResolverTreeConfig { Resolver = Resolver, DataRight = DataRight }; return(config.CreateObject(source)); }
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; }
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 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; } }
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); }
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); }
protected override object DeleteAttachment(IDbDataSource host, IFieldUpload upload, DataRow row, string path) { try { File.Delete(path); } catch { } return(null); }
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); }
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); }
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)); } }
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; }
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); }
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)); } }
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); }
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); }
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); }
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); }
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); }
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); }
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 }); }
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); }
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; }
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); }
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); }
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); }
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); }
/// <summary> /// 建构函数,设置附着的Xml文件。 /// </summary> /// <param name="context">数据库连接上下文</param> /// <param name="source">附着的数据源</param> public MessageResolver(IDbDataSource source) : base(MetaDataUtil.CreateTableScheme("Message.xml"), source) { }
public FunctionResolver(IDbDataSource source) : base(DATAXML, source) { }
/// <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) { }
public GroupResolver(IDbDataSource source) : base(MetaDataUtil.CreateTableScheme("Group.xml"), source) { }
public UserInfoResolver(IDbDataSource source) : base(source) { if (DetailSource != null) DetailSource.FillingUpdateTables += DetailSource_FillingUpdateTables; }
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; }
public BindingResolver(IDbDataSource source) : base(DATAXML, source) { }
/// <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; }