SPLBDlg.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. // SPLBDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "SPLBDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. SPLBDlg::SPLBDlg(CWnd* pParent /*=NULL*/): CDialog(SPLBDlg::IDD, pParent)
  13. {
  14. m_edit1 = _T("");
  15. m_mode = 0;
  16. }
  17. void SPLBDlg::DoDataExchange(CDataExchange* pDX)
  18. {
  19. CDialog::DoDataExchange(pDX);
  20. DDX_Control(pDX, IDC_LIST1, m_List1);
  21. DDX_Text(pDX, IDC_EDIT1, m_edit1);
  22. }
  23. BEGIN_MESSAGE_MAP(SPLBDlg, CDialog)
  24. ON_BN_CLICKED(IDC_BUTadd, OnBUTadd)
  25. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  26. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  27. ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
  28. ON_BN_CLICKED(IDC_BUTadd3, OnBUTadd3)
  29. ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
  30. ON_BN_CLICKED(IDC_BUTadd4, OnBUTadd4)
  31. END_MESSAGE_MAP()
  32. /////////////////////////////////////////////////////////////////////////////
  33. // SPLBDlg message handlers
  34. BOOL SPLBDlg::OnInitDialog()
  35. {
  36. CDialog::OnInitDialog();
  37. CRect rc;
  38. m_List1.GetClientRect(rc);
  39. CString strHeadings;
  40. if (m_mode == 2 || m_mode == 19)
  41. {
  42. GetDlgItem(IDOK)->ShowWindow(SW_SHOW);
  43. GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_SHOW);
  44. GetDlgItem(IDC_STATIC1)->ShowWindow(SW_HIDE);
  45. GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE);
  46. CRect rc3, rc2;
  47. GetWindowRect(rc3);
  48. GetDlgItem(IDC_BUTadd)->GetWindowRect(rc2);
  49. rc3.right = rc2.left;
  50. MoveWindow(rc3);
  51. }
  52. else
  53. {
  54. GetDlgItem(IDOK)->ShowWindow(SW_HIDE);
  55. GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_HIDE);
  56. }
  57. if (m_mode == 19)GetDlgItem(IDC_BUTadd4)->ShowWindow(SW_SHOW);
  58. if (m_mode == 1 || m_mode == 2)
  59. {
  60. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  61. strHeadings.Format("景点名称,%d", rc.Width() - 18);
  62. GetDlgItem(IDC_STATIC1)->SetWindowText("景点");
  63. GetDlgItem(IDC_STATIC2)->SetWindowText("景点名称:");
  64. GetDlgItem(IDC_BUTadd)->SetWindowText("添加景点");
  65. GetDlgItem(IDC_BUTdel)->SetWindowText("删除景点"); SetWindowText("景点设置");
  66. }
  67. else if (m_mode == 3)
  68. {
  69. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  70. strHeadings.Format("套系类别名称,%d", rc.Width() - 18);
  71. GetDlgItem(IDC_STATIC1)->SetWindowText("套系类别");
  72. GetDlgItem(IDC_STATIC2)->SetWindowText("套系类别名称:");
  73. GetDlgItem(IDC_BUTadd)->SetWindowText("添加套系类别");
  74. GetDlgItem(IDC_BUTdel)->SetWindowText("删除套系类别"); SetWindowText("套系类别设置");
  75. }
  76. else if (m_mode == 4)
  77. {
  78. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  79. strHeadings.Format("拍摄名称,%d", rc.Width() - 18);
  80. GetDlgItem(IDC_STATIC1)->SetWindowText("拍摄名称");
  81. GetDlgItem(IDC_STATIC2)->SetWindowText("拍摄名称:");
  82. GetDlgItem(IDC_BUTadd)->SetWindowText("添加拍摄名称");
  83. GetDlgItem(IDC_BUTdel)->SetWindowText("删除拍摄名称"); SetWindowText("拍摄名称设置");
  84. }
  85. else if (m_mode == 5)
  86. {
  87. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  88. strHeadings.Format("工作内容,%d", rc.Width() - 18);
  89. GetDlgItem(IDC_STATIC1)->SetWindowText("工作内容");
  90. GetDlgItem(IDC_STATIC2)->SetWindowText("工作内容:");
  91. GetDlgItem(IDC_BUTadd)->SetWindowText("添加工作内容");
  92. GetDlgItem(IDC_BUTdel)->SetWindowText("删除工作内容"); SetWindowText("工作内容设置");
  93. }
  94. else if (m_mode == 6)
  95. {
  96. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  97. strHeadings.Format("二销类别,%d", rc.Width() - 18);
  98. GetDlgItem(IDC_STATIC1)->SetWindowText("二销类别");
  99. GetDlgItem(IDC_STATIC2)->SetWindowText("二销类别:");
  100. GetDlgItem(IDC_BUTadd)->SetWindowText("添加二销类别");
  101. GetDlgItem(IDC_BUTdel)->SetWindowText("删除二销类别"); SetWindowText("二销类别设置");
  102. }
  103. else if (m_mode == 7)
  104. {
  105. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  106. strHeadings.Format("前期类别,%d", rc.Width() - 18);
  107. GetDlgItem(IDC_STATIC1)->SetWindowText("前期类别");
  108. GetDlgItem(IDC_STATIC2)->SetWindowText("前期类别:");
  109. GetDlgItem(IDC_BUTadd)->SetWindowText("添加前期类别");
  110. GetDlgItem(IDC_BUTdel)->SetWindowText("删除前期类别"); SetWindowText("前期类别设置");
  111. }
  112. else if (m_mode == 8)
  113. {
  114. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  115. strHeadings.Format("客户来源名称,%d", rc.Width() - 18);
  116. GetDlgItem(IDC_STATIC1)->SetWindowText("客户来源");
  117. GetDlgItem(IDC_STATIC2)->SetWindowText("客户来源名称:");
  118. GetDlgItem(IDC_BUTadd)->SetWindowText("添加客户来源");
  119. GetDlgItem(IDC_BUTdel)->SetWindowText("删除客户来源"); SetWindowText("客户来源设置");
  120. }
  121. else if (m_mode == 9)
  122. {
  123. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  124. strHeadings.Format("流失原因名称,%d", rc.Width() - 18);
  125. GetDlgItem(IDC_STATIC1)->SetWindowText("流失原因");
  126. GetDlgItem(IDC_STATIC2)->SetWindowText("流失原因名称:");
  127. GetDlgItem(IDC_BUTadd)->SetWindowText("添加流失原因");
  128. GetDlgItem(IDC_BUTdel)->SetWindowText("删除流失原因"); SetWindowText("流失原因设置");
  129. }
  130. else if (m_mode == 10)
  131. {
  132. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  133. strHeadings.Format("接单点名称,%d", rc.Width() - 18);
  134. GetDlgItem(IDC_STATIC1)->SetWindowText("接单点");
  135. GetDlgItem(IDC_STATIC2)->SetWindowText("接单点名称:");
  136. GetDlgItem(IDC_BUTadd)->SetWindowText("添加接单点");
  137. GetDlgItem(IDC_BUTdel)->SetWindowText("删除接单点"); SetWindowText("接单点设置");
  138. }
  139. else if (m_mode == 11)
  140. {
  141. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  142. strHeadings.Format("摆放区域名称,%d", rc.Width() - 18);
  143. GetDlgItem(IDC_STATIC1)->SetWindowText("摆放区域");
  144. GetDlgItem(IDC_STATIC2)->SetWindowText("摆放区域名称:");
  145. GetDlgItem(IDC_BUTadd)->SetWindowText("添加摆放区域");
  146. GetDlgItem(IDC_BUTdel)->SetWindowText("删除摆放区域"); SetWindowText("摆放区域设置");
  147. }
  148. else if (m_mode == 12)
  149. {
  150. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  151. strHeadings.Format("套系大类名称,%d", rc.Width() - 18);
  152. GetDlgItem(IDC_STATIC1)->SetWindowText("套系大类");
  153. GetDlgItem(IDC_STATIC2)->SetWindowText("套系大类名称:");
  154. GetDlgItem(IDC_BUTadd)->SetWindowText("添加套系大类");
  155. GetDlgItem(IDC_BUTdel)->SetWindowText("删除套系大类"); SetWindowText("套系大类设置");
  156. }
  157. else if (m_mode == 13)
  158. {
  159. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  160. strHeadings.Format("二销项目名称,%d", rc.Width() - 18);
  161. GetDlgItem(IDC_STATIC1)->SetWindowText("二销项目");
  162. GetDlgItem(IDC_STATIC2)->SetWindowText("二销项目名称:");
  163. GetDlgItem(IDC_BUTadd)->SetWindowText("添加二销项目");
  164. GetDlgItem(IDC_BUTdel)->SetWindowText("删除二销项目"); SetWindowText("二销项目设置");
  165. }
  166. else if (m_mode == 14)
  167. {
  168. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  169. strHeadings.Format("业务种类名称,%d", rc.Width() - 18);
  170. GetDlgItem(IDC_STATIC1)->SetWindowText("业务种类");
  171. GetDlgItem(IDC_STATIC2)->SetWindowText("业务种类名称:");
  172. GetDlgItem(IDC_BUTadd)->SetWindowText("添加业务种类");
  173. GetDlgItem(IDC_BUTdel)->SetWindowText("删除业务种类"); SetWindowText("业务种类设置");
  174. }
  175. else if (m_mode == 15)
  176. {
  177. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  178. strHeadings.Format("业务意向名称,%d", rc.Width() - 18);
  179. GetDlgItem(IDC_STATIC1)->SetWindowText("业务意向");
  180. GetDlgItem(IDC_STATIC2)->SetWindowText("业务意向名称:");
  181. GetDlgItem(IDC_BUTadd)->SetWindowText("添加业务意向");
  182. GetDlgItem(IDC_BUTdel)->SetWindowText("删除业务意向"); SetWindowText("业务意向设置");
  183. }
  184. else if (m_mode == 16)
  185. {
  186. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  187. strHeadings.Format("客户类别名称,%d", rc.Width() - 18);
  188. GetDlgItem(IDC_STATIC1)->SetWindowText("客户类别");
  189. GetDlgItem(IDC_STATIC2)->SetWindowText("客户类别名称:");
  190. GetDlgItem(IDC_BUTadd)->SetWindowText("添加客户类别");
  191. GetDlgItem(IDC_BUTdel)->SetWindowText("删除客户类别"); SetWindowText("客户类别设置");
  192. }
  193. else if (m_mode == 17)
  194. {
  195. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  196. strHeadings.Format("来单医院名称,%d", rc.Width() - 18);
  197. GetDlgItem(IDC_STATIC1)->SetWindowText("来单医院");
  198. GetDlgItem(IDC_STATIC2)->SetWindowText("来单医院名称:");
  199. GetDlgItem(IDC_BUTadd)->SetWindowText("添加来单医院");
  200. GetDlgItem(IDC_BUTdel)->SetWindowText("删除来单医院"); SetWindowText("来单医院设置");
  201. }
  202. else if (m_mode == 18 || m_mode == 19)
  203. {
  204. GetDlgItem(IDC_BUTadd3)->ShowWindow(SW_HIDE);
  205. strHeadings.Format("客人要求,%d", rc.Width() - 18);
  206. GetDlgItem(IDC_STATIC1)->SetWindowText("客人要求");
  207. GetDlgItem(IDC_STATIC2)->SetWindowText("客人要求:");
  208. GetDlgItem(IDC_BUTadd)->SetWindowText("添加客人要求");
  209. GetDlgItem(IDC_BUTdel)->SetWindowText("删除客人要求"); SetWindowText("客人要求设置");
  210. }
  211. else
  212. strHeadings.Format("商品类别名称,%d", rc.Width() - 18);
  213. m_List1.SetHeadings(strHeadings);
  214. FillGrid();
  215. CenterWindow();
  216. return TRUE;
  217. }
  218. void SPLBDlg::FillGrid()
  219. {
  220. g_sendhead.bsql = 0;
  221. if (m_mode == 1 || m_mode == 2)
  222. g_sendhead.code[0] = 149;
  223. else if (m_mode == 3)
  224. g_sendhead.code[0] = 157;
  225. else if (m_mode == 4)
  226. g_sendhead.code[0] = 158;
  227. else if (m_mode == 5)
  228. g_sendhead.code[0] = 159;
  229. else if (m_mode == 6)
  230. g_sendhead.code[0] = 160;
  231. else if (m_mode == 7)
  232. g_sendhead.code[0] = 169;
  233. else if (m_mode == 8)
  234. g_sendhead.code[0] = 186;
  235. else if (m_mode == 9)
  236. g_sendhead.code[0] = 187;
  237. else if (m_mode == 10)
  238. g_sendhead.code[0] = 188;
  239. else if (m_mode == 11)
  240. g_sendhead.code[0] = 190;
  241. else if (m_mode == 12)
  242. g_sendhead.code[0] = 194;
  243. else if (m_mode == 13)
  244. g_sendhead.code[0] = 195;
  245. else if (m_mode == 14)
  246. g_sendhead.code[0] = 200;
  247. else if (m_mode == 15)
  248. g_sendhead.code[0] = 201;
  249. else if (m_mode == 16)
  250. g_sendhead.code[0] = 202;
  251. else if (m_mode == 17)
  252. g_sendhead.code[0] = 203;
  253. else if (m_mode == 18 || m_mode == 19)
  254. g_sendhead.code[0] = 215;
  255. else
  256. g_sendhead.code[0] = 2;
  257. g_sendhead.tabcount = 1;
  258. g_pMainWnd->ProcessChatMessageRequest2(2); if (g_bSendOK == 0)return;
  259. DataToArray(&g_List1array);
  260. m_List1.DeleteAllItems2();
  261. int ii = 0;
  262. {
  263. m_List1.m_arLabels.SetSize(g_List1array.GetSize(), 1);
  264. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  265. m_List1.m_arLabels.ElementAt(ii).Copy(g_List1array.ElementAt(ii));
  266. }
  267. m_List1.m_LabelCount = ii;
  268. m_List1.SetItemCountEx(ii);
  269. if (m_mode == 0)
  270. {
  271. #ifndef CHILD_VERSION
  272. BOOL bFind=0;
  273. for(ii=0; ii<g_List1array.GetSize (); ii++)
  274. {
  275. if(g_List1array.ElementAt (ii).ElementAt (0)=="婚庆服务")
  276. {
  277. bFind=1;
  278. break;
  279. }
  280. }
  281. if(bFind==0)
  282. {
  283. CString sql;
  284. sql.Format ("insert into shangpinlb (name)values('%s')", "婚庆服务");
  285. g_sendhead.bsql=1;
  286. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  287. FillGrid();
  288. }
  289. #endif
  290. }
  291. }
  292. void SPLBDlg::OnBUTadd()
  293. {
  294. UpdateData();
  295. m_edit1.TrimLeft();
  296. m_edit1.TrimRight();
  297. if (m_edit1.IsEmpty())
  298. {
  299. if (m_mode == 1 || m_mode == 2)
  300. AfxMessageBox("景点名称不能为空!", MB_ICONINFORMATION);
  301. else if (m_mode == 3)
  302. AfxMessageBox("套系类别名称不能为空!", MB_ICONINFORMATION);
  303. else if (m_mode == 4)
  304. AfxMessageBox("拍摄名称不能为空!", MB_ICONINFORMATION);
  305. else if (m_mode == 5)
  306. AfxMessageBox("工作内容不能为空!", MB_ICONINFORMATION);
  307. else if (m_mode == 6)
  308. AfxMessageBox("二销类别不能为空!", MB_ICONINFORMATION);
  309. else if (m_mode == 7)
  310. AfxMessageBox("前期类别不能为空!", MB_ICONINFORMATION);
  311. else if (m_mode == 8)
  312. AfxMessageBox("客户来源不能为空!", MB_ICONINFORMATION);
  313. else if (m_mode == 9)
  314. AfxMessageBox("流失原因不能为空!", MB_ICONINFORMATION);
  315. else if (m_mode == 10)
  316. AfxMessageBox("接单点不能为空!", MB_ICONINFORMATION);
  317. else if (m_mode == 11)
  318. AfxMessageBox("摆放区域不能为空!", MB_ICONINFORMATION);
  319. else if (m_mode == 12)
  320. AfxMessageBox("套系大类不能为空!", MB_ICONINFORMATION);
  321. else if (m_mode == 13)
  322. AfxMessageBox("二销项目不能为空!", MB_ICONINFORMATION);
  323. else if (m_mode == 14)
  324. AfxMessageBox("业务种类不能为空!", MB_ICONINFORMATION);
  325. else if (m_mode == 15)
  326. AfxMessageBox("业务意向不能为空!", MB_ICONINFORMATION);
  327. else if (m_mode == 16)
  328. AfxMessageBox("客户类别不能为空!", MB_ICONINFORMATION);
  329. else if (m_mode == 17)
  330. AfxMessageBox("来单医院不能为空!", MB_ICONINFORMATION);
  331. else if (m_mode == 18)
  332. AfxMessageBox("客人要求不能为空!", MB_ICONINFORMATION);
  333. else
  334. AfxMessageBox("商品类别不能为空!", MB_ICONINFORMATION);
  335. this->GetDlgItem(IDC_EDIT1)->SetFocus();
  336. return;
  337. }
  338. if (m_mode == 4)
  339. {
  340. m_edit1.Replace(",", ""); UpdateData(0);
  341. }
  342. for (int i = 0; i < m_List1.GetItemCount(); i++)
  343. {
  344. if (m_List1.GetItemText(i, 0) == m_edit1)
  345. {
  346. if (m_mode == 1 || m_mode == 2)
  347. AfxMessageBox("已有此景点!", MB_ICONINFORMATION);
  348. else if (m_mode == 3)
  349. AfxMessageBox("已有此套系类别!", MB_ICONINFORMATION);
  350. else if (m_mode == 4)
  351. AfxMessageBox("已有此拍摄名称!", MB_ICONINFORMATION);
  352. else if (m_mode == 5)
  353. AfxMessageBox("已有此工作内容!", MB_ICONINFORMATION);
  354. else if (m_mode == 6)
  355. AfxMessageBox("已有此二销类别!", MB_ICONINFORMATION);
  356. else if (m_mode == 7)
  357. AfxMessageBox("已有此前期类别!", MB_ICONINFORMATION);
  358. else if (m_mode == 8)
  359. AfxMessageBox("已有此客户来源!", MB_ICONINFORMATION);
  360. else if (m_mode == 9)
  361. AfxMessageBox("已有此流失原因!", MB_ICONINFORMATION);
  362. else if (m_mode == 10)
  363. AfxMessageBox("已有此接单点!", MB_ICONINFORMATION);
  364. else if (m_mode == 11)
  365. AfxMessageBox("已有此摆放区域!", MB_ICONINFORMATION);
  366. else if (m_mode == 12)
  367. AfxMessageBox("已有此套系大类!", MB_ICONINFORMATION);
  368. else if (m_mode == 13)
  369. AfxMessageBox("已有此二销项目!", MB_ICONINFORMATION);
  370. else if (m_mode == 14)
  371. AfxMessageBox("已有此业务种类!", MB_ICONINFORMATION);
  372. else if (m_mode == 15)
  373. AfxMessageBox("已有此业务意向!", MB_ICONINFORMATION);
  374. else if (m_mode == 16)
  375. AfxMessageBox("已有此客户类别!", MB_ICONINFORMATION);
  376. else if (m_mode == 17)
  377. AfxMessageBox("已有此来单医院!", MB_ICONINFORMATION);
  378. else if (m_mode == 18)
  379. AfxMessageBox("已有此客人要求!", MB_ICONINFORMATION);
  380. else
  381. AfxMessageBox("已有此类别!", MB_ICONINFORMATION);
  382. this->GetDlgItem(IDC_EDIT1)->SetFocus();
  383. return;
  384. }
  385. }
  386. CString sql;
  387. if (m_mode == 1 || m_mode == 2)
  388. sql.Format("insert into jd (name)values('%s')", m_edit1);
  389. else if (m_mode == 3)
  390. sql.Format("insert into txlb (name)values('%s')", m_edit1);
  391. else if (m_mode == 4)
  392. sql.Format("insert into growthtx (name)values('%s')", m_edit1);
  393. else if (m_mode == 5)
  394. sql.Format("insert into worktype (name)values('%s')", m_edit1);
  395. else if (m_mode == 6)
  396. sql.Format("insert into expendtype (name)values('%s')", m_edit1);
  397. else if (m_mode == 7)
  398. sql.Format("insert into baseexpendtype (name)values('%s')", m_edit1);
  399. else if (m_mode == 8)
  400. sql.Format("insert into clientfrom (name)values('%s')", m_edit1);
  401. else if (m_mode == 9)
  402. sql.Format("insert into clientreason (name)values('%s')", m_edit1);
  403. else if (m_mode == 10)
  404. sql.Format("insert into jdd (name)values('%s')", m_edit1);
  405. else if (m_mode == 11)
  406. sql.Format("insert into dressarea (name)values('%s')", m_edit1);
  407. else if (m_mode == 12)
  408. sql.Format("insert into [txlb2] (name)values('%s')", m_edit1);
  409. else if (m_mode == 13)
  410. sql.Format("insert into [sale2type] (name)values('%s')", m_edit1);
  411. else if (m_mode == 14)
  412. sql.Format("insert into [businesstype] (name)values('%s')", m_edit1);
  413. else if (m_mode == 15)
  414. sql.Format("insert into [businessintention] (name)values('%s')", m_edit1);
  415. else if (m_mode == 16)
  416. sql.Format("insert into [clienttype] (name)values('%s')", m_edit1);
  417. else if (m_mode == 17)
  418. sql.Format("insert into [hospital] (name)values('%s')", m_edit1);
  419. else if (m_mode == 18)
  420. sql.Format("insert into [clientqequirement] (name)values('%s')", m_edit1);
  421. else
  422. sql.Format("insert into shangpinlb (name)values('%s')", m_edit1);
  423. g_sendhead.bsql = 1;
  424. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  425. FillGrid();
  426. }
  427. void SPLBDlg::OnBUTdel()
  428. {
  429. POSITION pos;
  430. pos = m_List1.GetFirstSelectedItemPosition();
  431. if (pos == NULL)
  432. {
  433. if (m_mode == 1 || m_mode == 2)
  434. AfxMessageBox("请选中您要删除的景点!", MB_ICONINFORMATION);
  435. else if (m_mode == 3)
  436. AfxMessageBox("请选中您要删除的套系类别!", MB_ICONINFORMATION);
  437. else if (m_mode == 4)
  438. AfxMessageBox("请选中您要删除的拍摄名称!", MB_ICONINFORMATION);
  439. else if (m_mode == 5)
  440. AfxMessageBox("请选中您要删除的工作内容!", MB_ICONINFORMATION);
  441. else if (m_mode == 6)
  442. AfxMessageBox("请选中您要删除的二销类别!", MB_ICONINFORMATION);
  443. else if (m_mode == 7)
  444. AfxMessageBox("请选中您要删除的前期类别!", MB_ICONINFORMATION);
  445. else if (m_mode == 8)
  446. AfxMessageBox("请选中您要删除的客户来源!", MB_ICONINFORMATION);
  447. else if (m_mode == 9)
  448. AfxMessageBox("请选中您要删除的流失原因!", MB_ICONINFORMATION);
  449. else if (m_mode == 10)
  450. AfxMessageBox("请选中您要删除的接单点!", MB_ICONINFORMATION);
  451. else if (m_mode == 11)
  452. AfxMessageBox("请选中您要删除的摆放区域!", MB_ICONINFORMATION);
  453. else if (m_mode == 12)
  454. AfxMessageBox("请选中您要删除的套系大类!", MB_ICONINFORMATION);
  455. else if (m_mode == 13)
  456. AfxMessageBox("请选中您要删除的二销项目!", MB_ICONINFORMATION);
  457. else if (m_mode == 14)
  458. AfxMessageBox("请选中您要删除的业务种类!", MB_ICONINFORMATION);
  459. else if (m_mode == 15)
  460. AfxMessageBox("请选中您要删除的业务意向!", MB_ICONINFORMATION);
  461. else if (m_mode == 16)
  462. AfxMessageBox("请选中您要删除的客户类别!", MB_ICONINFORMATION);
  463. else if (m_mode == 17)
  464. AfxMessageBox("请选中您要删除的来单医院!", MB_ICONINFORMATION);
  465. else if (m_mode == 18)
  466. AfxMessageBox("请选中您要删除的客人要求!", MB_ICONINFORMATION);
  467. else
  468. AfxMessageBox("请选中您要删除的类别!", MB_ICONINFORMATION);
  469. return;
  470. }
  471. if (AfxMessageBox("确认删除吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  472. int iItem = m_List1.GetNextSelectedItem(pos);
  473. CString name = m_List1.GetItemText(iItem, 0);
  474. CString sql;
  475. if (m_mode == 1 || m_mode == 2)
  476. sql.Format("delete from jd where name='%s'", name);
  477. else if (m_mode == 3)
  478. sql.Format("delete from txlb where name='%s'", name);
  479. else if (m_mode == 4)
  480. sql.Format("delete from growthtx where name='%s'", name);
  481. else if (m_mode == 5)
  482. sql.Format("delete from worktype where name='%s'", name);
  483. else if (m_mode == 6)
  484. sql.Format("delete from expendtype where name='%s'", name);
  485. else if (m_mode == 7)
  486. sql.Format("delete from baseexpendtype where name='%s'", name);
  487. else if (m_mode == 8)
  488. sql.Format("delete from clientfrom where name='%s'", name);
  489. else if (m_mode == 9)
  490. sql.Format("delete from clientreason where name='%s'", name);
  491. else if (m_mode == 10)
  492. sql.Format("delete from jdd where name='%s'", name);
  493. else if (m_mode == 11)
  494. sql.Format("delete from dressarea where name='%s'", name);
  495. else if (m_mode == 12)
  496. sql.Format("delete from [txlb2] where name='%s'", name);
  497. else if (m_mode == 13)
  498. sql.Format("delete from [sale2type] where name='%s'", name);
  499. else if (m_mode == 14)
  500. sql.Format("delete from businesstype where name='%s'", name);
  501. else if (m_mode == 15)
  502. sql.Format("delete from businessintention where name='%s'", name);
  503. else if (m_mode == 16)
  504. sql.Format("delete from [clienttype] where name='%s'", name);
  505. else if (m_mode == 17)
  506. sql.Format("delete from [hospital] where name='%s'", name);
  507. else if (m_mode == 18)
  508. sql.Format("delete from [clientqequirement] where name='%s'", name);
  509. else
  510. sql.Format("delete from shangpinlb where name='%s'***delete from shangpin where splb='%s'", name, name);
  511. g_sendhead.bsql = 1;
  512. g_pMainWnd->ProcessChatMessageRequest2(sql);
  513. if (g_bSendOK == 0)return;
  514. FillGrid();
  515. }
  516. void SPLBDlg::OnOK()
  517. {
  518. if (m_mode == 19) // 19=选片时的客户要求;
  519. {
  520. POSITION pos;
  521. pos = m_List1.GetFirstSelectedItemPosition();
  522. if (pos == NULL)
  523. {
  524. return;
  525. }
  526. int iItem = m_List1.GetNextSelectedItem(pos);
  527. m_edit1 = m_List1.GetItemText(iItem, 0);
  528. CDialog::OnOK();
  529. return;
  530. }
  531. if (m_mode != 2)
  532. {
  533. CDialog::OnCancel();
  534. return;
  535. }
  536. POSITION pos;
  537. pos = m_List1.GetFirstSelectedItemPosition();
  538. if (pos == NULL)
  539. {
  540. AfxMessageBox("请先选中景点!", MB_ICONINFORMATION);
  541. return;
  542. }
  543. int iItem;
  544. m_array.RemoveAll();
  545. while (pos)
  546. {
  547. iItem = m_List1.GetNextSelectedItem(pos);
  548. m_array.Add(m_List1.GetItemText(iItem, 0));
  549. }
  550. CDialog::OnOK();
  551. }
  552. void SPLBDlg::OnButton5()
  553. {
  554. CDialog::OnCancel();
  555. }
  556. void SPLBDlg::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
  557. {
  558. OnOK();
  559. *pResult = 0;
  560. }
  561. void SPLBDlg::OnBUTadd3()
  562. {
  563. POSITION pos;
  564. pos = m_List1.GetFirstSelectedItemPosition();
  565. if (pos == NULL)
  566. {
  567. AfxMessageBox("请选中您要修改的类别!", MB_ICONINFORMATION);
  568. return;
  569. }
  570. int iItem = m_List1.GetNextSelectedItem(pos);
  571. CString name = m_List1.GetItemText(iItem, 0);
  572. UpdateData();
  573. m_edit1.TrimLeft();
  574. m_edit1.TrimRight();
  575. if (m_edit1.IsEmpty())
  576. {
  577. AfxMessageBox("商品类别不能为空!", MB_ICONINFORMATION);
  578. this->GetDlgItem(IDC_EDIT1)->SetFocus();
  579. return;
  580. }
  581. if (m_edit1 == name)return;
  582. if (AfxMessageBox("确认修改吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  583. CString sql, sql2;
  584. sql.Format("update shangpinlb set name='%s' where name='%s'", m_edit1, name);
  585. sql2.Format("update shangpin set splb='%s' where splb='%s'", m_edit1, name);
  586. sql += "***" + sql2;
  587. g_sendhead.bsql = 1;
  588. g_pMainWnd->ProcessChatMessageRequest2(sql);
  589. if (g_bSendOK == 0)return;
  590. FillGrid();
  591. }
  592. void SPLBDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult)
  593. {
  594. POSITION pos;
  595. pos = m_List1.GetFirstSelectedItemPosition();
  596. if (pos == NULL)
  597. {
  598. return;
  599. }
  600. int iItem = m_List1.GetNextSelectedItem(pos);
  601. m_edit1 = m_List1.GetItemText(iItem, 0);
  602. UpdateData(0);
  603. *pResult = 0;
  604. }
  605. void SPLBDlg::OnBUTadd4()
  606. {
  607. SPLBDlg dlg;
  608. dlg.m_mode = 18;
  609. dlg.DoModal();
  610. FillGrid();
  611. }