Login.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  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. BOOL bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(58));
  161. AfxGetApp()->WriteProfileInt(LYFZVERSION, "hidewindow2", bHide);
  162. g_userarray.SetSize(userarray.GetSize(), 1);
  163. int count = 0;
  164. for (int ii = 0; ii < userarray.GetSize(); ii++)
  165. {
  166. if (userarray.ElementAt(ii).ElementAt(10) == "在职")
  167. g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
  168. }
  169. g_userarray.SetSize(count, 1);
  170. #ifdef TESTHG
  171. if(0)
  172. #else
  173. // 设置版本号;
  174. CString strVersion;
  175. strVersion.Format("%02d%02d", g_arrFileVersion[2], g_arrFileVersion[3]);
  176. if (g_cominfoarray.ElementAt(0).ElementAt(0) != strVersion)
  177. #endif
  178. {
  179. AfxMessageBox("您必须更新软件才能继续使用, 请与系统管理员联系!", MB_ICONINFORMATION);
  180. CDialog::OnCancel();
  181. g_pMainWnd->AutoUpdate();
  182. return false;
  183. }
  184. #ifndef ENTERPRISE_VERSION
  185. {
  186. #ifndef CHILD_VERSION
  187. #ifdef BASIC_VERSION
  188. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
  189. {
  190. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  191. exit(0);return false;
  192. }
  193. #else
  194. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
  195. {
  196. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  197. exit(0);return false;
  198. }
  199. #endif
  200. #else
  201. #ifdef BASIC_VERSION
  202. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
  203. {
  204. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  205. exit(0);return false;
  206. }
  207. #else
  208. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
  209. {
  210. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  211. exit(0);return false;
  212. }
  213. #endif
  214. #endif
  215. }
  216. #else
  217. {
  218. #ifndef CHILD_VERSION
  219. #ifdef BASIC_VERSION
  220. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
  221. {
  222. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  223. exit(0);return false;
  224. }
  225. #else
  226. if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
  227. {
  228. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  229. exit(0);return false;
  230. }
  231. #endif
  232. #else
  233. #ifdef BASIC_VERSION
  234. if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
  235. {
  236. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  237. exit(0);return false;
  238. }
  239. #else
  240. if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
  241. {
  242. AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
  243. exit(0); return false;
  244. }
  245. #endif
  246. #endif
  247. }
  248. #endif
  249. g_title = g_cominfoarray.ElementAt(0).ElementAt(10);
  250. WriteTitle(g_cominfoarray.ElementAt(0).ElementAt(10));
  251. g_date = g_cominfoarray.ElementAt(0).ElementAt(1);
  252. if (g_hisyeararray.GetSize())
  253. {
  254. g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
  255. }
  256. if (g_brancharray.GetSize() && g_branchname == "")
  257. {
  258. g_pMainWnd->AddBranchMenu(&g_brancharray);
  259. }
  260. if (g_branchname == "")
  261. {
  262. if (g_server == "127.0.0.1")
  263. {
  264. g_sendhead.bsql = 0;
  265. g_sendhead.code[0] = 63;
  266. g_sendhead.tabcount = 1;
  267. g_pMainWnd->ProcessChatMessageRequest2(1);
  268. if (g_bSendOK == 0)
  269. {
  270. CDialog::OnCancel();
  271. return 1;
  272. }
  273. DataToArray(&g_List1array);
  274. g_path1 = g_List1array.ElementAt(0).ElementAt(0) + "\\客户原片(管理软件)$";
  275. g_path2 = g_List1array.ElementAt(0).ElementAt(0) + "\\修好的片(管理软件)$";
  276. g_path3 = g_List1array.ElementAt(0).ElementAt(0) + "\\设计好的片(管理软件)$";
  277. g_path4 = g_List1array.ElementAt(0).ElementAt(0) + "\\精修好的片(管理软件)$";
  278. g_path5 = g_List1array.ElementAt(0).ElementAt(0) + "\\礼服图片(管理软件)$";
  279. g_path6 = g_List1array.ElementAt(0).ElementAt(0) + "\\电话录音(管理软件)$";
  280. g_path7 = g_path1 + "\\效果图";
  281. }
  282. else if (patharray.GetSize())
  283. {
  284. // g_serverbak="PC-110817-VYCJ";
  285. g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = g_serverbak;
  286. g_path1 = "\\\\" + g_path1 + "\\客户原片(管理软件)$";
  287. g_path2 = "\\\\" + g_path2 + "\\修好的片(管理软件)$";
  288. g_path3 = "\\\\" + g_path3 + "\\设计好的片(管理软件)$";
  289. g_path4 = "\\\\" + g_path4 + "\\精修好的片(管理软件)$";
  290. g_path5 = "\\\\" + g_path5 + "\\礼服图片(管理软件)$";
  291. g_path6 = "\\\\" + g_path6 + "\\电话录音(管理软件)$";
  292. g_path7 = g_path1 + "\\效果图";
  293. }
  294. g_path1bak = g_path1;
  295. g_path2bak = g_path2;
  296. g_path3bak = g_path3;
  297. g_path4bak = g_path4;
  298. g_path5bak = g_path5;
  299. g_path6bak = g_path6;
  300. g_path7bak = g_path7;
  301. }
  302. try
  303. {
  304. CFile fp;
  305. if (fp.Open(g_mainpath + "\\loginuser.dat", CFile::modeRead))
  306. {
  307. DWORD length = fp.GetLength();
  308. if (!length)
  309. {
  310. fp.Close();
  311. return false;
  312. }
  313. CArchive ar(&fp, CArchive::load);
  314. m_userarray.Serialize(ar);
  315. fp.Close();
  316. for (int i = 0; i < m_userarray.GetSize(); i++)
  317. {
  318. m_comboaccount.AddString(m_userarray.ElementAt(i));
  319. }
  320. if (m_comboaccount.GetCount()>0)
  321. {
  322. m_comboaccount.SetCurSel(0);
  323. m_comboaccount.GetLBText(0, m_account);
  324. }
  325. if (!m_account.IsEmpty())
  326. {
  327. m_psw = AfxGetApp()->GetProfileString(LYFZVERSION, _T(m_account));
  328. if (!m_psw.IsEmpty())
  329. m_bsave = TRUE;
  330. }
  331. UpdateData(false);
  332. }
  333. }
  334. catch (...)
  335. {
  336. }
  337. CenterWindow();
  338. return TRUE;
  339. }
  340. CString Login::GetBm(CString &name, CArray<CStringArray, CStringArray>&m_renyuanarray)
  341. {
  342. for (int i = 0; i < m_renyuanarray.GetSize(); i++)
  343. {
  344. if (m_renyuanarray.ElementAt(i).ElementAt(1) == name)
  345. {
  346. return m_renyuanarray.ElementAt(i).ElementAt(2);
  347. }
  348. }
  349. return "";
  350. }
  351. void Login::OnOK()
  352. {
  353. UpdateData();
  354. if (m_account.IsEmpty())
  355. {
  356. AfxMessageBox("资料不全!", MB_ICONINFORMATION);
  357. return;
  358. }
  359. #if JEFF_TEST_ON
  360. CString strSQL;
  361. BYTE byPsw[50] = {0};
  362. #ifndef UNICODE
  363. memcpy(byPsw, (LPCSTR)m_psw, m_psw.GetLength());
  364. #endif
  365. CMD5 md5;
  366. md5.SetBYTEText(byPsw, strlen((char*)byPsw));
  367. strSQL.Format(_T("account='%s' and psw='%s'"), m_account, md5.GetMD5Digest());
  368. g_sendhead.bsql = 0;
  369. g_sendhead.code[0] = 23;
  370. g_sendhead.tabcount = 1;
  371. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  372. if (!g_bSendOK)
  373. {
  374. MessageBox(_T("提示"),_T("连接服务器失败"),MB_OK | MB_TOPMOST);
  375. }
  376. m_List1array.RemoveAll();
  377. DataToArray(&m_List1array);
  378. if (m_List1array.GetSize() == 0)
  379. {
  380. AfxMessageBox("账号或密码错误");
  381. return;
  382. }
  383. else
  384. {
  385. g_user.bLongin = 1;
  386. g_user.account = m_account;
  387. g_user.name = m_List1array.ElementAt(0).ElementAt(1);
  388. g_user.rights = m_List1array.ElementAt(0).ElementAt(3);
  389. g_user.rights2 = m_List1array.ElementAt(0).ElementAt(4);
  390. g_user.m_discount = m_List1array.ElementAt(0).ElementAt(5);
  391. g_user.m_discount2 = m_List1array.ElementAt(0).ElementAt(6);
  392. g_user.bm = GetBm(g_user.name, g_userarray);
  393. g_user.level = m_List1array.ElementAt(0).ElementAt(7);
  394. SaveLongin();
  395. WriteLog("登陆系统!", "登陆系统!");
  396. if (g_user.rights2.IsEmpty())
  397. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  398. g_pMainWnd2->RefreshOutlookBar();
  399. CDialog::OnOK();
  400. CString str;
  401. str = "当前用户:" + g_user.name;
  402. #ifndef NEW_SKIN
  403. g_pMainWnd->m_wndStatusBar.SetPaneText(1, str, TRUE);
  404. #endif
  405. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  406. #ifdef TEST_LOCAL
  407. CString sql;
  408. sql = "update path set path1='" + g_server + "',path2='" + g_server + "',path3='" + g_server + "',path4='" + g_server + "'";
  409. g_sendhead.bsql = 1;
  410. g_pMainWnd->ProcessChatMessageRequest2(sql);
  411. CString path1 = "客户原片(管理软件)$";
  412. CString path2 = "修好的片(管理软件)$";
  413. CString path3 = "设计好的片(管理软件)$";
  414. CString path4 = "精修好的片(管理软件)$";
  415. ::CreateDirectory(g_mainpath + "\\" + path1, NULL);
  416. CString temp;
  417. temp.Format("net share %s=%s\\%s", path1, g_mainpath, path1);
  418. WinExec(temp, SW_HIDE);
  419. ::CreateDirectory(g_mainpath + "\\" + path2, NULL);
  420. temp.Format("net share %s=%s\\%s", path2, g_mainpath, path2);
  421. WinExec(temp, SW_HIDE);
  422. ::CreateDirectory(g_mainpath + "\\" + path3, NULL);
  423. temp.Format("net share %s=%s\\%s", path3, g_mainpath, path3);
  424. WinExec(temp, SW_HIDE);
  425. ::CreateDirectory(g_mainpath + "\\" + path4, NULL);
  426. temp.Format("net share %s=%s\\%s", path4, g_mainpath, path4);
  427. WinExec(temp, SW_HIDE);
  428. #endif
  429. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  430. {
  431. DigitalWorkSet2 dlg;
  432. dlg.m_mode = 1;
  433. dlg.m_checkwork = 1;
  434. dlg.DoModal();
  435. }
  436. ///内部消息
  437. str = "%";
  438. str += g_user.name;
  439. str += "%";
  440. CString filter = "[receiver] like '" + str + "'";
  441. g_sendhead.bsql = 0;
  442. g_sendhead.code[0] = 126;
  443. g_sendhead.tabcount = 1;
  444. g_pMainWnd->ProcessChatMessageRequest2(filter);
  445. if (g_bSendOK == 0)return;
  446. DataToArray(&g_List1array);
  447. str = "," + g_user.name + ",";
  448. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  449. {
  450. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  451. receivers2.TrimLeft(",");
  452. receivers2.TrimRight(",");
  453. receivers2 = "," + receivers2 + ",";
  454. if (receivers2.Find(str) != -1)
  455. g_List1array.RemoveAt(i);
  456. }
  457. if (g_List1array.GetSize())
  458. {
  459. ShowMsg dlg;
  460. dlg.DoModal();
  461. }
  462. return;
  463. }
  464. #else
  465. for (int i = 0; i < m_List1array.GetSize(); i++)
  466. {
  467. if (m_account == m_List1array.ElementAt(i).ElementAt(0))
  468. {
  469. #ifdef TESTHG
  470. if(0)
  471. #else
  472. //if(m_psw!=m_List1array.ElementAt(i).ElementAt(2) && m_psw!="xiaozhongbao") // Jeff:被留后门密码了!!!
  473. if (m_psw != m_List1array.ElementAt(i).ElementAt(2))
  474. #endif
  475. {
  476. AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION); return;
  477. }
  478. else
  479. {
  480. g_user.bLongin = 1;
  481. g_user.account = m_account;
  482. g_user.name = m_List1array.ElementAt(i).ElementAt(1);
  483. g_user.rights = m_List1array.ElementAt(i).ElementAt(3);
  484. g_user.rights2 = m_List1array.ElementAt(i).ElementAt(4);
  485. g_user.m_discount = m_List1array.ElementAt(i).ElementAt(5);
  486. g_user.m_discount2 = m_List1array.ElementAt(i).ElementAt(6);
  487. g_user.bm = GetBm(g_user.name, g_userarray);
  488. g_user.level = m_List1array.ElementAt(i).ElementAt(7);
  489. SaveLongin();
  490. WriteLog("登陆系统!", "登陆系统!");
  491. if (g_user.rights2.IsEmpty())
  492. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  493. g_pMainWnd2->RefreshOutlookBar();
  494. CDialog::OnOK();
  495. CString str;
  496. str = "当前用户:" + g_user.name;
  497. #ifndef NEW_SKIN
  498. g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
  499. #endif
  500. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  501. #ifdef TEST_LOCAL
  502. CString sql;
  503. sql= "update path set path1='"+g_server+"',path2='"+g_server+"',path3='"+g_server+"',path4='"+g_server+"'";
  504. g_sendhead.bsql=1;
  505. g_pMainWnd->ProcessChatMessageRequest2(sql);
  506. CString path1="客户原片(管理软件)$";
  507. CString path2="修好的片(管理软件)$";
  508. CString path3="设计好的片(管理软件)$";
  509. CString path4="精修好的片(管理软件)$";
  510. ::CreateDirectory (g_mainpath+"\\"+path1, NULL);
  511. CString temp;
  512. temp.Format ("net share %s=%s\\%s", path1, g_mainpath, path1);
  513. WinExec(temp,SW_HIDE);
  514. ::CreateDirectory (g_mainpath+"\\"+path2, NULL);
  515. temp.Format ("net share %s=%s\\%s", path2, g_mainpath, path2);
  516. WinExec(temp,SW_HIDE);
  517. ::CreateDirectory (g_mainpath+"\\"+path3, NULL);
  518. temp.Format ("net share %s=%s\\%s", path3, g_mainpath, path3);
  519. WinExec(temp,SW_HIDE);
  520. ::CreateDirectory (g_mainpath+"\\"+path4, NULL);
  521. temp.Format ("net share %s=%s\\%s", path4, g_mainpath, path4);
  522. WinExec(temp,SW_HIDE);
  523. #endif
  524. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  525. {
  526. DigitalWorkSet2 dlg;
  527. dlg.m_mode = 1;
  528. dlg.m_checkwork = 1;
  529. dlg.DoModal();
  530. }
  531. ///内部消息
  532. {
  533. CString str;
  534. str = "%";
  535. str += g_user.name;
  536. str += "%";
  537. CString filter = "[receiver] like '" + str + "'";
  538. g_sendhead.bsql = 0;
  539. g_sendhead.code[0] = 126;
  540. g_sendhead.tabcount = 1;
  541. g_pMainWnd->ProcessChatMessageRequest2(filter);
  542. if (g_bSendOK == 0)return;
  543. DataToArray(&g_List1array);
  544. str = "," + g_user.name + ",";
  545. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  546. {
  547. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  548. receivers2.TrimLeft(",");
  549. receivers2.TrimRight(",");
  550. receivers2 = "," + receivers2 + ",";
  551. if (receivers2.Find(str) != -1)
  552. g_List1array.RemoveAt(i);
  553. }
  554. if (g_List1array.GetSize())
  555. {
  556. ShowMsg dlg;
  557. dlg.DoModal();
  558. }
  559. }
  560. return;
  561. }
  562. }
  563. }
  564. AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
  565. #endif
  566. }
  567. void Login::OnCancel()
  568. {
  569. // TODO: Add extra cleanup here
  570. CDialog::OnCancel();
  571. }
  572. void Login::SaveLongin()
  573. {
  574. if (m_bsave)
  575. {
  576. AfxGetApp()->WriteProfileString(LYFZVERSION, _T(m_account), m_psw);
  577. }
  578. else
  579. {
  580. AfxGetApp()->WriteProfileString(LYFZVERSION, _T(m_account), "");
  581. }
  582. if (m_userarray.GetSize())
  583. {
  584. if (m_userarray.ElementAt(0) != m_account)
  585. {
  586. RemoveExist(m_account);
  587. m_userarray.InsertAt(0, m_account);
  588. if (m_userarray.GetSize() > 30)
  589. m_userarray.SetSize(30);
  590. }
  591. }
  592. else
  593. {
  594. m_userarray.Add(m_account);
  595. }
  596. CFile f;
  597. if (!f.Open(g_mainpath + "\\loginuser.dat", CFile::modeWrite | CFile::modeCreate))return;
  598. CArchive ar(&f, CArchive::store);
  599. m_userarray.Serialize(ar);
  600. ar.Close();
  601. f.Close();
  602. }
  603. void Login::RemoveExist(CString str)
  604. {
  605. for (int i = 0; i < m_userarray.GetSize(); i++)
  606. {
  607. if (str == m_userarray.ElementAt(i))
  608. {
  609. m_userarray.RemoveAt(i);
  610. return;
  611. }
  612. }
  613. }
  614. void Login::OnPaint()
  615. {
  616. CPaintDC dc(this); // device context for painting
  617. // TODO: Add your message handler code here
  618. // Do not call CDialog::OnPaint() for painting messages
  619. }
  620. void Login::CheckBakState()
  621. {
  622. while (g_bakstatearray.GetSize() > 7)
  623. {
  624. g_bakstatearray.RemoveAt(0);
  625. }
  626. int photocount = 0;
  627. int infocount = 0;
  628. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  629. {
  630. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  631. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  632. }
  633. int size = g_bakstatearray.GetSize();
  634. if (size == 0)return;
  635. if (g_bakstatearray.ElementAt(size - 1).ElementAt(1) == "1" && g_bakstatearray.ElementAt(size - 1).ElementAt(2) == "1")
  636. return;
  637. if (infocount>1 || photocount > 2)
  638. {
  639. ShowBakState dlg;
  640. dlg.m_pArray = &g_bakstatearray;
  641. dlg.DoModal();
  642. }
  643. }//部
  644. void Login::SetLiaPath(CString path)
  645. {
  646. }