ChoosePhotoSkin.cpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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. g_sendhead.bsql=0;
  79. g_sendhead.code[0]=23;
  80. g_sendhead.code[1]=24;
  81. g_sendhead.code[2]=29;
  82. g_sendhead.code[3]=5;
  83. g_sendhead.code[4]=1;
  84. if(g_branchname=="")
  85. {
  86. g_sendhead.code[5]=152;
  87. g_sendhead.tabcount=6;
  88. }
  89. else
  90. g_sendhead.tabcount=5;
  91. int g_nYearposTemp=g_nYearpos;
  92. g_nYearpos=-1;
  93. g_pMainWnd->ProcessChatMessageRequest2("[dimission]<>'离职' or [dimission] is null;;;;;;");
  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(&m_List1array,&g_cominfoarray,&patharray,&userarray,&g_hisyeararray,&g_brancharray);
  104. else
  105. DataToArray(&m_List1array,&g_cominfoarray,&patharray,&userarray,&g_hisyeararray);
  106. if(g_branchname=="")
  107. {
  108. g_cominfoarraylocal.SetSize(1, 1);
  109. g_cominfoarraylocal.ElementAt(0).Copy(g_cominfoarray.ElementAt(0));
  110. }
  111. if(g_branchname=="")
  112. {
  113. g_domain=patharray.ElementAt(0).ElementAt(0);
  114. if(g_domain.Find (".ly.com")==-1)g_domain.Empty ();
  115. g_bSaveUploadTask1=atoi(g_cominfoarray.ElementAt(0).ElementAt(67));
  116. g_bSaveUploadTask2=atoi(g_cominfoarray.ElementAt(0).ElementAt(68));
  117. g_bSaveUploadTask3=atoi(g_cominfoarray.ElementAt(0).ElementAt(69));
  118. g_bSaveUploadTask4=atoi(g_cominfoarray.ElementAt(0).ElementAt(70));
  119. }
  120. CString version = _T ("Version 1.0");
  121. BOOL bHide=atoi(g_cominfoarray.ElementAt(0).ElementAt(58));
  122. AfxGetApp()->WriteProfileInt (version, "hidewindow2", bHide);
  123. g_userarray.SetSize( userarray.GetSize (), 1 );
  124. int count=0;
  125. for(int ii=0; ii<userarray.GetSize (); ii++)
  126. {
  127. if(userarray.ElementAt (ii).ElementAt (10)=="在职")
  128. g_userarray.ElementAt (count++).Copy (userarray.ElementAt (ii));
  129. }
  130. g_userarray.SetSize( count, 1 );
  131. CString strVersion;
  132. strVersion.Format("%d%d", g_arrFileVersion[2], g_arrFileVersion[3]);
  133. if (g_cominfoarray.ElementAt(0).ElementAt(0) != strVersion)
  134. {
  135. AfxMessageBox("您必须更新软件才能继续使用, 请与系统管理员联系!", MB_ICONINFORMATION);
  136. CDialog::OnCancel();
  137. g_pMainWnd->AutoUpdate();
  138. return;
  139. }
  140. #ifndef ENTERPRISE_VERSION
  141. {
  142. #ifndef CHILD_VERSION
  143. #ifdef BASIC_VERSION
  144. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  145. {
  146. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  147. exit(0);return;
  148. }
  149. #else
  150. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  151. {
  152. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  153. exit(0);return;
  154. }
  155. #endif
  156. #else
  157. #ifdef BASIC_VERSION
  158. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  159. {
  160. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  161. exit(0);return;
  162. }
  163. #else
  164. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  165. {
  166. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  167. exit(0);return;
  168. }
  169. #endif
  170. #endif
  171. }
  172. #else
  173. {
  174. #ifndef CHILD_VERSION
  175. #ifdef BASIC_VERSION
  176. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  177. {
  178. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  179. exit(0);return;
  180. }
  181. #else
  182. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  183. {
  184. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  185. exit(0);return;
  186. }
  187. #endif
  188. #else
  189. #ifdef BASIC_VERSION
  190. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  191. {
  192. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  193. exit(0);return;
  194. }
  195. #else
  196. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="7")
  197. {
  198. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  199. exit(0);return;
  200. }
  201. #endif
  202. #endif
  203. }
  204. #endif
  205. g_title=g_cominfoarray.ElementAt (0).ElementAt (10);
  206. WriteTitle(g_cominfoarray.ElementAt (0).ElementAt (10));
  207. g_date=g_cominfoarray.ElementAt(0).ElementAt(1);
  208. if(g_hisyeararray.GetSize())
  209. {
  210. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  211. }
  212. if(g_brancharray.GetSize() && g_branchname=="")
  213. {
  214. g_pMainWnd->AddBranchMenu(&g_brancharray);
  215. }
  216. if(g_branchname=="")
  217. {
  218. if(g_server=="127.0.0.1")
  219. {
  220. g_sendhead.bsql=0;
  221. g_sendhead.code[0]=63;
  222. g_sendhead.tabcount=1;
  223. g_pMainWnd->ProcessChatMessageRequest2(1);
  224. if(g_bSendOK==0)
  225. {
  226. CDialog::OnCancel();
  227. return;
  228. }
  229. DataToArray(&g_List1array);
  230. g_path1=g_List1array.ElementAt(0).ElementAt(0)+"\\客户原片(管理软件)$";
  231. g_path2=g_List1array.ElementAt(0).ElementAt(0)+"\\修好的片(管理软件)$";
  232. g_path3=g_List1array.ElementAt(0).ElementAt(0)+"\\设计好的片(管理软件)$";
  233. g_path4=g_List1array.ElementAt(0).ElementAt(0)+"\\精修好的片(管理软件)$";
  234. g_path5=g_List1array.ElementAt(0).ElementAt(0)+"\\礼服图片(管理软件)$";
  235. g_path6=g_List1array.ElementAt(0).ElementAt(0)+"\\电话录音(管理软件)$";
  236. g_path7=g_path1+"\\效果图";
  237. }
  238. else if(patharray.GetSize())
  239. {
  240. g_path1=g_path2=g_path3=g_path4=g_path5=g_path6=g_path7=g_serverbak;
  241. g_path1="\\\\"+g_path1+"\\客户原片(管理软件)$";
  242. g_path2="\\\\"+g_path2+"\\修好的片(管理软件)$";
  243. g_path3="\\\\"+g_path3+"\\设计好的片(管理软件)$";
  244. g_path4="\\\\"+g_path4+"\\精修好的片(管理软件)$";
  245. g_path5="\\\\"+g_path5+"\\礼服图片(管理软件)$";
  246. g_path6="\\\\"+g_path6+"\\电话录音(管理软件)$";
  247. g_path7=g_path1+"\\效果图";
  248. }
  249. g_path1bak=g_path1;
  250. g_path2bak=g_path2;
  251. g_path3bak=g_path3;
  252. g_path4bak=g_path4;
  253. g_path5bak=g_path5;
  254. g_path6bak=g_path6;
  255. g_path7bak=g_path7;
  256. }
  257. try
  258. {
  259. CFile fp;
  260. if(fp.Open (g_mainpath+"\\loginuser.dat", CFile::modeRead))
  261. {
  262. DWORD length=fp.GetLength ();
  263. if(!length)return;
  264. CArchive ar(&fp, CArchive::load);
  265. m_userarray.Serialize (ar);
  266. fp.Close ();
  267. for(int i=0; i<m_userarray.GetSize (); i++)
  268. {
  269. m_combobox.AddString (m_userarray.ElementAt (i));
  270. }
  271. if(m_combobox.GetCount ()>0)
  272. {
  273. m_combobox.SetCurSel (0);
  274. m_combobox.GetLBText (0, m_account);
  275. }
  276. if(!m_account.IsEmpty ())
  277. {
  278. CString version = _T ("Version 1.0");
  279. m_psw=AfxGetApp()->GetProfileString (version, _T (m_account));
  280. if(!m_psw.IsEmpty ())
  281. m_bsave=TRUE;
  282. }
  283. // SetDlgItemText(100, m_account);
  284. SetDlgItemText(200, m_psw);
  285. m_button.SetCheck (m_bsave);
  286. }
  287. }
  288. catch(...)
  289. {
  290. }
  291. }
  292. void ChoosePhotoSkin::Destory()
  293. {
  294. }
  295. void ChoosePhotoSkin::BtnClick(WPARAM wParam, LPARAM lParam)
  296. {
  297. int id=lParam;
  298. id-=99;
  299. switch(id)
  300. {
  301. case 1:
  302. {
  303. m_combobox.GetWindowText (m_account);
  304. // GetDlgItemText(100, m_account);
  305. GetDlgItemText(200, m_psw);
  306. m_bsave= m_button.GetCheck ();
  307. if(m_account.IsEmpty())
  308. {
  309. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  310. return;
  311. }
  312. for(int i=0; i<m_List1array.GetSize(); i++)
  313. {
  314. if(m_account==m_List1array.ElementAt(i).ElementAt(0))
  315. {
  316. if(m_psw!=m_List1array.ElementAt(i).ElementAt(2))
  317. {
  318. AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION);return;
  319. }
  320. else
  321. {
  322. g_user.bLongin=1;
  323. g_user.account=m_account;
  324. g_user.name=m_List1array.ElementAt(i).ElementAt(1);
  325. g_user.rights=m_List1array.ElementAt(i).ElementAt(3);
  326. g_user.rights2=m_List1array.ElementAt(i).ElementAt(4);
  327. g_user.m_discount=m_List1array.ElementAt(i).ElementAt(5);
  328. g_user.m_discount2=m_List1array.ElementAt(i).ElementAt(6);
  329. g_user.level=m_List1array.ElementAt(i).ElementAt(7);
  330. // g_user.bm=GetBm(g_user.name,g_userarray);
  331. SaveLongin();
  332. g_pMainWnd2->RefreshOutlookBar();
  333. CString str;
  334. str="当前用户:"+g_user.name;
  335. #ifndef NEW_SKIN
  336. g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
  337. #endif
  338. SearchClient dlg;
  339. dlg.m_mode=m_mode;
  340. dlg.SetLiaPath ("2.lia");
  341. if(dlg.DoModal ()!=IDOK)
  342. return;
  343. m_exitcode=dlg.m_exitcode;
  344. CDialog::OnOK ();
  345. return;
  346. }
  347. }
  348. }
  349. AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
  350. }
  351. break;
  352. case 2:
  353. CDialog::OnCancel ();
  354. break;
  355. }
  356. }
  357. BOOL ChoosePhotoSkin::PreTransMsg(MSG* pMsg)
  358. {
  359. if(pMsg->message==WM_KEYDOWN)
  360. {
  361. switch (pMsg->wParam)
  362. {
  363. case VK_F2:
  364. if(g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown()==0 || g_pMainWnd->IsCtrlDown()==0) )return 1;
  365. if(m_mode)
  366. m_exitcode=2;
  367. CDialog::OnOK ();
  368. return 1;
  369. case VK_F3:
  370. if(g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown()==0 || g_pMainWnd->IsCtrlDown()==0) )return 1;
  371. if(m_mode==0)
  372. m_exitcode=3;
  373. CDialog::OnOK ();
  374. return 1;
  375. case VK_RETURN:
  376. BtnClick(0, 100);
  377. return 1;
  378. }
  379. }
  380. else if(pMsg->message==WM_LBUTTONDOWN)
  381. {
  382. g_bNeedDrawParent=1;
  383. CPoint pt;
  384. ::GetCursorPos (&pt);
  385. ScreenToClient(&pt);
  386. CRect rc;
  387. m_button.GetWindowRect (rc);
  388. ScreenToClient(rc);
  389. if(rc.PtInRect (pt))return CDialog::PreTranslateMessage(pMsg);
  390. if(m_rcarray.ElementAt (4).PtInRect (pt))
  391. {
  392. m_button.SetCheck (!m_button.GetCheck ());
  393. }
  394. }
  395. return CDialog::PreTranslateMessage(pMsg);
  396. }
  397. void ChoosePhotoSkin::SaveLongin()
  398. {
  399. CString version = _T ("Version 1.0");
  400. if(m_bsave)
  401. {
  402. AfxGetApp()->WriteProfileString (version, _T (m_account), m_psw);
  403. }
  404. else
  405. {
  406. AfxGetApp()->WriteProfileString (version, _T (m_account), "");
  407. }
  408. if(m_userarray.GetSize ())
  409. {
  410. if(m_userarray.ElementAt (0)!=m_account)
  411. {
  412. RemoveExist(m_account);
  413. m_userarray.InsertAt (0,m_account);
  414. if(m_userarray.GetSize ()>30)
  415. m_userarray.SetSize (30);
  416. }
  417. }
  418. else
  419. {
  420. m_userarray.Add (m_account);
  421. }
  422. CFile f;
  423. if(!f.Open (g_mainpath+"\\loginuser.dat", CFile::modeWrite|CFile::modeCreate))return ;
  424. CArchive ar(&f, CArchive::store);
  425. m_userarray.Serialize (ar);
  426. ar.Close();
  427. f.Close ();
  428. }
  429. void ChoosePhotoSkin::RemoveExist(CString str)
  430. {
  431. for(int i=0; i<m_userarray.GetSize(); i++)
  432. {
  433. if(str==m_userarray.ElementAt(i))
  434. {
  435. m_userarray.RemoveAt(i);
  436. return;
  437. }
  438. }
  439. }