// ompanyInfo.cpp : implementation file
//

#include "stdafx.h"
#include "ylgl.h"
#include "TXFG.h"

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

/////////////////////////////////////////////////////////////////////////////
// TXFG dialog

TXFG::TXFG(CWnd* pParent /*=NULL*/)
	: CDialog(TXFG::IDD, pParent)
{
	//{{AFX_DATA_INIT(TXFG)
	m_edit1 = _T("");
	m_edit2 = _T("");
	m_edit3 = _T("");
	m_edit4 = _T("");
	m_edit5 = _T("");
	m_edit6 = _T("");
	m_edit7 = _T("");
	m_edit8 = _T("");
	m_edit9 = _T("");
	m_edit10 = _T("");
	m_edit11 = _T("");
	m_edit12 = _T("");
	//}}AFX_DATA_INIT
}


void TXFG::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(TXFG)
	DDX_Text(pDX, IDC_EDIT1, m_edit1);
	DDX_Text(pDX, IDC_EDIT2, m_edit2);
	DDX_Text(pDX, IDC_EDIT3, m_edit3);
	DDX_Text(pDX, IDC_EDIT4, m_edit4);
	DDX_Text(pDX, IDC_EDIT7, m_edit5);
	DDX_Text(pDX, IDC_EDIT8, m_edit6);
	DDX_Text(pDX, IDC_EDIT9, m_edit7);
	DDX_Text(pDX, IDC_EDIT10, m_edit8);
	DDX_Text(pDX, IDC_EDIT11, m_edit9);
	DDX_Text(pDX, IDC_EDIT12, m_edit10);
	DDX_Text(pDX, IDC_EDIT13, m_edit11);
	DDX_Text(pDX, IDC_EDIT14, m_edit12);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// TXFG message handlers

BOOL TXFG::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO: Add extra initialization here
	g_sendhead.bsql = 0;
	g_sendhead.code[0] = 77;
	g_sendhead.tabcount = 1;
	int g_nYearposTemp = g_nYearpos;
	g_nYearpos = -1;
	g_pMainWnd->ProcessChatMessageRequest2(1);
	g_nYearpos = g_nYearposTemp;
	if (g_bSendOK == 0)
	{
		CDialog::OnCancel();
		return 1;
	}
	DataToArray(&m_List1array);
	if (m_List1array.GetSize() == 12)
	{
		m_edit1 = (m_List1array.ElementAt(0).ElementAt(0));
		m_edit2 = (m_List1array.ElementAt(1).ElementAt(0));
		m_edit3 = (m_List1array.ElementAt(2).ElementAt(0));
		m_edit4 = (m_List1array.ElementAt(3).ElementAt(0));
		m_edit5 = (m_List1array.ElementAt(4).ElementAt(0));
		m_edit6 = (m_List1array.ElementAt(5).ElementAt(0));
		m_edit7 = (m_List1array.ElementAt(6).ElementAt(0));
		m_edit8 = (m_List1array.ElementAt(7).ElementAt(0));
		m_edit9 = (m_List1array.ElementAt(8).ElementAt(0));
		m_edit10 = (m_List1array.ElementAt(9).ElementAt(0));
		m_edit11 = (m_List1array.ElementAt(10).ElementAt(0));
		m_edit12 = (m_List1array.ElementAt(11).ElementAt(0));
	}
	else
	{
		CStringArray strarray;
		strarray.Add("���ŵ���");
		strarray.Add("������");
		strarray.Add("��������");
		strarray.Add("��ͳ��");
		strarray.Add("�³�����");
		strarray.Add("��������");
		strarray.Add("������");
		strarray.Add("��������");
		strarray.Add("������ܰ");
		strarray.Add("�����ͻ�");
		strarray.Add("�������");
		strarray.Add("�崿�ɰ�");
		int pos = 0;
		m_edit1 = strarray.ElementAt(pos); pos++;
		m_edit2 = strarray.ElementAt(pos); pos++;
		m_edit3 = strarray.ElementAt(pos); pos++;
		m_edit4 = strarray.ElementAt(pos); pos++;
		m_edit5 = strarray.ElementAt(pos); pos++;
		m_edit6 = strarray.ElementAt(pos); pos++;
		m_edit7 = strarray.ElementAt(pos); pos++;
		m_edit8 = strarray.ElementAt(pos); pos++;
		m_edit9 = strarray.ElementAt(pos); pos++;
		m_edit10 = strarray.ElementAt(pos); pos++;
		m_edit11 = strarray.ElementAt(pos); pos++;
		m_edit12 = strarray.ElementAt(pos); pos++;
	}
	UpdateData(false);
	CenterWindow();
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void TXFG::OnOK()
{
	// TODO: Add extra validation here
	UpdateData();
	CString sql = "delete from taoxifg";
	CString temp;
	int pos = 0;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit1); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit2); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit3); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit4); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit5); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit6); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit7); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit8); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit9); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit10); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit11); sql += temp;
	temp.Format("***insert into taoxifg([name])values('%s')", m_edit12); sql += temp;
	g_sendhead.bsql = 1;
	g_pMainWnd->ProcessChatMessageRequest2(sql);
	if (g_bSendOK == 0)return;
	AfxMessageBox("����ɹ�!", MB_ICONINFORMATION);

	CDialog::OnOK();
}