private SyncInfo GetSyncInfoBySyncDataId(int accountId, string syncDataId, SyncDataType syncDataType) { var sql = string.Format( "select AccountId,LocalDataId,SyncDataId,SyncDataType from Cooper_SyncInfo where AccountId={0} and SyncDataId='{1}' collate Chinese_PRC_CS_AI and SyncDataType={2}", accountId, syncDataId, (int)syncDataType); var query = _sessionManager.OpenSession().CreateSQLQuery(sql); var objectArrayList = query.List(); if (objectArrayList.Count > 0) { object[] objectArray = objectArrayList[0] as object[]; SyncInfo syncInfo = new SyncInfo(); syncInfo.AccountId = int.Parse(objectArray[0].ToString()); syncInfo.LocalDataId = objectArray[1].ToString(); syncInfo.SyncDataId = objectArray[2].ToString(); syncInfo.SyncDataType = int.Parse(objectArray[3].ToString()); return(syncInfo); } return(null); }
public SyncFile(FileInfo file, SyncDataType type, string syncPath) { this.File = file; this.SyncType = (int)type; this.Name = String.Format("{0} {1}", (type == SyncDataType.NotExist) ? '✔' : (type == SyncDataType.FileSizeDiffer) ? '☀' : '✖', file.Name); if (syncPath != null) { this.SyncPath = syncPath.Remove(syncPath.LastIndexOf(@"\") + 1); } SyncFile.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; }
/// <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); }
private SyncInfo GetSyncInfoBySyncDataId(int accountId, string syncDataId, SyncDataType syncDataType) { var sql = string.Format( "select AccountId,LocalDataId,SyncDataId,SyncDataType from Cooper_SyncInfo where AccountId={0} and SyncDataId='{1}' collate Chinese_PRC_CS_AI and SyncDataType={2}", accountId, syncDataId, (int)syncDataType); var query = _sessionManager.OpenSession().CreateSQLQuery(sql); var objectArrayList = query.List(); if (objectArrayList.Count > 0) { object[] objectArray = objectArrayList[0] as object[]; SyncInfo syncInfo = new SyncInfo(); syncInfo.AccountId = int.Parse(objectArray[0].ToString()); syncInfo.LocalDataId = objectArray[1].ToString(); syncInfo.SyncDataId = objectArray[2].ToString(); syncInfo.SyncDataType = int.Parse(objectArray[3].ToString()); return syncInfo; } return null; }