123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- // InputCard2Point.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "InputCard2Point.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- float GetPointScale()
- {
- #ifdef SETPOINT
- if (g_cominfoarray.ElementAt(0).ElementAt(55) == "")return 1.0;
- return atof(g_cominfoarray.ElementAt(0).ElementAt(55)) / 100.0;
- #else
- return 1.0;
- #endif
- }
- float GetPointScale2()
- {
- #ifdef SETPOINT
- if (g_cominfoarray.ElementAt(0).ElementAt(55) == "")return 1.0;
- return 100.0 / atof(g_cominfoarray.ElementAt(0).ElementAt(55));
- #else
- return 1.0;
- #endif
- }
- /////////////////////////////////////////////////////////////////////////////
- // InputCard2Point dialog IDC_EDIT2
- InputCard2Point::InputCard2Point(CWnd* pParent /*=NULL*/)
- : CDialog(InputCard2Point::IDD, pParent)
- {
- //{{AFX_DATA_INIT(InputCard2Point)
- 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("");
- //}}AFX_DATA_INIT
- }
- void InputCard2Point::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(InputCard2Point) //100
- 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);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(InputCard2Point, CDialog)
- //{{AFX_MSG_MAP(InputCard2Point)
- ON_CBN_SELCHANGE(IDC_COMBO5, OnSelchangeCombo5)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // InputCard2Point message handlers
- BOOL InputCard2Point::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- #ifdef CHILD_VERSION
- GetDlgItem(IDC_STATIC1)->SetWindowText("家长姓名:");
- GetDlgItem(IDC_STATIC2)->SetWindowText("宝宝姓名:");
- #endif
- m_acCombo.Init(&m_combobox);
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 30;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2("hashistory"); if (g_bSendOK == 0)return 0;
- DataToArray(&m_List1array);
- m_acCombo.m_pArray = &m_List1array;
- m_combobox.SetFocus();
- this->CenterWindow(g_pMainWnd);
- return false; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void InputCard2Point::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- if (atol(m_point) < 1)
- {
- AfxMessageBox("积分不能小于1分!", MB_ICONINFORMATION);
- return;
- }
- m_card2no.TrimLeft();
- m_card2no.TrimRight();
- if (m_card2no.IsEmpty())
- {
- AfxMessageBox("副卡卡号不能为空!", MB_ICONINFORMATION);
- return;
- }
- CString filter = "[card2no]='" + m_card2no + "'";
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 127;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
- DataToArray(&g_List1array);
- if (g_List1array.GetSize() == 0)
- {
- AfxMessageBox("没有此副卡号的记录!"); return;
- }
- CString date2 = g_List1array.ElementAt(0).ElementAt(2);
- CString sql;
- CString point;
- point.Format("%d", (int)(atof(m_point)*GetPointScale2()));
- sql = "delete from membercard2 where [card2no]='" + m_card2no + "'";
- sql += "@@@insert into memberreg([memberno],[dindanid],[money],[date],[card2no],[type],[taoxi],[date2])values('" + m_memberno + "','" + m_id + "','" + point + "','" + g_date + "','" + m_card2no + "','转介绍','" + m_taoxiname + "','" + date2 + "')";
- sql += "@@@";
- if (atoi(g_cominfoarray.ElementAt(0).ElementAt(51))) // 51==msgcheck5
- {
- CString m_content5 = g_cominfoarray.ElementAt(0).ElementAt(52);
- CString content, timestamp;
- CString name;
- if (!m_name1.IsEmpty())
- name = m_name1 + ",";
- name += m_name2;
- name.TrimRight(",");
- CString name2 = m_name;
- #ifndef CHILD_VERSION
- if(m_sex=="男")
- name2+="先生";
- else if(m_sex=="女")
- name2+="女士";
- #endif
- content.Format("%s您好,您的朋友%s为您积分%s分.", name2, name, m_point);
- content += m_content5;
- 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("5"), m_phone, content, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
- sql += 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 InputCard2Point::ClientChange()
- {
- CString filter = "id='" + id + "'";
- g_sendhead.code[0] = 11;
- g_sendhead.tabcount = 1;
- g_sendhead.bsql = 0;
- int g_nYearposTemp = g_nYearpos;
- g_nYearpos = curyear;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- g_nYearpos = g_nYearposTemp;
- 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_point.Format("%d", (int)(atof(m_taoxijiage)*GetPointScale()));
- m_ren = g_List1array.ElementAt(0).ElementAt(14);
- UpdateData(false);
- }
- else
- {
- m_id = "";
- m_name1 = "";
- m_name2 = "";
- m_taoxiname = "";
- m_point = m_taoxijiage = "";
- m_point = "";
- m_ren = "";
- UpdateData(false);
- }
- }
- void InputCard2Point::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);
- curyear = atoi(m_List1array.ElementAt(pos2).ElementAt(16));
- ClientChange();
- }
|