⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quanxian.cpp

📁 面向软件工程的Visual C++网络程序开发
💻 CPP
字号:
// QuanXian.cpp : implementation file
//

#include "stdafx.h"
#include "falcon_jxc.h"
#include "QuanXian.h"
#include "falcon_jxcdoc.h"
#include "FALCON_JXCView.h"
#include "mainfrm.h"
#include "message.h"

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

/////////////////////////////////////////////////////////////////////////////
// CQuanXian dialog


CQuanXian::CQuanXian(CWnd* pParent /*=NULL*/)
	: CDialog(CQuanXian::IDD, pParent)
{
	//{{AFX_DATA_INIT(CQuanXian)
	//}}AFX_DATA_INIT
}


void CQuanXian::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CQuanXian)
	DDX_Control(pDX, IDC_EDIT3, m_ctrPassword);
	DDX_Control(pDX, IDC_EDIT1, m_ctrUserName);
	DDX_Control(pDX, IDC_CHECK9, m_ctrCheck9);
	DDX_Control(pDX, IDC_CHECK8, m_ctrCheck8);
	DDX_Control(pDX, IDC_CHECK7, m_ctrCheck7);
	DDX_Control(pDX, IDC_CHECK6, m_ctrCheck6);
	DDX_Control(pDX, IDC_CHECK5, m_ctrCheck5);
	DDX_Control(pDX, IDC_CHECK4, m_ctrCheck4);
	DDX_Control(pDX, IDC_CHECK3, m_ctrCheck3);
	DDX_Control(pDX, IDC_CHECK22, m_ctrCheck22);
	DDX_Control(pDX, IDC_CHECK21, m_ctrCheck21);
	DDX_Control(pDX, IDC_CHECK20, m_ctrCheck20);
	DDX_Control(pDX, IDC_CHECK2, m_ctrCheck2);
	DDX_Control(pDX, IDC_CHECK19, m_ctrCheck19);
	DDX_Control(pDX, IDC_CHECK18, m_ctrCheck18);
	DDX_Control(pDX, IDC_CHECK17, m_ctrCheck17);
	DDX_Control(pDX, IDC_CHECK16, m_ctrCheck16);
	DDX_Control(pDX, IDC_CHECK15, m_ctrCheck15);
	DDX_Control(pDX, IDC_CHECK14, m_ctrCheck14);
	DDX_Control(pDX, IDC_CHECK13, m_ctrCheck13);
	DDX_Control(pDX, IDC_CHECK12, m_ctrCheck12);
	DDX_Control(pDX, IDC_CHECK11, m_ctrCheck11);
	DDX_Control(pDX, IDC_CHECK10, m_ctrCheck10);
	DDX_Control(pDX, IDC_CHECK1, m_ctrCheck1);
	DDX_Control(pDX, IDC_MSFLEXGRID1, m_ctrGrid);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CQuanXian, CDialog)
	//{{AFX_MSG_MAP(CQuanXian)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CQuanXian message handlers

void CQuanXian::OnButton4() 
{
	// TODO: Add your control notification handler code here
	if (m_StrTempArray.GetSize()!=0)
	m_StrTempArray.RemoveAll();
	DestroyWindow();
}

BOOL CQuanXian::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_ctrGrid.SetColWidth(0,1500);
	m_ctrGrid.SetColWidth(1,1500);
	m_ctrGrid.SetTextArray(0,"用户名");
    m_ctrGrid.SetTextArray(1,"密  码");

	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
	CFALCON_JXCDoc* pDoc = pView->GetDocument();

	CString str;
	if(pDoc->ConnectToServer())
	{

		pDoc->SendMsg("",1810);//
	}
	else
		return false;

a: 
	if(pDoc->m_b2810)
	{
//		AfxMessageBox(pDoc->m_pMsg->ShortMessage);
		if(pDoc->m_pMsg->ShortMessage != "")
		{
			if(pDoc->m_iRow>100)
			m_ctrGrid.SetRows(pDoc->m_iRow+1);
			for(int i = 1; i < pDoc->m_iRow+1; i++)
			{
//				str.Format("%d",i);
//				m_ctrGrid.SetTextMatrix(i,0,str);

				str = pDoc->m_StrArray[(i-1)*pDoc->m_iCol];
				m_ctrGrid.SetTextMatrix(i,0,str);
				str = pDoc->m_StrArray[(i-1)*pDoc->m_iCol+1];
				m_ctrGrid.SetTextMatrix(i,1,str);
			}
			m_ctrGrid.Refresh();
		}
		else
		{
			AfxMessageBox("未查到相符记录!");
			m_ctrGrid.SetRows(1);
			m_ctrGrid.Refresh();
		}
		pDoc->m_b2810 = FALSE;
	}
	else
	{
		pDoc->ProcessReadMessage();
		goto a;
	}
	m_StrTempArray.RemoveAll();
	for(int j=0;j<pDoc->m_iCol*pDoc->m_iRow;j++)
	{
		str=pDoc->m_StrArray.GetAt(j);
		m_StrTempArray.Add(str);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BEGIN_EVENTSINK_MAP(CQuanXian, CDialog)
    //{{AFX_EVENTSINK_MAP(CQuanXian)
	ON_EVENT(CQuanXian, IDC_MSFLEXGRID1, -600 /* Click */, OnClickMsflexgrid1, VTS_NONE)
	//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void CQuanXian::OnClickMsflexgrid1() 
{
	// TODO: Add your control notification handler code here
	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
	CFALCON_JXCDoc* pDoc = pView->GetDocument();
	m_ctrUserName.SetReadOnly(true);
	int i = m_ctrGrid.GetRow();
	if(i>pDoc->m_iRow)
		return ;
	CString str = m_StrTempArray[(i-1)*pDoc->m_iCol];
	m_ctrUserName.SetWindowText(str);
//	if(str=="管理员")
//	m_ctrUserName.SetReadOnly(true);
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+1];
	m_ctrPassword.SetWindowText(str);
//	if(str=="管理员")
//	m_ctrPassword.SetReadOnly(true);
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+2];
	m_ctrCheck1.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+3];
	m_ctrCheck2.SetCheck(atoi(str));	
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+4];
	m_ctrCheck3.SetCheck(atoi(str));	
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+5];
	m_ctrCheck4.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+6];
	m_ctrCheck5.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+7];
	m_ctrCheck6.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+8];
	m_ctrCheck7.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+9];
	m_ctrCheck8.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+10];
	m_ctrCheck9.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+11];
	m_ctrCheck10.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+12];
	m_ctrCheck11.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+13];
	m_ctrCheck12.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+14];
	m_ctrCheck13.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+15];
	m_ctrCheck14.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+16];
	m_ctrCheck15.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+17];
	m_ctrCheck16.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+18];
	m_ctrCheck17.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+19];
	m_ctrCheck18.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+20];
	m_ctrCheck19.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+21];
	m_ctrCheck20.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+22];
	m_ctrCheck21.SetCheck(atoi(str));
	str = m_StrTempArray[(i-1)*pDoc->m_iCol+23];
	m_ctrCheck22.SetCheck(atoi(str));
}

void CQuanXian::OnButton1() //for add record....
{
	// TODO: Add your control notification handler code here
	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
	CFALCON_JXCDoc* pDoc = pView->GetDocument();
	CString strInsert,str;
	m_ctrUserName.GetWindowText(str);
	strInsert=str;
	strInsert+=CHARFLAG;

    m_ctrPassword.GetWindowText(str);
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck1.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck2.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck3.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck4.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck5.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck6.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck7.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck8.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck9.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck10.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck11.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck12.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck13.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck14.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck15.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck16.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck17.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck18.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck19.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck20.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck21.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck22.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;
	if(pDoc->ConnectToServer())
	{

		pDoc->SendMsg(strInsert,1811);//发送存储"收款凭据"请求
	}
	else
		return;
b:	if (pDoc->m_b2811)
	{
		pDoc->m_b2811 = FALSE;

	}
	else
	{
		pDoc->ProcessReadMessage();
		goto b;
	}

}

void CQuanXian::OnButton2() //修改。。。。
{
	// TODO: Add your control notification handler code here
	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
	CFALCON_JXCDoc* pDoc = pView->GetDocument();
	CString strInsert,str;
	m_ctrUserName.GetWindowText(str);
	strInsert=str;
	strInsert+=CHARFLAG;

	strInsert+=str;
	strInsert+=CHARFLAG;
	
    m_ctrPassword.GetWindowText(str);
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck1.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck2.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck3.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck4.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck5.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck6.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck7.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck8.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck9.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck10.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck11.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck12.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck13.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck14.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck15.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck16.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck17.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck18.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck19.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck20.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck21.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;

	str.Format("%d",m_ctrCheck22.GetCheck());
	strInsert+=str;
	strInsert+=CHARFLAG;
	if(pDoc->ConnectToServer())
	{

		pDoc->SendMsg(strInsert,1812);//发送存储"收款凭据"请求
	}
	else
		return;
b:	if (pDoc->m_b2812)
	{
		pDoc->m_b2812 = FALSE;

	}
	else
	{
		pDoc->ProcessReadMessage();
		goto b;
	}

}

void CQuanXian::OnButton3() 
{
	// TODO: Add your control notification handler code here
	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->m_pMainWnd;
	CFALCON_JXCView* pView=(CFALCON_JXCView*)pwnd->GetActiveView();
	CFALCON_JXCDoc* pDoc = pView->GetDocument();
	CString strInsert,str;
	m_ctrUserName.GetWindowText(str);
	strInsert=str;
//	strInsert+=CHARFLAG;

	if(pDoc->ConnectToServer())
	{

		pDoc->SendMsg(strInsert,1813);//发送delete
	}
	else
		return;
b:	if (pDoc->m_b2813)
	{
		pDoc->m_b2813 = FALSE;

	}
	else
	{
		pDoc->ProcessReadMessage();
		goto b;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -