123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- // SendInsideMsg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "SendInsideMsg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // SendInsideMsg dialog
- SendInsideMsg::SendInsideMsg(CWnd* pParent /*=NULL*/)
- : CDialog(SendInsideMsg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(SendInsideMsg)
- m_strRecvMobi = _T("");
- m_count = 0;
- m_content = _T("");
- //}}AFX_DATA_INIT
- }
- void SendInsideMsg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(SendInsideMsg)
- DDX_Control(pDX, IDC_COMBO1, m_combobm);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Text(pDX, IDC_EDT_RECV_MOBI, m_strRecvMobi);
- DDV_MaxChars(pDX, m_strRecvMobi, 4000);
- DDX_Text(pDX, IDC_EDT_NUM, m_count);
- DDX_Text(pDX, IDC_EDT_SMS, m_content);
- DDV_MaxChars(pDX, m_content, 4000);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(SendInsideMsg, CDialog)
- //{{AFX_MSG_MAP(SendInsideMsg)
- ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
- ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
- ON_BN_CLICKED(IDC_BTN_SEND, OnBtnSend)
- ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeCombo1)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // SendInsideMsg message handlers
- BOOL SendInsideMsg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- CString filter="[dimission]='在职';";
- g_sendhead.bsql=0;
- g_sendhead.code[0]=5;
- g_sendhead.code[1]=3;
- g_sendhead.tabcount=2;
- g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return false;
- DataToArray(&m_List1array, &g_List1array);
- m_combobm.AddString ("全部");
- for(int i=0; i<g_List1array.GetSize (); i++)
- m_combobm.AddString (g_List1array.ElementAt (i).ElementAt (0));
- CenterWindow();
- m_combobm.SetCurSel (0);
- OnSelchangeCombo1();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void SendInsideMsg::OnSelchangeCombo1()
- {
- // TODO: Add your control notification handler code here
- int pos=m_combobm.GetCurSel ();
- if(pos==-1)return;
- CString bm;
- m_combobm.GetLBText (pos, bm);
- m_List1.ResetContent ();
- int aa=0;
- for(int i=0; i<m_List1array.GetSize(); i++)
- {
- if(bm=="全部" || bm==m_List1array.ElementAt (i).ElementAt (2))
- {
- if(m_List1.GetCount()%2)
- m_List1.AddEntry( m_List1array.ElementAt (i).ElementAt (1) , g_gridcol1, m_List1.GetCount());
- else
- m_List1.AddEntry( m_List1array.ElementAt (i).ElementAt (1) , g_gridcol2, m_List1.GetCount());
-
- m_List1.SetSel (aa);aa++;
- }
- }
- m_List1.Invalidate ();
- OnSelchangeList1();
- }
- void SendInsideMsg::OnSelchangeList1()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- int count= m_List1.GetSelCount() ;
- if(count==0)return;
- int *pIndex=new int[count];
- m_List1.GetSelItems(count, pIndex);
- m_strRecvMobi = _T("");
- CString str,temp;
- int pos;
- m_count=0;
- for(int i=0; i<count; i++)
- {
- m_List1.GetText (pIndex[i], str);
- m_strRecvMobi+=str;
- m_strRecvMobi+=",";
- m_count++;
- }
- m_strRecvMobi.TrimRight (",");
- UpdateData(false);
- delete []pIndex;
- }
- void SendInsideMsg::OnBtnSend()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- if(m_strRecvMobi.IsEmpty ())
- {
- AfxMessageBox("接收人员不能为空!");return;
- }
- if(m_content.IsEmpty ())
- {
- AfxMessageBox("内容不能为空!");return;
- }
- if(m_strRecvMobi.GetLength ()>1000)
- {
- AfxMessageBox("接收人太多!");return;
- }
- if(m_content.GetLength ()>1000)
- {
- AfxMessageBox("内容太长!");return;
- }
- CString timestamp=g_date+" curtimereplace";
- CString sql="insert into insidemsg([content],[timestamp],[sender],[receiver]) values('"+m_content+"','"+timestamp+"','"+g_user.name+"','"+m_strRecvMobi+"')";
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- AfxMessageBox("发送成功!", MB_ICONINFORMATION);
- }
- void SendInsideMsg::OnEditchangeCombo1()
- {
- // TODO: Add your control notification handler code here
- OnSelchangeCombo1();
- }
|