Скачиваний:
92
Добавлен:
01.05.2014
Размер:
1.73 Кб
Скачать
// DlgAddEmpl.cpp : implementation file
//

#include "stdafx.h"
#include "kurs.h"
#include "DlgAddEmpl.h"

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

/////////////////////////////////////////////////////////////////////////////
// DlgAddEmpl dialog


DlgAddEmpl::DlgAddEmpl(CWnd* pParent /*=NULL*/)
	: CDialog(DlgAddEmpl::IDD, pParent)
{
	//{{AFX_DATA_INIT(DlgAddEmpl)
	m_fioe = _T("");
	m_post = _T("");
	m_passe = _T("");
	//}}AFX_DATA_INIT
}


void DlgAddEmpl::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(DlgAddEmpl)
	DDX_Text(pDX, IDC_FIOE, m_fioe);
	DDX_CBString(pDX, IDC_POST, m_post);
	DDX_Text(pDX, IDC_PASSE, m_passe);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// DlgAddEmpl message handlers


void DlgAddEmpl::OnOK() 
{
		UINT len;
		UpdateData(true);
		if (!m_fioe.IsEmpty() && !m_passe.IsEmpty() && !m_post.IsEmpty()){
			len = m_fioe.GetLength();
			if (len>15) {m_fioe=m_fioe.Left(15);}
			else
				while (len<15){
					m_fioe+=' ';
					len = m_fioe.GetLength();
				}
			len = m_passe.GetLength();
			if (len>11) {m_passe=m_passe.Left(11);}
			else
			while (len<11){
				m_passe+=' ';
				len = m_passe.GetLength();
			}
			len = m_post.GetLength();
			if (len>10) {m_post=m_post.Left(10);}
			else
			while (len<10){
				m_post+=' ';
				len = m_post.GetLength();
			};
			UpdateData(false);
			CDialog::OnOK();
		}
		else{
			AfxMessageBox("Заполнены не все поля!");
		}
}
Соседние файлы в папке kurs