/// <summary> /// 提供对Record对象的操做。插入、更新、删除、插入或更新 /// </summary> /// <param name="record">数据记录对象</param> /// <param name="execMode">插入、更新、删除、插入或更新</param> /// <param name="isAddLog">是否添加日志</param> /// <param name="isAddLog">是否生成新id</param> /// <returns></returns> public int ProcessRecord(Record record, ExecuteMode execMode, bool isAddLog, bool isNewID) { record.OnException += new ExceptionHandler(record_OnException); record.OnExceptionEx += new ExceptionExHandler(cmd_OnExceptionEx); record.OnExceptionXP += new ExceptionXPHandler(record_OnExceptionXP); if (isNewID) { if (record.FieldCollection["EID"] == null || record.FieldCollection["EID"].Value == null) { string eid = record.CreateEID(); if (record.FieldCollection["EID"] == null) { record.FieldCollection["EID"].Value = eid; } else { record.FieldCollection.Add(new Field("EID", eid)); } } } if (OnProgress != null) { OnProgress(string.Format(@"{2} 处理一条数据记录。记录关联表:{0};操作:{1}", record.TableName, execMode.ToString(), DateTime.Now)); } record.Connection = this._conn; DateTime dt1 = DateTime.Now; int i = record.Process(execMode); if (record.Process(execMode) != -1) { DateTime dt2 = DateTime.Now; #if debug DateTime dt2 = DateTime.Now; TimeSpan ts = dt2 - dt1; if (OnProgress != null) { OnProgress(string.Format(@"{0} 处理一条数据记录。记录关联表:{1};操作花费时间{2}", DateTime.Now, record.TableName, ts.TotalMilliseconds)); } #endif dt1 = DateTime.Now; if (isAddLog) { i = record.AddLog(this._emlogtable); } dt2 = DateTime.Now; #if debug ts = dt2 - dt1; if (OnProgress != null) { OnProgress(string.Format(@"{0} 处理一条数据记录。记录关联表:{1};写入log花费时间{2}", DateTime.Now, record.TableName, ts.TotalMilliseconds)); } #endif return(i); } return(-1); }
/// <summary> /// 提供对Record对象的操做。插入、更新、删除、插入或更新 /// </summary> /// <param name="record">数据记录对象</param> /// <param name="execMode">插入、更新、删除、插入或更新</param> /// <returns></returns> public int ProcessRecord(Record record, ExecuteMode execMode) { record.OnException += new ExceptionHandler(record_OnException); record.OnExceptionEx += new ExceptionExHandler(cmd_OnExceptionEx); record.OnExceptionXP += new ExceptionXPHandler(record_OnExceptionXP); if (OnProgress != null) { OnProgress(string.Format(@"{2} 处理一条数据记录。记录关联表:{0};操作:{1}", record.TableName, execMode.ToString(), DateTime.Now)); } //record.dbType = this._conn.ConnectionType; record.Connection = this._conn; return(record.Process(execMode)); }
/// <summary> /// 提供对Record对象的操做。插入、更新、删除、插入或更新 /// </summary> /// <param name="record">数据记录对象</param> /// <param name="execMode">插入、更新、删除、插入或更新</param> /// <param name="isAddLog">是否添加日志</param> /// <returns></returns> public int ProcessRecord(Record record, ExecuteMode execMode, bool isAddLog) { record.OnException += new ExceptionHandler(record_OnException); record.OnExceptionXP += new ExceptionXPHandler(record_OnExceptionXP); record.OnExceptionEx += new ExceptionExHandler(cmd_OnExceptionEx); if (OnProgress != null) { OnProgress(string.Format(@"{2} 处理一条数据记录。记录关联表:{0};操作:{1}", record.TableName, execMode.ToString(), DateTime.Now)); } record.Connection = this._conn; DateTime dt1 = DateTime.Now; int i = record.Process(execMode); if (i != -1) { //#if debug DateTime dt2 = DateTime.Now; TimeSpan ts = dt2 - dt1; if (OnProgress != null) { OnProgress(string.Format(@"{0} 处理一条数据记录。记录关联表:{1};操作花费时间{2}", DateTime.Now, record.TableName, ts.TotalMilliseconds)); } dt1 = DateTime.Now; //#endif if (isAddLog) { i = record.AddLog(this._emlogtable); } #if debug dt2 = DateTime.Now; ts = dt2 - dt1; if (OnProgress != null) { OnProgress(string.Format(@"{0} 处理一条数据记录。记录关联表:{1};写入log花费时间{2}", DateTime.Now, record.TableName, ts.TotalMilliseconds)); } #endif return(i); } return(-1); }