123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- // InputCard2Dlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "InputCard2Dlg.h"
- #include "MemberCardFunc2.h"
- #include "SelMemberCardFund.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // InputCard2Dlg dialog IDC_STATIC3
- InputCard2Dlg::InputCard2Dlg(CWnd* pParent /*=NULL*/) : CDialog(InputCard2Dlg::IDD, pParent)
- {
- m_name = _T("");
- m_no = _T("");
- m_card2no1 = _T("");
- m_card2no2 = _T("");
- m_card2no3 = _T("");
- m_card2no4 = _T("");
- m_card2no5 = _T("");
- m_mode = 0;
- m_bAddOne = 0;
- }
- void InputCard2Dlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Text(pDX, IDC_EDITname, m_name);
- DDX_Text(pDX, IDC_EDITno, m_no);
- DDX_Text(pDX, IDC_EDITcard2no1, m_card2no1);
- DDX_Text(pDX, IDC_EDITcard2no2, m_card2no2);
- DDX_Text(pDX, IDC_EDITcard2no3, m_card2no3);
- DDX_Text(pDX, IDC_EDITcard2no4, m_card2no4);
- DDX_Text(pDX, IDC_EDITcard2no5, m_card2no5);
- }
- BEGIN_MESSAGE_MAP(InputCard2Dlg, CDialog)
- ON_BN_CLICKED(Btn_Recharge, OnBnClickedRecharge)
- END_MESSAGE_MAP()
- BOOL InputCard2Dlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- if (m_bAddOne)
- {
- GetDlgItem(IDC_EDITcard2no2)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no3)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no4)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no5)->EnableWindow(0);
- }
- else
- {
- int cardnum = atoi(g_cominfoarray.ElementAt(0).ElementAt(118));
- switch (cardnum)
- {
- case 1:
- GetDlgItem(IDC_EDITcard2no2)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no3)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no4)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no5)->EnableWindow(0);
- break;
- case 2:
- //GetDlgItem(IDC_EDITcard2no2)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no3)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no4)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no5)->EnableWindow(0);
- break;
- case 3:
- //GetDlgItem(IDC_EDITcard2no2)->EnableWindow(0);
- //GetDlgItem(IDC_EDITcard2no3)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no4)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no5)->EnableWindow(0);
- break;
- case 4:
- //GetDlgItem(IDC_EDITcard2no2)->EnableWindow(0);
- //GetDlgItem(IDC_EDITcard2no3)->EnableWindow(0);
- //GetDlgItem(IDC_EDITcard2no4)->EnableWindow(0);
- GetDlgItem(IDC_EDITcard2no5)->EnableWindow(0);
- break;
- case 5:
- //GetDlgItem(IDC_EDITcard2no2)->EnableWindow(0);
- //GetDlgItem(IDC_EDITcard2no3)->EnableWindow(0);
- //GetDlgItem(IDC_EDITcard2no4)->EnableWindow(0);
- //GetDlgItem(IDC_EDITcard2no5)->EnableWindow(0);
- break;
- default:
- break;
- }
- }
- return TRUE;
- }
- void InputCard2Dlg::OnOK()
- {
- UpdateData();
- m_card2no1.TrimLeft();
- m_card2no1.TrimRight();
- m_card2no2.TrimLeft();
- m_card2no2.TrimRight();
- m_card2no3.TrimLeft();
- m_card2no3.TrimRight();
- m_card2no4.TrimLeft();
- m_card2no4.TrimRight();
- m_card2no5.TrimLeft();
- m_card2no5.TrimRight();
- int length = atol(g_cominfoarray.ElementAt(0).ElementAt(55));
- if (m_mode)
- {
- if (m_bAddOne == 0)
- {
- int cardnum = atoi(g_cominfoarray.ElementAt(0).ElementAt(118));
- switch (cardnum)
- {
- case 1:
- if (m_card2no1.IsEmpty())
- {
- AfxMessageBox("副卡号不能为空!", MB_ICONINFORMATION);
- return;
- }
- break;
- case 2:
- if (m_card2no1.IsEmpty() || m_card2no2.IsEmpty() )
- {
- AfxMessageBox("副卡号不能为空!", MB_ICONINFORMATION);
- return;
- }
- else if (m_card2no1 == m_card2no2 )
- {
- AfxMessageBox("副卡号不能相同!", MB_ICONINFORMATION); return;
- }
- break;
- case 3:
- if (m_card2no1.IsEmpty() || m_card2no2.IsEmpty() || m_card2no3.IsEmpty())
- {
- AfxMessageBox("副卡号不能为空!", MB_ICONINFORMATION);
- return;
- }
- else if (m_card2no1 == m_card2no2 || m_card2no1 == m_card2no3 || m_card2no2 == m_card2no3 )
- {
- AfxMessageBox("副卡号不能相同!", MB_ICONINFORMATION); return;
- }
- break;
- case 4:
- if (m_card2no1.IsEmpty() || m_card2no2.IsEmpty() || m_card2no3.IsEmpty() || m_card2no4.IsEmpty())
- {
- AfxMessageBox("副卡号不能为空!", MB_ICONINFORMATION);
- return;
- }
- else if (m_card2no1 == m_card2no2 || m_card2no1 == m_card2no3 || m_card2no1 == m_card2no4 || m_card2no2 == m_card2no3 || m_card2no2 == m_card2no4 || m_card2no3 == m_card2no4 )
- {
- AfxMessageBox("副卡号不能相同!", MB_ICONINFORMATION); return;
- }
- break;
- case 5:
- if (m_card2no1.IsEmpty() || m_card2no2.IsEmpty() || m_card2no3.IsEmpty() || m_card2no4.IsEmpty() || m_card2no5.IsEmpty())
- {
- AfxMessageBox("副卡号不能为空!", MB_ICONINFORMATION);
- return;
- }
- else if (m_card2no1 == m_card2no2 || m_card2no1 == m_card2no3 || m_card2no1 == m_card2no4 || m_card2no1 == m_card2no5 || m_card2no2 == m_card2no3 || m_card2no2 == m_card2no4 || m_card2no2 == m_card2no5 || m_card2no3 == m_card2no4 || m_card2no3 == m_card2no5 || m_card2no4 == m_card2no5)
- {
- AfxMessageBox("副卡号不能相同!", MB_ICONINFORMATION); return;
- }
- break;
- default:
- break;
- }
- }
- else
- {
- if (m_card2no1.IsEmpty())
- {
- AfxMessageBox("副卡号不能为空!", MB_ICONINFORMATION); return;
- }
- }
- }
- else
- {
- if ((m_card2no1 == m_card2no2 && m_card2no1 != "") || (m_card2no1 == m_card2no3 && m_card2no1 != "") || (m_card2no1 == m_card2no4 && m_card2no1 != "") || (m_card2no1 == m_card2no5 && m_card2no1 != "") || (m_card2no2 == m_card2no3 && m_card2no2 != "") || (m_card2no2 == m_card2no4 && m_card2no2 != "") || (m_card2no2 == m_card2no5 && m_card2no2 != "") || (m_card2no3 == m_card2no4 && m_card2no3 != "") || (m_card2no3 == m_card2no5 && m_card2no3 != "") || (m_card2no4 == m_card2no5 && m_card2no4 != ""))
- {
- AfxMessageBox("副卡号不能相同!", MB_ICONINFORMATION); return;
- }
- }
- /* if(!m_card2no1.IsEmpty ())
- {
- if(m_card2no1.GetLength ()!=length)
- {
- AfxMessageBox("卡号长度不对!", MB_ICONINFORMATION);return;
- }
- }
- if(!m_card2no2.IsEmpty ())
- {
- if(m_card2no2.GetLength ()!=length)
- {
- AfxMessageBox("卡号长度不对!", MB_ICONINFORMATION);return;
- }
- }
- if(!m_card2no3.IsEmpty ())
- {
- if(m_card2no3.GetLength ()!=length)
- {
- AfxMessageBox("卡号长度不对!", MB_ICONINFORMATION);return;
- }
- }
- if(!m_card2no4.IsEmpty ())
- {
- if(m_card2no4.GetLength ()!=length)
- {
- AfxMessageBox("卡号长度不对!", MB_ICONINFORMATION);return;
- }
- }
- if(!m_card2no5.IsEmpty ())
- {
- if(m_card2no5.GetLength ()!=length)
- {
- AfxMessageBox("卡号长度不对!", MB_ICONINFORMATION);return;
- }
- }*/
- CString sql;
- if (m_mode)
- {
- sql = "select count(*) as cot from membercard2blue where ";
- CString temp;
- if (!m_card2no1.IsEmpty())
- temp += "or [card2no]='" + m_card2no1 + "' ";
- if (!m_card2no2.IsEmpty())
- temp += "or [card2no]='" + m_card2no2 + "' ";
- if (!m_card2no3.IsEmpty())
- temp += "or [card2no]='" + m_card2no3 + "' ";
- if (!m_card2no4.IsEmpty())
- temp += "or [card2no]='" + m_card2no4 + "' ";
- if (!m_card2no5.IsEmpty())
- temp += "or [card2no]='" + m_card2no5 + "' ";
- temp.TrimLeft("or");
- temp.TrimRight();
- if (temp.IsEmpty())return;
- sql += temp;
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- if (g_ncount)
- {
- AfxMessageBox("此副卡发出尚未收回,请重新填写副卡号!", MB_ICONINFORMATION); return;
- }
- if (!m_card2no1.IsEmpty())
- sql = "***insert into membercard2blue([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no1 + "','" + g_date + "')";
- if (!m_card2no2.IsEmpty())
- sql += "***insert into membercard2blue([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no2 + "','" + g_date + "')";
- if (!m_card2no3.IsEmpty())
- sql += "***insert into membercard2blue([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no3 + "','" + g_date + "')";
- if (!m_card2no4.IsEmpty())
- sql += "***insert into membercard2blue([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no4 + "','" + g_date + "')";
- if (!m_card2no5.IsEmpty())
- sql += "***insert into membercard2blue([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no5 + "','" + g_date + "')";
- }
- else
- {
- sql = "select count(*) as cot from membercard2 where ";
- CString temp;
- if (!m_card2no1.IsEmpty())
- temp += "or [card2no]='" + m_card2no1 + "' ";
- if (!m_card2no2.IsEmpty())
- temp += "or [card2no]='" + m_card2no2 + "' ";
- if (!m_card2no3.IsEmpty())
- temp += "or [card2no]='" + m_card2no3 + "' ";
- if (!m_card2no4.IsEmpty())
- temp += "or [card2no]='" + m_card2no4 + "' ";
- if (!m_card2no5.IsEmpty())
- temp += "or [card2no]='" + m_card2no5 + "' ";
- temp.TrimLeft("or");
- temp.TrimRight();
- if (temp.IsEmpty())return;
- sql += temp;
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
- if (g_ncount)
- {
- AfxMessageBox("此副卡发出尚未收回,请重新填写副卡号!", MB_ICONINFORMATION); return;
- }
- if (!m_card2no1.IsEmpty())
- sql = "***insert into membercard2([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no1 + "','" + g_date + "')";
- if (!m_card2no2.IsEmpty())
- sql += "***insert into membercard2([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no2 + "','" + g_date + "')";
- if (!m_card2no3.IsEmpty())
- sql += "***insert into membercard2([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no3 + "','" + g_date + "')";
- if (!m_card2no4.IsEmpty())
- sql += "***insert into membercard2([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no4 + "','" + g_date + "')";
- if (!m_card2no5.IsEmpty())
- sql += "***insert into membercard2([memberno],[card2no],[date])values('" + m_no + "','" + m_card2no5 + "','" + g_date + "')";
- }
- sql.TrimLeft("***");
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- CDialog::OnOK();
- }
- BOOL InputCard2Dlg::PreTranslateMessage(MSG* pMsg)
- {
- if (pMsg->message == WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_RETURN:
- return 1;
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- void InputCard2Dlg::OnBnClickedRecharge() // 充值;
- {
- // 在此添加控件通知处理程序代码;
- CString branch = _T("");
- CArray<CStringArray, CStringArray> tagAryOfData;
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 161;
- g_sendhead.tabcount = 1;
- CString strFilters = _T("");
- strFilters.Format(_T("memberno='%s'"), m_no);
- g_pMainWnd->ProcessChatMessageRequest2(strFilters);
- if (g_bSendOK == 0)
- return;
- DataToArray(&tagAryOfData);
-
- //////////////////////////////////////////////////////////////////////////
- MemberCardFunc2 dlg;
- CString memberno = m_no;
- CString m_card2no = tagAryOfData.ElementAt(0).ElementAt(7);
- dlg.m_branch = branch;
- dlg.m_memberno = memberno;
- if (!m_card2no.IsEmpty())
- {
- SelMemberCardFund seldlg;
- if (seldlg.DoModal() != IDOK)return;
- if (seldlg.m_radio1 == 1)
- {
- dlg.m_card2no = m_card2no;
- dlg.m_card2balance = tagAryOfData.ElementAt(0).ElementAt(8);
- }
- }
- dlg.DoModal();
- }
|