public void UpdateSyncLog(OracleDbOperation oracleDb, SyncDataLog syncLog) { syncLog.Succ = 0; string strSql = SqlBuilder.BuildUpdateSql(syncLog); oracleDb.ExecuteNonQuery(strSql, null); }
protected void SyncByAddAfterDelete(OracleDbOperation sourceDbOperation, OracleDbOperation targetDbOperation, string tableName, string condition, Action deleteAction, Action <DataRow> actionDetail, Action <string, int> actionCompleted) { string whereCondition = string.IsNullOrEmpty(condition) ? string.Empty : " where " + condition; string selectNoneSql = "select * from " + tableName + " where 1 <> 1"; string selectSql = "select * from " + tableName + whereCondition; string deleteSql = "delete from " + tableName + whereCondition; targetDbOperation.ExecuteNonQuery(deleteSql, null); DataTable dtSource = sourceDbOperation.ExecuteDataTable(selectSql, tableName, null); DataTable dtTarget = targetDbOperation.ExecuteDataTable(selectNoneSql, tableName, null); foreach (DataRow drSource in dtSource.Rows) { DataRow newTargetDr = dtTarget.NewRow(); Copy(drSource, newTargetDr); dtTarget.Rows.Add(newTargetDr); if (actionDetail != null) { actionDetail(newTargetDr); } } targetDbOperation.UpdateDataTable(dtTarget); if (actionCompleted != null) { actionCompleted(tableName, dtTarget.Rows.Count); } }
/// <summary> /// 插入失败的记录 /// </summary> /// <param name="localDb"></param> /// <param name="targetConfig"></param> /// <param name="dataType"></param> public SyncDataLog InsertSyncLog(OracleDbOperation oracleDb, SyncConfigTarget targetConfig, SyncDataType dataType, string fileName) { SyncDataLog syncLog = new SyncDataLog(); syncLog.LogId = Guid.NewGuid().ToString(); syncLog.CCode = targetConfig.Code; syncLog.CName = targetConfig.Name; syncLog.Synctype = dataType; syncLog.SyncDate = System.DateTime.Now; syncLog.FileName = fileName; syncLog.Succ = 1; string strSql = SqlBuilder.BuildInsertSql(syncLog); oracleDb.ExecuteNonQuery(strSql, null); return(syncLog); }
protected void SyncByAddAfterDelete(OracleDbOperation sourceDbOperation, OracleDbOperation targetDbOperation, string tableName, string condition, Action deleteAction, Action<DataRow> actionDetail, Action<string, int> actionCompleted) { string whereCondition = string.IsNullOrEmpty(condition) ? string.Empty : " where " + condition; string selectNoneSql = "select * from " + tableName + " where 1 <> 1"; string selectSql = "select * from " + tableName + whereCondition; string deleteSql = "delete from " + tableName + whereCondition; targetDbOperation.ExecuteNonQuery(deleteSql, null); DataTable dtSource = sourceDbOperation.ExecuteDataTable(selectSql, tableName, null); DataTable dtTarget = targetDbOperation.ExecuteDataTable(selectNoneSql, tableName, null); foreach (DataRow drSource in dtSource.Rows) { DataRow newTargetDr = dtTarget.NewRow(); Copy(drSource, newTargetDr); dtTarget.Rows.Add(newTargetDr); if (actionDetail != null) { actionDetail(newTargetDr); } } targetDbOperation.UpdateDataTable(dtTarget); if (actionCompleted != null) { actionCompleted(tableName, dtTarget.Rows.Count); } }
/// <summary> /// 插入失败的记录 /// </summary> /// <param name="localDb"></param> /// <param name="targetConfig"></param> /// <param name="dataType"></param> public SyncDataLog InsertSyncLog(OracleDbOperation oracleDb, SyncConfigTarget targetConfig, SyncDataType dataType, string fileName) { SyncDataLog syncLog = new SyncDataLog(); syncLog.LogId = Guid.NewGuid().ToString(); syncLog.CCode = targetConfig.Code; syncLog.CName = targetConfig.Name; syncLog.Synctype = dataType; syncLog.SyncDate = System.DateTime.Now; syncLog.FileName = fileName; syncLog.Succ = 1; string strSql = SqlBuilder.BuildInsertSql(syncLog); oracleDb.ExecuteNonQuery(strSql, null); return syncLog; }
public void UpdateSyncLog(OracleDbOperation oracleDb, SyncDataLog syncLog) { syncLog.Succ = 0; string strSql = SqlBuilder.BuildUpdateSql(syncLog); oracleDb.ExecuteNonQuery(strSql, null); }