// SetRate2.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "SetRate2.h" #include "SPLBDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // SetRate2 dialog SetRate2::SetRate2(CWnd* pParent /*=NULL*/) : CDialog(SetRate2::IDD, pParent) { //{{AFX_DATA_INIT(SetRate2) m_data1 = _T(""); //}}AFX_DATA_INIT } void SetRate2::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(SetRate2) DDX_Control(pDX, IDC_COMBO2, m_combo2); DDX_Control(pDX, IDC_EDIT1, m_editnum1); DDX_Text(pDX, IDC_EDIT1, m_data1); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(SetRate2, CDialog) //{{AFX_MSG_MAP(SetRate2) ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_WM_CTLCOLOR() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // SetRate2 message handlers BOOL SetRate2::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here if (IsHasRights2new(49) == 0) { GetDlgItem(IDC_BUTTON2)->EnableWindow(0); } g_sendhead.bsql = 0; g_sendhead.code[0] = 146; g_sendhead.code[1] = 159; g_sendhead.tabcount = 2; CString sql; sql = "type='数码师';"; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return 1; CArraym_List1array; DataToArray(&g_List1array, &m_List1array); for (int i = 0; i < m_List1array.GetSize(); i++) { m_combo2.AddString(m_List1array.ElementAt(i).ElementAt(0)); } /* m_combo2.AddString ("初修"); m_combo2.AddString ("精修"); m_combo2.AddString ("单片"); m_combo2.AddString ("设计相册"); m_combo2.AddString ("设计相册(婚纱)"); m_combo2.AddString ("DVD电子相册"); m_combo2.AddString ("上门录相"); m_combo2.AddString ("上门妆"); m_combo2.AddString ("到店化妆");*/ CenterWindow(); CString str; str = "\r\n\r\n 1. 先点设置按钮对工作内容进行设置(如修片,设计相册,装框等..)\r\n 2. 选择每一项工作内容,设置提成后点保存"; GetDlgItem(IDC_STATIC2)->SetWindowText(str); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void SetRate2::OnOK() { // TODO: Add extra validation here UpdateData(); CString worktype; int pos = m_combo2.GetCurSel(); if (pos != -1) m_combo2.GetLBText(pos, worktype); else worktype.Empty(); if (worktype.IsEmpty()) { AfxMessageBox("资料不全!", MB_ICONINFORMATION); return; } CString sql; sql.Format("delete from workrate where type='数码师' and data1='%s'***insert into workrate([type],[data1],[data2])values('%s','%s','%s')", worktype, "数码师", worktype, m_data1); g_sendhead.bsql = 1; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION); g_sendhead.bsql = 0; g_sendhead.code[0] = 146; g_sendhead.tabcount = 1; sql = "type='数码师'"; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; DataToArray(&g_List1array); // CDialog::OnOK(); } void SetRate2::OnSelchangeCombo2() { // TODO: Add your control notification handler code here CString worktype; int pos = m_combo2.GetCurSel(); if (pos != -1) m_combo2.GetLBText(pos, worktype); else worktype.Empty(); if (worktype.IsEmpty()) { return; } for (int i = 0; i < g_List1array.GetSize(); i++) { if (g_List1array.ElementAt(i).ElementAt(1) == worktype) { m_data1 = g_List1array.ElementAt(i).ElementAt(2); UpdateData(false); return; } } m_data1 = ""; UpdateData(false); } void SetRate2::OnButton2() { // TODO: Add your control notification handler code here SPLBDlg dlg; dlg.m_mode = 5; dlg.DoModal(); g_sendhead.bsql = 0; g_sendhead.code[0] = 146; g_sendhead.code[1] = 159; g_sendhead.tabcount = 2; CString sql; sql = "type='数码师';"; g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return; CArraym_List1array; DataToArray(&g_List1array, &m_List1array); m_combo2.ResetContent(); for (int i = 0; i < m_List1array.GetSize(); i++) { m_combo2.AddString(m_List1array.ElementAt(i).ElementAt(0)); } } HBRUSH SetRate2::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if (nCtlColor == CTLCOLOR_STATIC && pWnd->GetDlgCtrlID() == IDC_STATIC2) { pDC->SetBkMode(TRANSPARENT); //设置字体背景为透明 return (HBRUSH)::GetStockObject(WHITE_BRUSH); // 设置背景色 } // TODO: Return a different brush if the default is not desired return hbr; }