60 lines
1.8 KiB
C++
60 lines
1.8 KiB
C++
#pragma once
|
|
#include "ListE.hpp"
|
|
#include "Record.hpp"
|
|
#define ASCENT true
|
|
#define DESCENT false
|
|
|
|
enum SortBy {
|
|
RecordID,
|
|
RecordDate,
|
|
RecordCourseName,
|
|
RecordStudentID,
|
|
RecordStudentName,
|
|
RecordType
|
|
};
|
|
|
|
class ListDisplay {
|
|
private:
|
|
const List<BaseRecord*> &allRecordsPtrList;
|
|
List<BaseRecord*> filteredRecordsPtrList;
|
|
Date fromDate;
|
|
Date toDate;
|
|
Student searchForStu;
|
|
std::string searchForCourseName;
|
|
StuRecord::RecordType searchForRecordType;
|
|
int recordNumPerPage;
|
|
// The current page index, starting from 0
|
|
int currentPageIndex;
|
|
int maxPageIndex;
|
|
bool sortOrder;
|
|
SortBy sortByProp;
|
|
const std::string searchForCourseNameToString() const;
|
|
const std::string searchForRecordTypeToString() const;
|
|
|
|
public:
|
|
ListDisplay(const List<BaseRecord*> &_allRecordsPtrList);
|
|
bool hasNext();
|
|
bool hasPrev();
|
|
void next();
|
|
void prev();
|
|
void display();
|
|
// Set the new sort by. Does not display new result.
|
|
void setSortBy(const SortBy _propName);
|
|
// Set the new sort order. Does not display new result.
|
|
void setSortOrder(const bool newOrder);
|
|
// Filp the sort Order to the opposite way. Does not dispaly new result.
|
|
void flipSortOrder();
|
|
// Make sure the filteredRecordsPtrList matches current searching criteria. Does not display new result.
|
|
void reapplyFilter();
|
|
// Ask for a record ID, and display the complete info right away. If the requested ID does not exist, simply display an error message and exit.
|
|
void promptForRecordID();
|
|
void promptForFromDate();
|
|
void promptForToDate();
|
|
void promptForSearchStuID();
|
|
void promptForSearchStuName();
|
|
void promptForCourseName();
|
|
void promptForRecordType();
|
|
void promptRecordNumPerPage();
|
|
// Disable all search limits, not including sortby and ascent descent.
|
|
void resetSearch();
|
|
}; |