/// <summary> /// 设置SQL参数表 /// </summary> /// <param name="Operationlog">Operationlog对象</param> /// <returns>Operationlog参数数组</returns> private SqlParameter[] Set_Operationlog_Parameters(OperationlogInfo operationlogInfo) { SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@Indx",operationlogInfo.Indx), new SqlParameter("@LogDate",operationlogInfo.LogDate), new SqlParameter("@UserCode",operationlogInfo.UserCode), new SqlParameter("@UserName",operationlogInfo.UserName), new SqlParameter("@Content",string.IsNullOrEmpty(operationlogInfo.Content)?"":operationlogInfo.Content), new SqlParameter("@GroupName",operationlogInfo.GroupName), new SqlParameter("@IsSuccess",operationlogInfo.IsSuccess), new SqlParameter("@UDF01",operationlogInfo.UDF01), new SqlParameter("@UDF02",operationlogInfo.UDF02), new SqlParameter("@UDF03",operationlogInfo.UDF03), new SqlParameter("@UDF04",operationlogInfo.UDF04), new SqlParameter("@UDF05",operationlogInfo.UDF05) }; return paramArray; }
/// <summary> /// 初始化OperationlogInfo /// </summary> private OperationlogInfo InitOperationlogInfoByDataReader(OperationlogInfo operationlogInfo, IDataReader reader) { operationlogInfo = new OperationlogInfo(reader["Indx"].ToString() != "" ? Decimal.Parse(reader["Indx"].ToString()) : 0, reader["LogDate"].ToString() != "" ? DateTime.Parse(reader["LogDate"].ToString()) : new DateTime(), reader["UserCode"].ToString(), reader["UserName"].ToString(), reader["Content"].ToString(), reader["GroupName"].ToString(), reader["IsSuccess"].ToString(), reader["UDF01"].ToString(), reader["UDF02"].ToString(), reader["UDF03"].ToString(), reader["UDF04"].ToString(), reader["UDF05"].ToString()); return operationlogInfo; }
/// <summary> /// 更新一条Operationlog记录 /// </summary> /// <param name="db">DataBase对象</param> /// <param name="tran">一个有效的DbTransaction</param> /// <param name="operationlog">Operationlog对象</param> /// <param name="whLoginID">要查询的仓库的前缀</param> /// <returns>执行更新对数据库影响的行数</returns> public int UpdateOperationlog(Database db, DbTransaction tran, OperationlogInfo operationlogInfo) { int result = 0; SqlParameter[] paras = Set_Operationlog_Parameters(operationlogInfo); if (paras != null) { result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_OPERATIONLOG, paras); } return result; }
/// <summary> /// 新增一条Operationlog记录 /// </summary> /// <param name="operationlog">Operationlog对象</param> /// <param name="whLoginID">要查询的仓库的前缀</param> /// <returns>执行新增对数据库影响的行数</returns> public int InsertOperationlog(OperationlogInfo operationlogInfo) { int result = 0; SqlParameter[] paras = Set_Operationlog_Parameters(operationlogInfo); if (paras != null) { result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_OPERATIONLOG, paras); } return result; }
/// <summary> /// 更新一条Operationlog记录 /// </summary> /// <param name="operationlog">Operationlog对象</param> /// <param name="whLoginID">要查询的仓库的前缀</param> /// <returns>执行更新对数据库影响的行数</returns> public int UpdateOperationlog(OperationlogInfo operationlogInfo) { return operationlogDA.UpdateOperationlog(operationlogInfo); }
/// <summary> /// 新增一条Operationlog记录 /// </summary> /// <param name="operationlog">Operationlog对象</param> /// <param name="whLoginID">要查询的仓库的前缀</param> /// <returns>执行新增对数据库影响的行数</returns> public int InsertOperationlog(OperationlogInfo operationlogInfo) { return operationlogDA.InsertOperationlog(operationlogInfo); }