123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- // UsePoint.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "UsePoint.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // UsePoint dialog IDC_EDITmembername
- UsePoint::UsePoint(CWnd* pParent /*=NULL*/)
- : CDialog(UsePoint::IDD, pParent)
- {
- //{{AFX_DATA_INIT(UsePoint)
- m_name1 = _T("");
- m_name2 = _T("");
- m_id = _T("");
- m_ren = _T("");
- m_taoxiname = _T("");
- m_memberno = _T("");
- m_name = _T("");
- m_point = _T("");
- m_taoxijiage = _T("");
- m_card2no = _T("");
- m_goods = _T("");
- m_point2 = _T("");
- m_mode = 0;
- //}}AFX_DATA_INIT
- }
- void UsePoint::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(UsePoint)
- DDX_Control(pDX, IDC_EDIT3, m_editnum);
- DDX_Control(pDX, IDC_COMBO5, m_combobox);
- DDX_Text(pDX, IDC_EDITname, m_name1);
- DDX_Text(pDX, IDC_EDITname2, m_name2);
- DDX_Text(pDX, IDC_EDITid, m_id);
- DDX_Text(pDX, IDC_EDITOren, m_ren);
- DDX_Text(pDX, IDC_EDITtaoxiname, m_taoxiname);
- DDX_Text(pDX, IDC_EDIT1, m_memberno);
- DDX_Text(pDX, IDC_EDITmembername, m_name);
- DDX_Text(pDX, IDC_EDIT2, m_point);
- DDX_Text(pDX, IDC_EDITtaoxijiage, m_taoxijiage);
- DDX_Text(pDX, IDC_EDITcard2no, m_card2no);
- DDX_Text(pDX, IDC_EDIT7, m_goods);
- DDX_Text(pDX, IDC_EDIT3, m_point2);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(UsePoint, CDialog)
- //{{AFX_MSG_MAP(UsePoint)
- ON_CBN_SELCHANGE(IDC_COMBO5, OnSelchangeCombo5)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // UsePoint message handlers
- BOOL UsePoint::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- if (m_mode == 1)
- {
- SetWindowText("赠送积分");
- GetDlgItem(IDC_STATIC4)->SetWindowText("*赠送说明:");
- GetDlgItem(IDC_STATIC5)->SetWindowText("*此次赠送积分:");
- }
- else if (m_mode == 2)
- {
- SetWindowText("卡号变更");
- GetDlgItem(IDC_STATIC4)->SetWindowText("*请输入新卡号:");
- GetDlgItem(IDC_STATIC5)->ShowWindow(0);
- GetDlgItem(IDC_EDIT3)->ShowWindow(0);
- }
- return false; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void UsePoint::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- if (m_mode == 2)
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 68;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
- CArray<CStringArray, CStringArray>m_List1array;
- DataToArray(&m_List1array);
- CString newno = m_goods;
- if (newno.IsEmpty())
- {
- AfxMessageBox("卡号不能为空,请重新输入!", MB_ICONINFORMATION);
- return;
- }
- if (newno == m_memberno)
- {
- AfxMessageBox("卡号不能与旧卡号相同,请重新输入!", MB_ICONINFORMATION);
- m_goods = "";
- UpdateData(false);
- GetDlgItem(IDC_EDIT7)->SetFocus();
- return;
- }
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (newno == m_List1array.ElementAt(i).ElementAt(1))
- {
- AfxMessageBox("此会员卡卡号已存在,请重新输入!", MB_ICONINFORMATION);
- m_goods = "";
- UpdateData(false);
- GetDlgItem(IDC_EDIT7)->SetFocus();
- return;
- }
- }
- CString sql;
- sql = "update membermanage set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- sql += "***update memberreg set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- sql += "***update memberreg2 set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- sql += "***update memberreg3 set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- sql += "***update memberreg4 set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- sql += "***update membercard3usereg set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- sql += "***update membercard2 set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- sql += "***update membercard3 set [memberno]='" + newno + "' where [memberno]='" + m_memberno + "'";
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- CDialog::OnOK();
- return;
- }
- if (atol(m_point2) < 1)
- {
- AfxMessageBox("积分不能小于1分!", MB_ICONINFORMATION);
- return;
- }
- CString point2; CString sql;
- if (m_mode == 0)
- {
- if (atol(m_point) < 1)
- {
- AfxMessageBox("积分不能小于1分!", MB_ICONINFORMATION);
- return;
- }
- if (atol(m_point2) > atol(m_point))
- {
- AfxMessageBox("积分不够!", MB_ICONINFORMATION);
- return;
- }
- point2.Format("%d", (int)(atof(m_point2)*GetPointScale2()));
- sql = "insert into [memberreg2]([memberno],[dindanid],[money],[point],[date])values('" + m_memberno + "','" + m_goods + "','0','" + point2 + "','" + g_date + "')";
- sql += "&&&update membermanage set [sendmark1]='',[sendmark2]='' where [memberno]='" + m_memberno + "'";
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(122)))
- {
- CString content, timestamp;
- content.Format("%s您好,您本次兑换%s,使用积分%d分,余额:%d分", m_name, m_goods, atol(m_point2), atol(m_point) - atol(m_point2));
- timestamp = "msgtimestamp";
- if (CheckPhoneType(m_phone) != -1 && CheckBadWords(content, 0))
- {
- int count = GetLengthEx(content) / MSG_LENGTH;
- if (GetLengthEx(content) % MSG_LENGTH)
- count++;
- CString scount;
- scount.Format("%d", count);
- #if JEFF_TEST_ON
- CString sql2 = _T("");
- sql2.Format(INSERT_SENDREG, _T("16"), m_phone, content, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
- sql += _T("&&&") + sql2;
- #else
- CString sql2 = "&&&insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
- sql += sql2;
- #endif
- }
- }
- sql += "&&&";
- sql += m_memberno;
- }
- else//赠送积分
- {
- point2.Format("%d", (int)(atof(m_point2)*GetPointScale2()));
- sql = "insert into memberreg([memberno],[dindanid],[money],[date],[type])values('" + m_memberno + "','" + m_goods + "','" + point2 + "','" + g_date + "','消费积分')";
- if (0)//atoi(g_cominfoarray.ElementAt(0).ElementAt(122)))
- {
- CString content, timestamp;
- content.Format("%s您好,%s,本次赠送积分%d,余额:%d分", m_name, m_goods, atol(m_point2), atol(m_point) + atol(m_point2));
- timestamp = "msgtimestamp";
- if (CheckPhoneType(m_phone) != -1)//&& CheckBadWords(content,0) && CheckBadWords2(content,0) )
- {
- int count = GetLengthEx(content) / MSG_LENGTH;
- if (GetLengthEx(content) % MSG_LENGTH)
- count++;
- CString scount;
- scount.Format("%d", count);
- #if JEFF_TEST_ON
- CString sql2 = _T("");
- sql2.Format(INSERT_SENDREG, _T("16"), m_phone, content, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
- sql += _T("&&&") + sql2;
- #else
- CString sql2 = "&&&insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
- sql += sql2;
- #endif
- }
- }
- sql += "&&&";
- sql += m_memberno;
- }
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- CDialog::OnOK();
- }
- void UsePoint::ClientChange()
- {
- CString filter = "id='" + id + "'";
- g_sendhead.code[0] = 11;
- g_sendhead.tabcount = 1;
- g_sendhead.bsql = 0;
- g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
- DataToArray(&g_List1array);
- if (g_List1array.GetSize())
- {
- m_id = g_List1array.ElementAt(0).ElementAt(0);
- m_name1 = g_List1array.ElementAt(0).ElementAt(4);
- m_name2 = g_List1array.ElementAt(0).ElementAt(5);
- m_taoxiname = g_List1array.ElementAt(0).ElementAt(7);
- m_point = m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
- m_ren = g_List1array.ElementAt(0).ElementAt(14);
- UpdateData(false);
- }
- }
- void UsePoint::OnSelchangeCombo5()
- {
- // TODO: Add your control notification handler code here
- int pos = m_combobox.GetCurSel();
- if (pos == -1)return;
- if (m_acCombo.m_posarray.GetSize() <= pos)return;
- int pos2 = m_acCombo.m_posarray.ElementAt(pos);
- id = m_List1array.ElementAt(pos2).ElementAt(0);
- ClientChange();
- }
|