Login.cpp 19 KB

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