private OperationLog ToModel(DataRow row) { OperationLog model = new OperationLog(); model.Id = (System.Guid)row["Id"]; model.OperatorId = (Guid)row["OperatorId"]; model.OperatingDate = (DateTime)row["OperatingDate"]; model.ActionDesc = (string)row["ActionDesc"]; return model; }
/// <summary> /// 查看操作记录 /// </summary> /// <param name="sql"></param> /// <param name="parameters"></param> /// <returns></returns> public OperationLog[] Search(Guid operatorId) { DataTable table = SqlHelper.ExecuteDataTable(@" select * from T_OperationLog where OperatorId=@OperatorId", new SqlParameter("@OperatorId",operatorId)); OperationLog[] logs = new OperationLog[table.Rows.Count]; for (int i = 0; i < table.Rows.Count; i++) { logs[i] = ToModel(table.Rows[i]); } return logs; }