ChoosePhotoSkin.cpp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. // ChoosePhotoSkin.cpp: implementation of the ChoosePhotoSkin class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "YLGL.h"
  6. #include "ChoosePhotoSkin.h"
  7. #include "SearchClient.h"
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #define new DEBUG_NEW
  12. #endif
  13. //////////////////////////////////////////////////////////////////////
  14. // Construction/Destruction
  15. //////////////////////////////////////////////////////////////////////
  16. ChoosePhotoSkin::ChoosePhotoSkin()
  17. {
  18. m_mode = 0;
  19. m_exitcode = 0;
  20. m_bsave = 0;
  21. g_pMainWnd->GetSkin();
  22. }
  23. ChoosePhotoSkin::~ChoosePhotoSkin()
  24. {
  25. }
  26. void ChoosePhotoSkin::OnFSCommand(LPCTSTR command, LPCTSTR args)
  27. {
  28. }
  29. void ChoosePhotoSkin::Init()
  30. {
  31. g_bInSkin = 1;
  32. if (1)//g_bRedSkin)
  33. {
  34. Graphics graph(m_pBk);
  35. Image *img = NULL;
  36. if (m_mode == 0)
  37. ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\选片.jpg");
  38. else
  39. ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\看设计.jpg");
  40. graph.SetSmoothingMode(SmoothingModeHighQuality);
  41. graph.DrawImage(img, 0, 0);
  42. delete img;
  43. ((MyBmpButton2*)m_picarray.ElementAt(5))->EnableWindow(0);
  44. ((MyBmpButton2*)m_picarray.ElementAt(6))->EnableWindow(0);
  45. ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
  46. }
  47. else
  48. {
  49. Graphics graph(m_pBk);
  50. Image *img = NULL;
  51. if (m_mode == 0)
  52. ::LoadImageFromBuf(&img, g_mainpath + "\\skin\\标题-选片.jpg");
  53. else
  54. ::LoadImageFromBuf(&img, g_mainpath + "\\skin\\标题-看设计.jpg");
  55. graph.SetSmoothingMode(SmoothingModeHighQuality);
  56. graph.DrawImage(img, 0, 0);
  57. delete img; ((MyBmpButton2*)m_picarray.ElementAt(5))->ShowWindow(SW_HIDE);
  58. }
  59. m_combobox.Create(WS_VSCROLL | WS_CHILD | CBS_DROPDOWN, m_rcarray.ElementAt(2), this, 100);
  60. m_combobox.ShowWindow(SW_SHOW);
  61. CRect rc = m_rcarray.ElementAt(2);
  62. rc.bottom += 200;
  63. m_combobox.MoveWindow(rc);
  64. m_combobox.GetWindowRect(rc);
  65. int hei = rc.Height();
  66. rc = m_rcarray.ElementAt(3);
  67. rc.bottom = rc.top + hei + 5;
  68. m_edit.Create(ES_AUTOHSCROLL | WS_CHILD | ES_LEFT | WS_BORDER | ES_PASSWORD | WS_EX_WINDOWEDGE, rc, this, 200);
  69. m_edit.ShowWindow(SW_SHOW);
  70. rc = m_rcarray.ElementAt(4);
  71. rc.bottom = rc.top + 13;
  72. rc.right = rc.left + 13;
  73. m_button.Create("", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_FLAT, rc, this, 300);
  74. tpFont.CreatePointFont(180, _T("黑体"));
  75. m_edit.SetFont(&tpFont);
  76. m_combobox.SetFont(&tpFont);
  77. /////////////////////////
  78. #if JEFF_TEST_ON
  79. g_sendhead.bsql = 0;
  80. g_sendhead.code[0] = 24;
  81. g_sendhead.code[1] = 29;
  82. g_sendhead.code[2] = 5;
  83. g_sendhead.code[3] = 1;
  84. if (g_branchname == "")
  85. {
  86. g_sendhead.code[4] = 152;
  87. g_sendhead.tabcount = 5;
  88. }
  89. else
  90. g_sendhead.tabcount = 4;
  91. int g_nYearposTemp = g_nYearpos;
  92. g_nYearpos = -1;
  93. g_pMainWnd->ProcessChatMessageRequest2(";;;;;");
  94. g_nYearpos = g_nYearposTemp;
  95. if (g_bSendOK == 0)
  96. {
  97. CDialog::OnCancel();
  98. return;
  99. }
  100. CArray<CStringArray, CStringArray>patharray;
  101. CArray<CStringArray, CStringArray>userarray;
  102. if (g_branchname == "")
  103. DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_brancharray);
  104. else
  105. DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray);
  106. #else
  107. g_sendhead.bsql = 0;
  108. g_sendhead.code[0] = 23;
  109. g_sendhead.code[1] = 24;
  110. g_sendhead.code[2] = 29;
  111. g_sendhead.code[3] = 5;
  112. g_sendhead.code[4] = 1;
  113. if (g_branchname == "")
  114. {
  115. g_sendhead.code[5] = 152;
  116. g_sendhead.tabcount = 6;
  117. }
  118. else
  119. g_sendhead.tabcount = 5;
  120. int g_nYearposTemp = g_nYearpos;
  121. g_nYearpos = -1;
  122. g_pMainWnd->ProcessChatMessageRequest2("[dimission]<>'离职' or [dimission] is null;;;;;;");
  123. g_nYearpos = g_nYearposTemp;
  124. if (g_bSendOK == 0)
  125. {
  126. CDialog::OnCancel();
  127. return;
  128. }
  129. CArray<CStringArray, CStringArray>patharray;
  130. CArray<CStringArray, CStringArray>userarray;
  131. if (g_branchname == "")
  132. DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_brancharray);
  133. else
  134. DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray);
  135. #endif
  136. if (g_branchname == "")
  137. {
  138. g_cominfoarraylocal.SetSize(1, 1);
  139. g_cominfoarraylocal.ElementAt(0).Copy(g_cominfoarray.ElementAt(0));
  140. }
  141. if (g_branchname == "")
  142. {
  143. g_domain = patharray.ElementAt(0).ElementAt(0);
  144. if (g_domain.Find(".ly.com") == -1)g_domain.Empty();
  145. g_bSaveUploadTask1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(67));
  146. g_bSaveUploadTask2 = atoi(g_cominfoarray.ElementAt(0).ElementAt(68));
  147. g_bSaveUploadTask3 = atoi(g_cominfoarray.ElementAt(0).ElementAt(69));
  148. g_bSaveUploadTask4 = atoi(g_cominfoarray.ElementAt(0).ElementAt(70));
  149. }
  150. CString version = _T("Version 1.0");
  151. BOOL bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(58));
  152. AfxGetApp()->WriteProfileInt(version, "hidewindow2", bHide);
  153. g_userarray.SetSize(userarray.GetSize(), 1);
  154. int count = 0;
  155. for (int ii = 0; ii < userarray.GetSize(); ii++)
  156. {
  157. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  158. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  159. }
  160. g_userarray.SetSize(count, 1);
  161. #if 0
  162. if(g_cominfoarray.ElementAt(0).ElementAt(0)!="629")
  163. #else
  164. CString strVersion;
  165. strVersion.Format("%d%d", g_arrFileVersion[2], g_arrFileVersion[3]);
  166. if (g_cominfoarray.ElementAt(0).ElementAt(0) != strVersion)
  167. #endif
  168. {
  169. AfxMessageBox("您必须更新软件才能继续使用, 请与系统管理员联系!", MB_ICONINFORMATION);
  170. CDialog::OnCancel();
  171. g_pMainWnd->AutoUpdate();
  172. return;
  173. }
  174. #ifndef ENTERPRISE_VERSION
  175. {
  176. #ifndef CHILD_VERSION
  177. #ifdef BASIC_VERSION
  178. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  179. {
  180. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  181. exit(0);return;
  182. }
  183. #else
  184. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  185. {
  186. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  187. exit(0);return;
  188. }
  189. #endif
  190. #else
  191. #ifdef BASIC_VERSION
  192. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  193. {
  194. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  195. exit(0);return;
  196. }
  197. #else
  198. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  199. {
  200. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  201. exit(0);return;
  202. }
  203. #endif
  204. #endif
  205. }
  206. #else
  207. {
  208. #ifndef CHILD_VERSION
  209. #ifdef BASIC_VERSION
  210. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  211. {
  212. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  213. exit(0);return;
  214. }
  215. #else
  216. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  217. {
  218. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  219. exit(0);return;
  220. }
  221. #endif
  222. #else
  223. #ifdef BASIC_VERSION
  224. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  225. {
  226. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  227. exit(0);return;
  228. }
  229. #else
  230. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  231. {
  232. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  233. exit(0); return;
  234. }
  235. #endif
  236. #endif
  237. }
  238. #endif
  239. g_title = g_cominfoarray.ElementAt(0).ElementAt(10);
  240. WriteTitle(g_cominfoarray.ElementAt(0).ElementAt(10));
  241. g_date = g_cominfoarray.ElementAt(0).ElementAt(1);
  242. if (g_hisyeararray.GetSize())
  243. {
  244. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  245. }
  246. if (g_brancharray.GetSize() && g_branchname == "")
  247. {
  248. g_pMainWnd->AddBranchMenu(&g_brancharray);
  249. }
  250. if (g_branchname == "")
  251. {
  252. if (g_server == "127.0.0.1")
  253. {
  254. g_sendhead.bsql = 0;
  255. g_sendhead.code[0] = 63;
  256. g_sendhead.tabcount = 1;
  257. g_pMainWnd->ProcessChatMessageRequest2(1);
  258. if (g_bSendOK == 0)
  259. {
  260. CDialog::OnCancel();
  261. return;
  262. }
  263. DataToArray(&g_List1array);
  264. g_path1 = g_List1array.ElementAt(0).ElementAt(0) + "\\客户原片(管理软件)$";
  265. g_path2 = g_List1array.ElementAt(0).ElementAt(0) + "\\修好的片(管理软件)$";
  266. g_path3 = g_List1array.ElementAt(0).ElementAt(0) + "\\设计好的片(管理软件)$";
  267. g_path4 = g_List1array.ElementAt(0).ElementAt(0) + "\\精修好的片(管理软件)$";
  268. g_path5 = g_List1array.ElementAt(0).ElementAt(0) + "\\礼服图片(管理软件)$";
  269. g_path6 = g_List1array.ElementAt(0).ElementAt(0) + "\\电话录音(管理软件)$";
  270. g_path7 = g_path1 + "\\效果图";
  271. }
  272. else if (patharray.GetSize())
  273. {
  274. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = g_serverbak;
  275. g_path1 = "\\\\" + g_path1 + "\\客户原片(管理软件)$";
  276. g_path2 = "\\\\" + g_path2 + "\\修好的片(管理软件)$";
  277. g_path3 = "\\\\" + g_path3 + "\\设计好的片(管理软件)$";
  278. g_path4 = "\\\\" + g_path4 + "\\精修好的片(管理软件)$";
  279. g_path5 = "\\\\" + g_path5 + "\\礼服图片(管理软件)$";
  280. g_path6 = "\\\\" + g_path6 + "\\电话录音(管理软件)$";
  281. g_path7 = g_path1 + "\\效果图";
  282. }
  283. g_path1bak = g_path1;
  284. g_path2bak = g_path2;
  285. g_path3bak = g_path3;
  286. g_path4bak = g_path4;
  287. g_path5bak = g_path5;
  288. g_path6bak = g_path6;
  289. g_path7bak = g_path7;
  290. }
  291. try
  292. {
  293. CFile fp;
  294. if (fp.Open(g_mainpath + "\\loginuser.dat", CFile::modeRead))
  295. {
  296. DWORD length = fp.GetLength();
  297. if (!length)return;
  298. CArchive ar(&fp, CArchive::load);
  299. m_userarray.Serialize(ar);
  300. fp.Close();
  301. for (int i = 0; i < m_userarray.GetSize(); i++)
  302. {
  303. m_combobox.AddString(m_userarray.ElementAt(i));
  304. }
  305. if (m_combobox.GetCount()>0)
  306. {
  307. m_combobox.SetCurSel(0);
  308. m_combobox.GetLBText(0, m_account);
  309. }
  310. if (!m_account.IsEmpty())
  311. {
  312. CString version = _T("Version 1.0");
  313. m_psw = AfxGetApp()->GetProfileString(version, _T(m_account));
  314. if (!m_psw.IsEmpty())
  315. m_bsave = TRUE;
  316. }
  317. // SetDlgItemText(100, m_account);
  318. SetDlgItemText(200, m_psw);
  319. m_button.SetCheck(m_bsave);
  320. }
  321. }
  322. catch (...)
  323. {
  324. }
  325. }
  326. void ChoosePhotoSkin::Destory()
  327. {
  328. }
  329. void ChoosePhotoSkin::BtnClick(WPARAM wParam, LPARAM lParam)
  330. {
  331. int id = lParam;
  332. id -= 99;
  333. switch (id)
  334. {
  335. case 1:
  336. {
  337. #if JEFF_TEST_ON
  338. m_combobox.GetWindowText(m_account);
  339. // GetDlgItemText(100, m_account);
  340. GetDlgItemText(200, m_psw);
  341. m_bsave = m_button.GetCheck();
  342. if (m_account.IsEmpty())
  343. {
  344. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  345. return;
  346. }
  347. CString strSQL;
  348. strSQL.Format("account='%s' and psw='%s'", m_account, m_psw);
  349. g_sendhead.bsql = 0;
  350. g_sendhead.code[0] = 23;
  351. g_sendhead.tabcount = 1;
  352. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  353. //CArray<CStringArray, CStringArray> arryOfAccountInfo;
  354. if (!g_bSendOK)
  355. {
  356. AfxMessageBox("连接服务器失败");
  357. }
  358. m_List1array.RemoveAll();
  359. DataToArray(&m_List1array);
  360. if (m_List1array.GetSize() == 0)
  361. {
  362. AfxMessageBox("账号或密码错误");
  363. return;
  364. }
  365. else
  366. {
  367. g_user.bLongin = 1;
  368. g_user.account = m_account;
  369. g_user.name = m_List1array.ElementAt(0).ElementAt(1);
  370. g_user.rights = m_List1array.ElementAt(0).ElementAt(3);
  371. g_user.rights2 = m_List1array.ElementAt(0).ElementAt(4);
  372. g_user.m_discount = m_List1array.ElementAt(0).ElementAt(5);
  373. g_user.m_discount2 = m_List1array.ElementAt(0).ElementAt(6);
  374. g_user.level = m_List1array.ElementAt(0).ElementAt(7);
  375. SaveLongin();
  376. g_pMainWnd2->RefreshOutlookBar();
  377. CString str;
  378. str = "当前用户:" + g_user.name;
  379. #ifndef NEW_SKIN
  380. g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
  381. #endif
  382. SearchClient dlg;
  383. dlg.m_mode = m_mode;
  384. dlg.SetLiaPath("2.lia");
  385. if (dlg.DoModal() != IDOK)
  386. return;
  387. m_exitcode = dlg.m_exitcode;
  388. CDialog::OnOK();
  389. return;
  390. }
  391. #else
  392. m_combobox.GetWindowText(m_account);
  393. // GetDlgItemText(100, m_account);
  394. GetDlgItemText(200, m_psw);
  395. m_bsave = m_button.GetCheck();
  396. if (m_account.IsEmpty())
  397. {
  398. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  399. return;
  400. }
  401. for (int i = 0; i < m_List1array.GetSize(); i++)
  402. {
  403. if (m_account == m_List1array.ElementAt(i).ElementAt(0))
  404. {
  405. if (m_psw != m_List1array.ElementAt(i).ElementAt(2))
  406. {
  407. AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION); return;
  408. }
  409. else
  410. {
  411. g_user.bLongin = 1;
  412. g_user.account = m_account;
  413. g_user.name = m_List1array.ElementAt(i).ElementAt(1);
  414. g_user.rights = m_List1array.ElementAt(i).ElementAt(3);
  415. g_user.rights2 = m_List1array.ElementAt(i).ElementAt(4);
  416. g_user.m_discount = m_List1array.ElementAt(i).ElementAt(5);
  417. g_user.m_discount2 = m_List1array.ElementAt(i).ElementAt(6);
  418. g_user.level = m_List1array.ElementAt(i).ElementAt(7);
  419. // g_user.bm=GetBm(g_user.name,g_userarray);
  420. SaveLongin();
  421. g_pMainWnd2->RefreshOutlookBar();
  422. CString str;
  423. str = "当前用户:" + g_user.name;
  424. #ifndef NEW_SKIN
  425. g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
  426. #endif
  427. SearchClient dlg;
  428. dlg.m_mode = m_mode;
  429. dlg.SetLiaPath("2.lia");
  430. if (dlg.DoModal() != IDOK)
  431. return;
  432. m_exitcode = dlg.m_exitcode;
  433. CDialog::OnOK();
  434. return;
  435. }
  436. }
  437. }
  438. AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
  439. #endif
  440. }
  441. break;
  442. case 2:
  443. CDialog::OnCancel();
  444. break;
  445. }
  446. }
  447. BOOL ChoosePhotoSkin::PreTransMsg(MSG* pMsg)
  448. {
  449. if (pMsg->message == WM_KEYDOWN)
  450. {
  451. switch (pMsg->wParam)
  452. {
  453. case VK_F2:
  454. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  455. if (m_mode)
  456. m_exitcode = 2;
  457. CDialog::OnOK();
  458. return 1;
  459. case VK_F3:
  460. if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
  461. if (m_mode == 0)
  462. m_exitcode = 3;
  463. CDialog::OnOK();
  464. return 1;
  465. case VK_RETURN:
  466. BtnClick(0, 100);
  467. return 1;
  468. }
  469. }
  470. else if (pMsg->message == WM_LBUTTONDOWN)
  471. {
  472. g_bNeedDrawParent = 1;
  473. CPoint pt;
  474. ::GetCursorPos(&pt);
  475. ScreenToClient(&pt);
  476. CRect rc;
  477. m_button.GetWindowRect(rc);
  478. ScreenToClient(rc);
  479. if (rc.PtInRect(pt))return CDialog::PreTranslateMessage(pMsg);
  480. if (m_rcarray.ElementAt(4).PtInRect(pt))
  481. {
  482. m_button.SetCheck(!m_button.GetCheck());
  483. }
  484. }
  485. return CDialog::PreTranslateMessage(pMsg);
  486. }
  487. void ChoosePhotoSkin::SaveLongin()
  488. {
  489. CString version = _T("Version 1.0");
  490. if (m_bsave)
  491. {
  492. AfxGetApp()->WriteProfileString(version, _T(m_account), m_psw);
  493. }
  494. else
  495. {
  496. AfxGetApp()->WriteProfileString(version, _T(m_account), "");
  497. }
  498. if (m_userarray.GetSize())
  499. {
  500. if (m_userarray.ElementAt(0) != m_account)
  501. {
  502. RemoveExist(m_account);
  503. m_userarray.InsertAt(0, m_account);
  504. if (m_userarray.GetSize() > 30)
  505. m_userarray.SetSize(30);
  506. }
  507. }
  508. else
  509. {
  510. m_userarray.Add(m_account);
  511. }
  512. CFile f;
  513. if (!f.Open(g_mainpath + "\\loginuser.dat", CFile::modeWrite | CFile::modeCreate))return;
  514. CArchive ar(&f, CArchive::store);
  515. m_userarray.Serialize(ar);
  516. ar.Close();
  517. f.Close();
  518. }
  519. void ChoosePhotoSkin::RemoveExist(CString str)
  520. {
  521. for (int i = 0; i < m_userarray.GetSize(); i++)
  522. {
  523. if (str == m_userarray.ElementAt(i))
  524. {
  525. m_userarray.RemoveAt(i);
  526. return;
  527. }
  528. }
  529. }