// ClientRequirement.cpp : implementation file
//

#include "stdafx.h"
#include "ylgl.h"
#include "ClientRequirement.h"
#include "SPLBDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CClientRequirement dialog
CClientRequirement::CClientRequirement(CWnd* pParent /*=NULL*/)
	: CDialog(CClientRequirement::IDD, pParent)
{
	//{{AFX_DATA_INIT(CClientRequirement)
	m_bz2 = _T("");
	m_no = _T("");
	//}}AFX_DATA_INIT
	m_bSave=0;
	m_nMode=0;
}

void CClientRequirement::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CClientRequirement)
	DDX_Text(pDX, IDC_EDIT1, m_bz2);
	DDV_MaxChars(pDX, m_bz2, 1000);
	DDX_Text(pDX, IDC_STATIC1, m_no);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CClientRequirement, CDialog)
	//{{AFX_MSG_MAP(CClientRequirement)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CClientRequirement message handlers

void CClientRequirement::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if(m_bSave)
	{
		UpdateData();
		CString sql;
sql= "update dindan set bz2='"+m_bz2+"' where id='"+m_id+"'";
       g_sendhead.bsql=1;
	    g_pMainWnd->ProcessChatMessageRequest2(sql);
		if(g_bSendOK==0)return;
		AfxMessageBox("����ɹ�!", MB_ICONINFORMATION);
	}
	CDialog::OnOK();
}

BOOL CClientRequirement::OnInitDialog() 
{
	CDialog::OnInitDialog();
	if(m_nMode==1)
		SetWindowText("��Ϣ����");	
	else if(m_nMode==2)
		GetDlgItem(IDC_STATIC1)->ShowWindow(SW_SHOW);

	if(m_nMode!=2)
		GetDlgItem(IDC_BUTTON1)->ShowWindow(SW_HIDE);
	if(m_bSave==0)
	{
		SetDlgItemText(IDOK, "ȷ��");return true;
	}
	// TODO:	 extra initialization here
	GetDlgItem(IDC_EDIT1)->SetFocus();
	return false;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CClientRequirement::OnButton1() 
{
	// TODO: Add your control notification handler code here
	SPLBDlg dlg;
	dlg.m_mode=19;
	if(dlg.DoModal ()==IDOK)
	{
		UpdateData();	
		m_bz2+=dlg.m_edit1;
		UpdateData(0);
	}
}