/// <summary>更新操作信息 /// </summary> /// <param name="item"></param> /// <param name="itemBase">原始数据</param> /// <returns></returns> protected internal virtual bool RefreshLog(T item, T itemBase, typePermission_DB permission) { //更新日志信息 //item.Operator = null; item.OpTime = DateTime.Now; _nChanges++; //标识修改数 //记录日志 if (this._isNoLog) { return(true); } if (this.IsTempTable()) { return(true); } //DataTable dtChange = this.ComparisonChange(item, itemBase); DataModels_Log pLog = new DataModels_Log() { OpTime = DateTime.Now, Operator = item.Operator, OpType = permission, OpTable = this._dtName, OpInfo_Src = itemBase == null ? null : itemBase.ToJson(), OpInfo_To = item.ToJson(), //OpInfo_Dif = Newtonsoft.Json.JsonConvert.SerializeObject(dtChange), Remarks = "" }; //写入库表 this._dbContext.OnOperationLog(pLog, item.Operator); return(true); }
/// <summary>日志记录 /// </summary> protected internal virtual void OnOperationLog(DataModels_Log objLog, string usrID = null) { if (objLog != null) { DataModels_Log pLog = new DataModels_Log() { OpTime = DateTime.Now, Operator = usrID, OpType = objLog.OpType, OpTable = objLog.OpTable, OpInfo_Src = objLog.OpInfo_Src, OpInfo_To = objLog.OpInfo_To, OpInfo_Dif = objLog.OpInfo_Dif, Remarks = objLog.Remarks }; //写入库表 this._dtLog.Add(pLog); } }