// SelWaiter2.cpp : implementation file
//

#include "stdafx.h"
#include "ylgl.h"
#include "SelWaiter2.h"

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

/////////////////////////////////////////////////////////////////////////////
// SelWaiter2 dialog


SelWaiter2::SelWaiter2(CWnd* pParent /*=NULL*/)
	: CDialog(SelWaiter2::IDD, pParent)
{
	//{{AFX_DATA_INIT(SelWaiter2)
	beginno = 0;
	//}}AFX_DATA_INIT
}


void SelWaiter2::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(SelWaiter2)
	DDX_Control(pDX, IDC_COMBOwaiter1, m_combowaiter1);
	DDX_Control(pDX, IDC_COMBOwaiter2, m_combowaiter2);
	DDX_Control(pDX, IDC_COMBOwaiter12, m_combowaiter12);
	DDX_Control(pDX, IDC_COMBOwaiter22, m_combowaiter22);
	DDX_Text(pDX, IDC_EDIT1, beginno);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(SelWaiter2, CDialog)
	//{{AFX_MSG_MAP(SelWaiter2)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// SelWaiter2 message handlers

BOOL SelWaiter2::OnInitDialog() 
{
	CDialog::OnInitDialog();
#ifdef CHILD_VERSION
	GetDlgItem(IDC_STATIC1)->SetWindowText("����ʦ:");
#endif
	// TODO: Add extra initialization here

	int pos=m_combowaiter1.FindString (0, waiter1);
	if(pos==-1)
	{
		m_combowaiter1.InsertString (0, waiter1);
		m_combowaiter1.SetCurSel (0);
	}
	else
		m_combowaiter1.SetCurSel (pos);
	
	pos=m_combowaiter12.FindString (0, waiter12);
	if(pos==-1)
	{
		m_combowaiter12.InsertString (0, waiter12);
		m_combowaiter12.SetCurSel (0);
	}
	else
		m_combowaiter12.SetCurSel (pos);

	pos=m_combowaiter2.FindString (0, waiter2);
	if(pos==-1)
	{
		m_combowaiter2.InsertString (0, waiter2);
		m_combowaiter2.SetCurSel (0);
	}
	else
		m_combowaiter2.SetCurSel (pos);

	pos=m_combowaiter22.FindString (0, waiter22);
	if(pos==-1)
	{
		m_combowaiter22.InsertString (0, waiter22);
		m_combowaiter22.SetCurSel (0);
	}
	else
		m_combowaiter22.SetCurSel (pos);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void SelWaiter2::OnOK() 
{
	// TODO: Add extra validation here
	int pos=m_combowaiter1.GetCurSel ();
	if(pos!=-1)
	{
		m_combowaiter1.GetLBText (pos, waiter1);

		if ( waiter1 == "" )
		{
			AfxMessageBox("��ӰʦΪ��ѡ�");
			return;
		}
	}

	pos=m_combowaiter12.GetCurSel ();
	if(pos!=-1)
	{
		m_combowaiter12.GetLBText (pos, waiter12);
	}	

	pos=m_combowaiter2.GetCurSel ();
	if(pos!=-1)
	{
		m_combowaiter2.GetLBText (pos, waiter2);
		if ( waiter2 == "" )
		{
			
#ifdef CHILD_VERSION
			AfxMessageBox("����ʦΪ��ѡ�");
#else
			AfxMessageBox("��ױʦΪ��ѡ�");
#endif
			return;
		}
	}

	pos=m_combowaiter22.GetCurSel ();
	if(pos!=-1)
	{
		m_combowaiter22.GetLBText (pos, waiter22);
	}
	CDialog::OnOK();
}