SetRate2.cpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // SetRate2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "SetRate2.h"
  6. #include "SPLBDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // SetRate2 dialog
  14. SetRate2::SetRate2(CWnd* pParent /*=NULL*/)
  15. : CDialog(SetRate2::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(SetRate2)
  18. m_data1 = _T("");
  19. //}}AFX_DATA_INIT
  20. }
  21. void SetRate2::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(SetRate2)
  25. DDX_Control(pDX, IDC_COMBO2, m_combo2);
  26. DDX_Control(pDX, IDC_EDIT1, m_editnum1);
  27. DDX_Text(pDX, IDC_EDIT1, m_data1);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(SetRate2, CDialog)
  31. //{{AFX_MSG_MAP(SetRate2)
  32. ON_CBN_SELCHANGE(IDC_COMBO2, OnSelchangeCombo2)
  33. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  34. ON_WM_CTLCOLOR()
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // SetRate2 message handlers
  39. BOOL SetRate2::OnInitDialog()
  40. {
  41. CDialog::OnInitDialog();
  42. // TODO: Add extra initialization here
  43. if (IsHasRights2new(49) == 0)
  44. {
  45. GetDlgItem(IDC_BUTTON2)->EnableWindow(0);
  46. }
  47. g_sendhead.bsql = 0;
  48. g_sendhead.code[0] = 146;
  49. g_sendhead.code[1] = 159;
  50. g_sendhead.tabcount = 2;
  51. CString sql;
  52. sql = "type='数码师';";
  53. g_pMainWnd->ProcessChatMessageRequest2(sql);
  54. if (g_bSendOK == 0)return 1;
  55. CArray<CStringArray, CStringArray>m_List1array;
  56. DataToArray(&g_List1array, &m_List1array);
  57. for (int i = 0; i < m_List1array.GetSize(); i++)
  58. {
  59. m_combo2.AddString(m_List1array.ElementAt(i).ElementAt(0));
  60. }
  61. /* m_combo2.AddString ("初修");
  62. m_combo2.AddString ("精修");
  63. m_combo2.AddString ("单片");
  64. m_combo2.AddString ("设计相册");
  65. m_combo2.AddString ("设计相册(婚纱)");
  66. m_combo2.AddString ("DVD电子相册");
  67. m_combo2.AddString ("上门录相");
  68. m_combo2.AddString ("上门妆");
  69. m_combo2.AddString ("到店化妆");*/
  70. CenterWindow();
  71. CString str;
  72. str = "\r\n\r\n 1. 先点设置按钮对工作内容进行设置(如修片,设计相册,装框等..)\r\n 2. 选择每一项工作内容,设置提成后点保存";
  73. GetDlgItem(IDC_STATIC2)->SetWindowText(str);
  74. return TRUE; // return TRUE unless you set the focus to a control
  75. // EXCEPTION: OCX Property Pages should return FALSE
  76. }
  77. void SetRate2::OnOK()
  78. {
  79. // TODO: Add extra validation here
  80. UpdateData();
  81. CString worktype;
  82. int pos = m_combo2.GetCurSel();
  83. if (pos != -1)
  84. m_combo2.GetLBText(pos, worktype);
  85. else
  86. worktype.Empty();
  87. if (worktype.IsEmpty())
  88. {
  89. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  90. return;
  91. }
  92. CString sql;
  93. sql.Format("delete from workrate where type='数码师' and data1='%s'***insert into workrate([type],[data1],[data2])values('%s','%s','%s')", worktype, "数码师", worktype, m_data1);
  94. g_sendhead.bsql = 1;
  95. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  96. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  97. g_sendhead.bsql = 0;
  98. g_sendhead.code[0] = 146;
  99. g_sendhead.tabcount = 1;
  100. sql = "type='数码师'";
  101. g_pMainWnd->ProcessChatMessageRequest2(sql);
  102. if (g_bSendOK == 0)return;
  103. DataToArray(&g_List1array);
  104. // CDialog::OnOK();
  105. }
  106. void SetRate2::OnSelchangeCombo2()
  107. {
  108. // TODO: Add your control notification handler code here
  109. CString worktype;
  110. int pos = m_combo2.GetCurSel();
  111. if (pos != -1)
  112. m_combo2.GetLBText(pos, worktype);
  113. else
  114. worktype.Empty();
  115. if (worktype.IsEmpty())
  116. {
  117. return;
  118. }
  119. for (int i = 0; i < g_List1array.GetSize(); i++)
  120. {
  121. if (g_List1array.ElementAt(i).ElementAt(1) == worktype)
  122. {
  123. m_data1 = g_List1array.ElementAt(i).ElementAt(2);
  124. UpdateData(false);
  125. return;
  126. }
  127. }
  128. m_data1 = "";
  129. UpdateData(false);
  130. }
  131. void SetRate2::OnButton2()
  132. {
  133. // TODO: Add your control notification handler code here
  134. SPLBDlg dlg;
  135. dlg.m_mode = 5;
  136. dlg.DoModal();
  137. g_sendhead.bsql = 0;
  138. g_sendhead.code[0] = 146;
  139. g_sendhead.code[1] = 159;
  140. g_sendhead.tabcount = 2;
  141. CString sql;
  142. sql = "type='数码师';";
  143. g_pMainWnd->ProcessChatMessageRequest2(sql);
  144. if (g_bSendOK == 0)return;
  145. CArray<CStringArray, CStringArray>m_List1array;
  146. DataToArray(&g_List1array, &m_List1array);
  147. m_combo2.ResetContent();
  148. for (int i = 0; i < m_List1array.GetSize(); i++)
  149. {
  150. m_combo2.AddString(m_List1array.ElementAt(i).ElementAt(0));
  151. }
  152. }
  153. HBRUSH SetRate2::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  154. {
  155. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  156. // TODO: Change any attributes of the DC here
  157. if (nCtlColor == CTLCOLOR_STATIC && pWnd->GetDlgCtrlID() == IDC_STATIC2)
  158. {
  159. pDC->SetBkMode(TRANSPARENT); //设置字体背景为透明
  160. return (HBRUSH)::GetStockObject(WHITE_BRUSH); // 设置背景色
  161. }
  162. // TODO: Return a different brush if the default is not desired
  163. return hbr;
  164. }