Login.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. // Login.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "Login.h"
  6. #include "JPEG.h"
  7. #include "DigitalWorkSet2.h"
  8. #include "ShowMsg.h"
  9. #include "ShowBakState.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. //#define TESTHG
  16. //#define CCIV_SKIN 1
  17. //创建快捷方式
  18. BOOL CreateLink(
  19. LPSTR szPath,//快捷方式的目标应用程序名
  20. LPSTR szLink,
  21. LPSTR szIcon)//快捷方式的数据文件名(*.lnk)
  22. {
  23. HRESULT hres;
  24. IShellLink * psl;
  25. IPersistFile* ppf;
  26. WCHAR wsz[MAX_PATH];
  27. //创建一个IShellLink实例
  28. hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
  29. if (FAILED(hres))
  30. return FALSE;
  31. //设置目标应用程序
  32. psl->SetPath(szPath);
  33. psl->SetIconLocation(szIcon, 0);
  34. //设置快捷键(此处设为Shift+Ctrl+'R')
  35. // psl -> SetHotkey( MAKEWORD( 'R',
  36. // HOTKEYF_SHIFT |HOTKEYF_CONTROL)) ;
  37. //从IShellLink获取其IPersistFile接口
  38. //用于保存快捷方式的数据文件 (*.lnk)
  39. hres = psl->QueryInterface(IID_IPersistFile,
  40. (void**)&ppf);
  41. if (FAILED(hres)) return FALSE;
  42. // 确保数据文件名为ANSI格式
  43. MultiByteToWideChar(CP_ACP, 0, szLink, -1,
  44. wsz, MAX_PATH);
  45. //调用IPersist:Save
  46. //保存快捷方式的数据文件 (*.lnk)
  47. hres = ppf->Save(wsz, STGM_READWRITE);
  48. //释放IPersistFile和IShellLink接口
  49. ppf->Release();
  50. psl->Release();
  51. return TRUE;
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // Login dialog
  55. Login::Login(CWnd* pParent /*=NULL*/)
  56. : CDialog(Login::IDD, pParent)
  57. {
  58. //{{AFX_DATA_INIT(Login)
  59. m_psw = _T("");
  60. m_bsave = FALSE;
  61. m_account = _T("");
  62. //}}AFX_DATA_INIT
  63. }
  64. void Login::DoDataExchange(CDataExchange* pDX)
  65. {
  66. CDialog::DoDataExchange(pDX);
  67. //{{AFX_DATA_MAP(Login)
  68. DDX_Control(pDX, IDC_COMBOaccount, m_comboaccount);
  69. DDX_Text(pDX, IDC_EDITpsw, m_psw);
  70. DDX_Check(pDX, IDC_CHECK1, m_bsave);
  71. DDX_CBString(pDX, IDC_COMBOaccount, m_account);
  72. //}}AFX_DATA_MAP
  73. }
  74. BEGIN_MESSAGE_MAP(Login, CDialog)
  75. //{{AFX_MSG_MAP(Login)
  76. ON_WM_PAINT()
  77. //}}AFX_MSG_MAP
  78. END_MESSAGE_MAP()
  79. /////////////////////////////////////////////////////////////////////////////
  80. // Login message handlers
  81. BOOL Login::OnInitDialog()
  82. {
  83. CDialog::OnInitDialog();
  84. // TODO: Add extra initialization here
  85. #if JEFF_TEST_ON
  86. g_sendhead.bsql = 0;
  87. g_sendhead.code[0] = 24;
  88. g_sendhead.code[1] = 29;
  89. g_sendhead.code[2] = 5;
  90. g_sendhead.code[3] = 1;
  91. g_sendhead.code[4] = 171;
  92. if (g_branchname == "")
  93. {
  94. g_sendhead.code[5] = 152;
  95. g_sendhead.tabcount = 6;
  96. }
  97. else
  98. g_sendhead.tabcount = 5;
  99. int g_nYearposTemp = g_nYearpos;
  100. g_nYearpos = -1;
  101. g_pMainWnd->ProcessChatMessageRequest2(";;;;;");
  102. g_nYearpos = g_nYearposTemp;
  103. if (g_bSendOK == 0)
  104. {
  105. CDialog::OnCancel();
  106. return 1;
  107. }
  108. CArray<CStringArray, CStringArray>patharray;
  109. CArray<CStringArray, CStringArray>userarray;
  110. if (g_branchname == "")
  111. DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray, &g_brancharray);
  112. else
  113. DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray);
  114. #else
  115. g_sendhead.bsql = 0;
  116. g_sendhead.code[0] = 23;
  117. g_sendhead.code[1] = 24;
  118. g_sendhead.code[2] = 29;
  119. g_sendhead.code[3] = 5;
  120. g_sendhead.code[4] = 1;
  121. g_sendhead.code[5] = 171;
  122. if (g_branchname == "")
  123. {
  124. g_sendhead.code[6] = 152;
  125. g_sendhead.tabcount = 7;
  126. }
  127. else
  128. g_sendhead.tabcount = 6;
  129. int g_nYearposTemp = g_nYearpos;
  130. g_nYearpos = -1;
  131. g_pMainWnd->ProcessChatMessageRequest2("[dimission]<>'离职' or [dimission] is null;;;;;;");
  132. g_nYearpos = g_nYearposTemp;
  133. if (g_bSendOK == 0)
  134. {
  135. CDialog::OnCancel();
  136. return 1;
  137. }
  138. CArray<CStringArray, CStringArray>patharray;
  139. CArray<CStringArray, CStringArray>userarray;
  140. if (g_branchname == "")
  141. DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray, &g_brancharray);
  142. else
  143. DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_bakstatearray);
  144. #endif
  145. if (g_branchname == "")
  146. {
  147. g_cominfoarraylocal.SetSize(1, 1);
  148. g_cominfoarraylocal.ElementAt(0).Copy(g_cominfoarray.ElementAt(0));
  149. }
  150. CheckBakState();
  151. if (g_branchname == "")
  152. {
  153. g_domain = patharray.ElementAt(0).ElementAt(0);
  154. if (g_domain.Find(".ly.com") == -1)g_domain.Empty();
  155. g_bSaveUploadTask1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(67));
  156. g_bSaveUploadTask2 = atoi(g_cominfoarray.ElementAt(0).ElementAt(68));
  157. g_bSaveUploadTask3 = atoi(g_cominfoarray.ElementAt(0).ElementAt(69));
  158. g_bSaveUploadTask4 = atoi(g_cominfoarray.ElementAt(0).ElementAt(70));
  159. }
  160. CString version = _T("Version 1.0");
  161. BOOL bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(58));
  162. AfxGetApp()->WriteProfileInt(version, "hidewindow2", bHide);
  163. g_userarray.SetSize(userarray.GetSize(), 1);
  164. int count = 0;
  165. for (int ii = 0; ii < userarray.GetSize(); ii++)
  166. {
  167. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  168. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  169. }
  170. g_userarray.SetSize(count, 1);
  171. #ifdef TESTHG
  172. if(0)
  173. #else
  174. // 设置版本号;
  175. CString strVersion;
  176. strVersion.Format("%02d%02d", g_arrFileVersion[2], g_arrFileVersion[3]);
  177. if (g_cominfoarray.ElementAt(0).ElementAt(0) != strVersion)
  178. #endif
  179. {
  180. AfxMessageBox("您必须更新软件才能继续使用, 请与系统管理员联系!", MB_ICONINFORMATION);
  181. CDialog::OnCancel();
  182. g_pMainWnd->AutoUpdate();
  183. return false;
  184. }
  185. #ifndef ENTERPRISE_VERSION
  186. {
  187. #ifndef CHILD_VERSION
  188. #ifdef BASIC_VERSION
  189. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  190. {
  191. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  192. exit(0);return false;
  193. }
  194. #else
  195. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  196. {
  197. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  198. exit(0);return false;
  199. }
  200. #endif
  201. #else
  202. #ifdef BASIC_VERSION
  203. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  204. {
  205. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  206. exit(0);return false;
  207. }
  208. #else
  209. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  210. {
  211. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  212. exit(0);return false;
  213. }
  214. #endif
  215. #endif
  216. }
  217. #else
  218. {
  219. #ifndef CHILD_VERSION
  220. #ifdef BASIC_VERSION
  221. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  222. {
  223. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  224. exit(0);return false;
  225. }
  226. #else
  227. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  228. {
  229. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  230. exit(0);return false;
  231. }
  232. #endif
  233. #else
  234. #ifdef BASIC_VERSION
  235. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  236. {
  237. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  238. exit(0);return false;
  239. }
  240. #else
  241. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  242. {
  243. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  244. exit(0); return false;
  245. }
  246. #endif
  247. #endif
  248. }
  249. #endif
  250. g_title = g_cominfoarray.ElementAt(0).ElementAt(10);
  251. WriteTitle(g_cominfoarray.ElementAt(0).ElementAt(10));
  252. g_date = g_cominfoarray.ElementAt(0).ElementAt(1);
  253. if (g_hisyeararray.GetSize())
  254. {
  255. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  256. }
  257. if (g_brancharray.GetSize() && g_branchname == "")
  258. {
  259. g_pMainWnd->AddBranchMenu(&g_brancharray);
  260. }
  261. if (g_branchname == "")
  262. {
  263. if (g_server == "127.0.0.1")
  264. {
  265. g_sendhead.bsql = 0;
  266. g_sendhead.code[0] = 63;
  267. g_sendhead.tabcount = 1;
  268. g_pMainWnd->ProcessChatMessageRequest2(1);
  269. if (g_bSendOK == 0)
  270. {
  271. CDialog::OnCancel();
  272. return 1;
  273. }
  274. DataToArray(&g_List1array);
  275. g_path1 = g_List1array.ElementAt(0).ElementAt(0) + "\\客户原片(管理软件)$";
  276. g_path2 = g_List1array.ElementAt(0).ElementAt(0) + "\\修好的片(管理软件)$";
  277. g_path3 = g_List1array.ElementAt(0).ElementAt(0) + "\\设计好的片(管理软件)$";
  278. g_path4 = g_List1array.ElementAt(0).ElementAt(0) + "\\精修好的片(管理软件)$";
  279. g_path5 = g_List1array.ElementAt(0).ElementAt(0) + "\\礼服图片(管理软件)$";
  280. g_path6 = g_List1array.ElementAt(0).ElementAt(0) + "\\电话录音(管理软件)$";
  281. g_path7 = g_path1 + "\\效果图";
  282. }
  283. else if (patharray.GetSize())
  284. {
  285. // g_serverbak="PC-110817-VYCJ";
  286. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = g_serverbak;
  287. g_path1 = "\\\\" + g_path1 + "\\客户原片(管理软件)$";
  288. g_path2 = "\\\\" + g_path2 + "\\修好的片(管理软件)$";
  289. g_path3 = "\\\\" + g_path3 + "\\设计好的片(管理软件)$";
  290. g_path4 = "\\\\" + g_path4 + "\\精修好的片(管理软件)$";
  291. g_path5 = "\\\\" + g_path5 + "\\礼服图片(管理软件)$";
  292. g_path6 = "\\\\" + g_path6 + "\\电话录音(管理软件)$";
  293. g_path7 = g_path1 + "\\效果图";
  294. }
  295. g_path1bak = g_path1;
  296. g_path2bak = g_path2;
  297. g_path3bak = g_path3;
  298. g_path4bak = g_path4;
  299. g_path5bak = g_path5;
  300. g_path6bak = g_path6;
  301. g_path7bak = g_path7;
  302. }
  303. try
  304. {
  305. CFile fp;
  306. if (fp.Open(g_mainpath + "\\loginuser.dat", CFile::modeRead))
  307. {
  308. DWORD length = fp.GetLength();
  309. if (!length)
  310. {
  311. fp.Close();
  312. return false;
  313. }
  314. CArchive ar(&fp, CArchive::load);
  315. m_userarray.Serialize(ar);
  316. fp.Close();
  317. for (int i = 0; i < m_userarray.GetSize(); i++)
  318. {
  319. m_comboaccount.AddString(m_userarray.ElementAt(i));
  320. }
  321. if (m_comboaccount.GetCount()>0)
  322. {
  323. m_comboaccount.SetCurSel(0);
  324. m_comboaccount.GetLBText(0, m_account);
  325. }
  326. if (!m_account.IsEmpty())
  327. {
  328. CString version = _T("Version 1.0");
  329. m_psw = AfxGetApp()->GetProfileString(version, _T(m_account));
  330. if (!m_psw.IsEmpty())
  331. m_bsave = TRUE;
  332. }
  333. UpdateData(false);
  334. }
  335. }
  336. catch (...)
  337. {
  338. }
  339. CenterWindow();
  340. return TRUE;
  341. }
  342. CString Login::GetBm(CString &name, CArray<CStringArray, CStringArray>&m_renyuanarray)
  343. {
  344. for (int i = 0; i < m_renyuanarray.GetSize(); i++)
  345. {
  346. if (m_renyuanarray.ElementAt(i).ElementAt(1) == name)
  347. {
  348. return m_renyuanarray.ElementAt(i).ElementAt(2);
  349. }
  350. }
  351. return "";
  352. }
  353. void Login::OnOK()
  354. {
  355. UpdateData();
  356. if (m_account.IsEmpty())
  357. {
  358. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  359. return;
  360. }
  361. #if JEFF_TEST_ON
  362. CString strSQL;
  363. BYTE byPsw[50] = {0};
  364. #ifndef UNICODE
  365. memcpy(byPsw, (LPCSTR)m_psw, m_psw.GetLength());
  366. #endif
  367. CMD5 md5;
  368. md5.SetBYTEText(byPsw, strlen((char*)byPsw));
  369. strSQL.Format(_T("account='%s' and psw='%s'"), m_account, md5.GetMD5Digest());
  370. g_sendhead.bsql = 0;
  371. g_sendhead.code[0] = 23;
  372. g_sendhead.tabcount = 1;
  373. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  374. if (!g_bSendOK)
  375. {
  376. MessageBox(_T("提示"),_T("连接服务器失败"),MB_OK | MB_TOPMOST);
  377. }
  378. m_List1array.RemoveAll();
  379. DataToArray(&m_List1array);
  380. if (m_List1array.GetSize() == 0)
  381. {
  382. AfxMessageBox("账号或密码错误");
  383. return;
  384. }
  385. else
  386. {
  387. g_user.bLongin = 1;
  388. g_user.account = m_account;
  389. g_user.name = m_List1array.ElementAt(0).ElementAt(1);
  390. g_user.rights = m_List1array.ElementAt(0).ElementAt(3);
  391. g_user.rights2 = m_List1array.ElementAt(0).ElementAt(4);
  392. g_user.m_discount = m_List1array.ElementAt(0).ElementAt(5);
  393. g_user.m_discount2 = m_List1array.ElementAt(0).ElementAt(6);
  394. g_user.bm = GetBm(g_user.name, g_userarray);
  395. g_user.level = m_List1array.ElementAt(0).ElementAt(7);
  396. SaveLongin();
  397. WriteLog("登陆系统!", "登陆系统!");
  398. if (g_user.rights2.IsEmpty())
  399. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  400. g_pMainWnd2->RefreshOutlookBar();
  401. CDialog::OnOK();
  402. CString str;
  403. str = "当前用户:" + g_user.name;
  404. #ifndef NEW_SKIN
  405. g_pMainWnd->m_wndStatusBar.SetPaneText(1, str, TRUE);
  406. #endif
  407. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  408. #ifdef TEST_LOCAL
  409. CString sql;
  410. sql = "update path set path1='" + g_server + "',path2='" + g_server + "',path3='" + g_server + "',path4='" + g_server + "'";
  411. g_sendhead.bsql = 1;
  412. g_pMainWnd->ProcessChatMessageRequest2(sql);
  413. CString path1 = "客户原片(管理软件)$";
  414. CString path2 = "修好的片(管理软件)$";
  415. CString path3 = "设计好的片(管理软件)$";
  416. CString path4 = "精修好的片(管理软件)$";
  417. ::CreateDirectory(g_mainpath + "\\" + path1, NULL);
  418. CString temp;
  419. temp.Format("net share %s=%s\\%s", path1, g_mainpath, path1);
  420. WinExec(temp, SW_HIDE);
  421. ::CreateDirectory(g_mainpath + "\\" + path2, NULL);
  422. temp.Format("net share %s=%s\\%s", path2, g_mainpath, path2);
  423. WinExec(temp, SW_HIDE);
  424. ::CreateDirectory(g_mainpath + "\\" + path3, NULL);
  425. temp.Format("net share %s=%s\\%s", path3, g_mainpath, path3);
  426. WinExec(temp, SW_HIDE);
  427. ::CreateDirectory(g_mainpath + "\\" + path4, NULL);
  428. temp.Format("net share %s=%s\\%s", path4, g_mainpath, path4);
  429. WinExec(temp, SW_HIDE);
  430. #endif
  431. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  432. {
  433. DigitalWorkSet2 dlg;
  434. dlg.m_mode = 1;
  435. dlg.m_checkwork = 1;
  436. dlg.DoModal();
  437. }
  438. ///内部消息
  439. str = "%";
  440. str += g_user.name;
  441. str += "%";
  442. CString filter = "[receiver] like '" + str + "'";
  443. g_sendhead.bsql = 0;
  444. g_sendhead.code[0] = 126;
  445. g_sendhead.tabcount = 1;
  446. g_pMainWnd->ProcessChatMessageRequest2(filter);
  447. if (g_bSendOK == 0)return;
  448. DataToArray(&g_List1array);
  449. str = "," + g_user.name + ",";
  450. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  451. {
  452. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  453. receivers2.TrimLeft(",");
  454. receivers2.TrimRight(",");
  455. receivers2 = "," + receivers2 + ",";
  456. if (receivers2.Find(str) != -1)
  457. g_List1array.RemoveAt(i);
  458. }
  459. if (g_List1array.GetSize())
  460. {
  461. ShowMsg dlg;
  462. dlg.DoModal();
  463. }
  464. return;
  465. }
  466. #else
  467. for (int i = 0; i < m_List1array.GetSize(); i++)
  468. {
  469. if (m_account == m_List1array.ElementAt(i).ElementAt(0))
  470. {
  471. #ifdef TESTHG
  472. if(0)
  473. #else
  474. //if(m_psw!=m_List1array.ElementAt(i).ElementAt(2) && m_psw!="xiaozhongbao") // Jeff:被留后门密码了!!!
  475. if (m_psw != m_List1array.ElementAt(i).ElementAt(2))
  476. #endif
  477. {
  478. AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION); return;
  479. }
  480. else
  481. {
  482. g_user.bLongin = 1;
  483. g_user.account = m_account;
  484. g_user.name = m_List1array.ElementAt(i).ElementAt(1);
  485. g_user.rights = m_List1array.ElementAt(i).ElementAt(3);
  486. g_user.rights2 = m_List1array.ElementAt(i).ElementAt(4);
  487. g_user.m_discount = m_List1array.ElementAt(i).ElementAt(5);
  488. g_user.m_discount2 = m_List1array.ElementAt(i).ElementAt(6);
  489. g_user.bm = GetBm(g_user.name, g_userarray);
  490. g_user.level = m_List1array.ElementAt(i).ElementAt(7);
  491. SaveLongin();
  492. WriteLog("登陆系统!", "登陆系统!");
  493. if (g_user.rights2.IsEmpty())
  494. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  495. g_pMainWnd2->RefreshOutlookBar();
  496. CDialog::OnOK();
  497. CString str;
  498. str = "当前用户:" + g_user.name;
  499. #ifndef NEW_SKIN
  500. g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
  501. #endif
  502. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  503. #ifdef TEST_LOCAL
  504. CString sql;
  505. sql= "update path set path1='"+g_server+"',path2='"+g_server+"',path3='"+g_server+"',path4='"+g_server+"'";
  506. g_sendhead.bsql=1;
  507. g_pMainWnd->ProcessChatMessageRequest2(sql);
  508. CString path1="客户原片(管理软件)$";
  509. CString path2="修好的片(管理软件)$";
  510. CString path3="设计好的片(管理软件)$";
  511. CString path4="精修好的片(管理软件)$";
  512. ::CreateDirectory (g_mainpath+"\\"+path1, NULL);
  513. CString temp;
  514. temp.Format ("net share %s=%s\\%s", path1, g_mainpath, path1);
  515. WinExec(temp,SW_HIDE);
  516. ::CreateDirectory (g_mainpath+"\\"+path2, NULL);
  517. temp.Format ("net share %s=%s\\%s", path2, g_mainpath, path2);
  518. WinExec(temp,SW_HIDE);
  519. ::CreateDirectory (g_mainpath+"\\"+path3, NULL);
  520. temp.Format ("net share %s=%s\\%s", path3, g_mainpath, path3);
  521. WinExec(temp,SW_HIDE);
  522. ::CreateDirectory (g_mainpath+"\\"+path4, NULL);
  523. temp.Format ("net share %s=%s\\%s", path4, g_mainpath, path4);
  524. WinExec(temp,SW_HIDE);
  525. #endif
  526. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  527. {
  528. DigitalWorkSet2 dlg;
  529. dlg.m_mode = 1;
  530. dlg.m_checkwork = 1;
  531. dlg.DoModal();
  532. }
  533. ///内部消息
  534. {
  535. CString str;
  536. str = "%";
  537. str += g_user.name;
  538. str += "%";
  539. CString filter = "[receiver] like '" + str + "'";
  540. g_sendhead.bsql = 0;
  541. g_sendhead.code[0] = 126;
  542. g_sendhead.tabcount = 1;
  543. g_pMainWnd->ProcessChatMessageRequest2(filter);
  544. if (g_bSendOK == 0)return;
  545. DataToArray(&g_List1array);
  546. str = "," + g_user.name + ",";
  547. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  548. {
  549. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  550. receivers2.TrimLeft(",");
  551. receivers2.TrimRight(",");
  552. receivers2 = "," + receivers2 + ",";
  553. if (receivers2.Find(str) != -1)
  554. g_List1array.RemoveAt(i);
  555. }
  556. if (g_List1array.GetSize())
  557. {
  558. ShowMsg dlg;
  559. dlg.DoModal();
  560. }
  561. }
  562. return;
  563. }
  564. }
  565. }
  566. AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
  567. #endif
  568. }
  569. void Login::OnCancel()
  570. {
  571. // TODO: Add extra cleanup here
  572. CDialog::OnCancel();
  573. }
  574. void Login::SaveLongin()
  575. {
  576. CString version = _T("Version 1.0");
  577. if (m_bsave)
  578. {
  579. AfxGetApp()->WriteProfileString(version, _T(m_account), m_psw);
  580. }
  581. else
  582. {
  583. AfxGetApp()->WriteProfileString(version, _T(m_account), "");
  584. }
  585. if (m_userarray.GetSize())
  586. {
  587. if (m_userarray.ElementAt(0) != m_account)
  588. {
  589. RemoveExist(m_account);
  590. m_userarray.InsertAt(0, m_account);
  591. if (m_userarray.GetSize() > 30)
  592. m_userarray.SetSize(30);
  593. }
  594. }
  595. else
  596. {
  597. m_userarray.Add(m_account);
  598. }
  599. CFile f;
  600. if (!f.Open(g_mainpath + "\\loginuser.dat", CFile::modeWrite | CFile::modeCreate))return;
  601. CArchive ar(&f, CArchive::store);
  602. m_userarray.Serialize(ar);
  603. ar.Close();
  604. f.Close();
  605. }
  606. void Login::RemoveExist(CString str)
  607. {
  608. for (int i = 0; i < m_userarray.GetSize(); i++)
  609. {
  610. if (str == m_userarray.ElementAt(i))
  611. {
  612. m_userarray.RemoveAt(i);
  613. return;
  614. }
  615. }
  616. }
  617. void Login::OnPaint()
  618. {
  619. CPaintDC dc(this); // device context for painting
  620. // TODO: Add your message handler code here
  621. // Do not call CDialog::OnPaint() for painting messages
  622. }
  623. void Login::CheckBakState()
  624. {
  625. while (g_bakstatearray.GetSize() > 7)
  626. {
  627. g_bakstatearray.RemoveAt(0);
  628. }
  629. int photocount = 0;
  630. int infocount = 0;
  631. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  632. {
  633. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  634. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  635. }
  636. int size = g_bakstatearray.GetSize();
  637. if (size == 0)return;
  638. if (g_bakstatearray.ElementAt(size - 1).ElementAt(1) == "1" && g_bakstatearray.ElementAt(size - 1).ElementAt(2) == "1")
  639. return;
  640. if (infocount>1 || photocount > 2)
  641. {
  642. ShowBakState dlg;
  643. dlg.m_pArray = &g_bakstatearray;
  644. dlg.DoModal();
  645. }
  646. }//部
  647. void Login::SetLiaPath(CString path)
  648. {
  649. }