// ErOTeam.cpp : implementation file
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"

#include "ErOTeam.hpp"

#include "ErO_Op.hpp"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

const CString g_c_csUnknownPerson = "< Unknown >";

//Programmers Info
extern ErrorOperator_TeamList g_clListOfTeams;

//############################################################################
//############################################################################
//############################################################################

//***************************************************************************
ErrorOperator_Team::ErrorOperator_Team(	//Module
																				CString _csModuleName,
																				CString _csModuleVersion,

																				//Main Programmer
																				CString _csMainProgrammerName,
																				CString _csMainProgrammerPhoneNumber,
																				CString _csMainProgrammerEMailAddress,
																				
																				//Responsible
																				CString _csResponsibleName,
																				CString _csResponsiblePhoneNumber,
																				CString _csResponsibleEMailAddress,
																				
																				//Second Programmer
																				CString _csSecondProgrammerName,
																				CString _csSecondProgrammerPhoneNumber,
																				CString _csSecondProgrammerEMailAddress
																			)
{
	//Module
	m_csModuleName = _csModuleName;
	m_csModuleVersion = _csModuleVersion;

	//Main Programmer
	m_csMainProgrammerName = _csMainProgrammerName;
	m_csMainProgrammerPhoneNumber = _csMainProgrammerPhoneNumber;
	m_csMainProgrammerEMailAddress = _csMainProgrammerEMailAddress;
	
	//Responsible
	m_csResponsibleName = _csResponsibleName;
	m_csResponsiblePhoneNumber = _csResponsiblePhoneNumber;
	m_csResponsibleEMailAddress = _csResponsibleEMailAddress;
	
	//Second Programmer
	m_csSecondProgrammerName = _csSecondProgrammerName;
	m_csSecondProgrammerPhoneNumber = _csSecondProgrammerPhoneNumber;
	m_csSecondProgrammerEMailAddress = _csSecondProgrammerEMailAddress;
}

//***************************************************************************
ErrorOperator_Team::~ErrorOperator_Team()
{

}

//############################################################################
//############################################################################
//############################################################################

//***************************************************************************
ErrorOperator_TeamList::ErrorOperator_TeamList()
{

}

//***************************************************************************
ErrorOperator_TeamList::~ErrorOperator_TeamList()
{
	m_pri_fn_vEmptyList();
}

//***************************************************************************
ErrorOperator_Team *ErrorOperator_TeamList::m_pub_fn_pclAddTeam(//Module
																																CString _csModuleName,
																																CString _csModuleVersion,

																																//Main Programmer
																																CString _csMainProgrammerName,
																																CString _csMainProgrammerPhoneNumber,
																																CString _csMainProgrammerEMailAddress,
																																
																																//Responsible
																																CString _csResponsibleName,
																																CString _csResponsiblePhoneNumber,
																																CString _csResponsibleEMailAddress,
																																
																																//Second Programmer
																																CString _csSecondProgrammerName,
																																CString _csSecondProgrammerPhoneNumber,
																																CString _csSecondProgrammerEMailAddress)
{
	ErrorOperator_Team *pclNewTeam = new ErrorOperator_Team(//Module
																													_csModuleName,
																													_csModuleVersion,

																													//Main Programmer
																													_csMainProgrammerName,
																													_csMainProgrammerPhoneNumber,
																													_csMainProgrammerEMailAddress,
																													
																													//Responsible
																													_csResponsibleName,
																													_csResponsiblePhoneNumber,
																													_csResponsibleEMailAddress,
																													
																													//Second Programmer
																													_csSecondProgrammerName,
																													_csSecondProgrammerPhoneNumber,
																													_csSecondProgrammerEMailAddress);
	AddTail(pclNewTeam);

	return pclNewTeam;
}

//***************************************************************************
void ErrorOperator_TeamList::m_pri_fn_vEmptyList()
{
	POSITION pos = GetHeadPosition();
	while ( pos != NULL )
		delete ( GetNext(pos) );

	RemoveAll();
}

//***************************************************************************
ErrorOperator_Team *ErrorOperator_TeamList::m_pub_fn_pclGetTeamFromModuleName(CString _csModuleName)
{
	BOOL bFound = FALSE;
	ErrorOperator_Team *pclCurrentTeam;

	POSITION pos = GetHeadPosition();
	while ( (pos != NULL) && (!bFound) )
	{
		pclCurrentTeam = GetNext(pos);

		bFound = ( pclCurrentTeam->m_csModuleName.CompareNoCase(_csModuleName) == 0 );
	}

	if ( bFound )
		return pclCurrentTeam;
	else
		return NULL;
}

