Exemplo n.º 1
0
void MultimediaCollection::enterBorrower()
{
	cout << "Enter New Borrower Process\n";
	cout << "=============================\n";

	string sInput;
	Borrower borrower;

	cout << "Borrower ID: ";
	while(getline(cin, sInput)) {
		if(sInput.empty())
			cout << "Borrower id can't be empty. Re-enter: ";
		else
		{
			if(checkBorrowerId(sInput)) {
				cout << sInput << " exists! Re-enter: ";
			}
			else {
				borrower.setId(sInput);
				break;
			}
		}
	}

	cout << "Borrower Name: ";
	while(getline(cin, sInput))
	{
		if(sInput.empty())
			cout << "Name can't be empty! Re-enter: ";
		else {
			borrower.setName(sInput);
			break;
		}
	}
	

	cout << "Borrower Type: ";
	while(getline(cin, sInput))
	{
		if(sInput.empty())
			cout << "Type can't be empty! Re-enter: ";
		else {
			borrower.setType(sInput);
			break;
		}
	}

	cout << "Borrower Department: ";
	while(getline(cin, sInput))
	{
		if(sInput.empty())
			cout << "Department can't be empty! Re-enter: ";
		else {
			borrower.setDepartment(sInput);
			break;
		}
	}

	cout << "Borrower Mobile: ";
	while(getline(cin, sInput))
	{
		if(sInput.empty())
			cout << "Phone can't be empty! Re-enter: ";
		else {
			borrower.setMobile(sInput);
			break;
		}
	}
	
	borrower.setNumItemBorrow(0);
	borrower.setNumItemLateBorrow(0);
	
	addBorrower(borrower);
	
	cout << "Entering borrower completed!\n";
}