Login.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  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. WORD 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. #if 0
  175. if(g_cominfoarray.ElementAt(0).ElementAt(0)!="629")
  176. #else
  177. CString strVersion;
  178. strVersion.Format("%d%d", 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. strSQL.Format("account='%s' and psw='%s'", m_account, m_psw);
  372. g_sendhead.bsql = 0;
  373. g_sendhead.code[0] = 23;
  374. g_sendhead.tabcount = 1;
  375. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  376. //AfxMessageBox("Jeff:Ok");
  377. //CArray<CStringArray, CStringArray> arryOfAccountInfo;
  378. if (!g_bSendOK)
  379. {
  380. AfxMessageBox("连接服务器失败");
  381. }
  382. m_List1array.RemoveAll();
  383. DataToArray(&m_List1array);
  384. if (m_List1array.GetSize() == 0)
  385. {
  386. AfxMessageBox("账号或密码错误");
  387. return;
  388. }
  389. else
  390. {
  391. g_user.bLongin = 1;
  392. g_user.account = m_account;
  393. g_user.name = m_List1array.ElementAt(0).ElementAt(1);
  394. g_user.rights = m_List1array.ElementAt(0).ElementAt(3);
  395. g_user.rights2 = m_List1array.ElementAt(0).ElementAt(4);
  396. g_user.m_discount = m_List1array.ElementAt(0).ElementAt(5);
  397. g_user.m_discount2 = m_List1array.ElementAt(0).ElementAt(6);
  398. g_user.bm = GetBm(g_user.name, g_userarray);
  399. g_user.level = m_List1array.ElementAt(0).ElementAt(7);
  400. SaveLongin();
  401. WriteLog("登陆系统!");
  402. if (g_user.rights2.IsEmpty())
  403. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  404. g_pMainWnd2->RefreshOutlookBar();
  405. CDialog::OnOK();
  406. CString str;
  407. str = "当前用户:" + g_user.name;
  408. #ifndef NEW_SKIN
  409. g_pMainWnd->m_wndStatusBar.SetPaneText(1, str, TRUE);
  410. #endif
  411. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  412. #ifdef TEST_LOCAL
  413. CString sql;
  414. sql = "update path set path1='" + g_server + "',path2='" + g_server + "',path3='" + g_server + "',path4='" + g_server + "'";
  415. g_sendhead.bsql = 1;
  416. g_pMainWnd->ProcessChatMessageRequest2(sql);
  417. CString path1 = "客户原片(管理软件)$";
  418. CString path2 = "修好的片(管理软件)$";
  419. CString path3 = "设计好的片(管理软件)$";
  420. CString path4 = "精修好的片(管理软件)$";
  421. ::CreateDirectory(g_mainpath + "\\" + path1, NULL);
  422. CString temp;
  423. temp.Format("net share %s=%s\\%s", path1, g_mainpath, path1);
  424. WinExec(temp, SW_HIDE);
  425. ::CreateDirectory(g_mainpath + "\\" + path2, NULL);
  426. temp.Format("net share %s=%s\\%s", path2, g_mainpath, path2);
  427. WinExec(temp, SW_HIDE);
  428. ::CreateDirectory(g_mainpath + "\\" + path3, NULL);
  429. temp.Format("net share %s=%s\\%s", path3, g_mainpath, path3);
  430. WinExec(temp, SW_HIDE);
  431. ::CreateDirectory(g_mainpath + "\\" + path4, NULL);
  432. temp.Format("net share %s=%s\\%s", path4, g_mainpath, path4);
  433. WinExec(temp, SW_HIDE);
  434. #endif
  435. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  436. {
  437. DigitalWorkSet2 dlg;
  438. dlg.m_mode = 1;
  439. dlg.m_checkwork = 1;
  440. dlg.DoModal();
  441. }
  442. ///内部消息
  443. str = "%";
  444. str += g_user.name;
  445. str += "%";
  446. CString filter = "[receiver] like '" + str + "'";
  447. g_sendhead.bsql = 0;
  448. g_sendhead.code[0] = 126;
  449. g_sendhead.tabcount = 1;
  450. g_pMainWnd->ProcessChatMessageRequest2(filter);
  451. if (g_bSendOK == 0)return;
  452. DataToArray(&g_List1array);
  453. str = "," + g_user.name + ",";
  454. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  455. {
  456. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  457. receivers2.TrimLeft(",");
  458. receivers2.TrimRight(",");
  459. receivers2 = "," + receivers2 + ",";
  460. if (receivers2.Find(str) != -1)
  461. g_List1array.RemoveAt(i);
  462. }
  463. if (g_List1array.GetSize())
  464. {
  465. ShowMsg dlg;
  466. dlg.DoModal();
  467. }
  468. return;
  469. }
  470. #else
  471. for (int i = 0; i < m_List1array.GetSize(); i++)
  472. {
  473. if (m_account == m_List1array.ElementAt(i).ElementAt(0))
  474. {
  475. #ifdef TESTHG
  476. if(0)
  477. #else
  478. //if(m_psw!=m_List1array.ElementAt(i).ElementAt(2) && m_psw!="xiaozhongbao") // Jeff:被留后门密码了!!!
  479. if (m_psw != m_List1array.ElementAt(i).ElementAt(2))
  480. #endif
  481. {
  482. AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION); return;
  483. }
  484. else
  485. {
  486. g_user.bLongin = 1;
  487. g_user.account = m_account;
  488. g_user.name = m_List1array.ElementAt(i).ElementAt(1);
  489. g_user.rights = m_List1array.ElementAt(i).ElementAt(3);
  490. g_user.rights2 = m_List1array.ElementAt(i).ElementAt(4);
  491. g_user.m_discount = m_List1array.ElementAt(i).ElementAt(5);
  492. g_user.m_discount2 = m_List1array.ElementAt(i).ElementAt(6);
  493. g_user.bm = GetBm(g_user.name, g_userarray);
  494. g_user.level = m_List1array.ElementAt(i).ElementAt(7);
  495. SaveLongin();
  496. WriteLog("登陆系统!");
  497. if (g_user.rights2.IsEmpty())
  498. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  499. g_pMainWnd2->RefreshOutlookBar();
  500. CDialog::OnOK();
  501. CString str;
  502. str = "当前用户:" + g_user.name;
  503. #ifndef NEW_SKIN
  504. g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
  505. #endif
  506. if (g_pMainWnd2)g_pMainWnd2->DrawLogin();
  507. #ifdef TEST_LOCAL
  508. CString sql;
  509. sql= "update path set path1='"+g_server+"',path2='"+g_server+"',path3='"+g_server+"',path4='"+g_server+"'";
  510. g_sendhead.bsql=1;
  511. g_pMainWnd->ProcessChatMessageRequest2(sql);
  512. CString path1="客户原片(管理软件)$";
  513. CString path2="修好的片(管理软件)$";
  514. CString path3="设计好的片(管理软件)$";
  515. CString path4="精修好的片(管理软件)$";
  516. ::CreateDirectory (g_mainpath+"\\"+path1, NULL);
  517. CString temp;
  518. temp.Format ("net share %s=%s\\%s", path1, g_mainpath, path1);
  519. WinExec(temp,SW_HIDE);
  520. ::CreateDirectory (g_mainpath+"\\"+path2, NULL);
  521. temp.Format ("net share %s=%s\\%s", path2, g_mainpath, path2);
  522. WinExec(temp,SW_HIDE);
  523. ::CreateDirectory (g_mainpath+"\\"+path3, NULL);
  524. temp.Format ("net share %s=%s\\%s", path3, g_mainpath, path3);
  525. WinExec(temp,SW_HIDE);
  526. ::CreateDirectory (g_mainpath+"\\"+path4, NULL);
  527. temp.Format ("net share %s=%s\\%s", path4, g_mainpath, path4);
  528. WinExec(temp,SW_HIDE);
  529. #endif
  530. if (1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部")
  531. {
  532. DigitalWorkSet2 dlg;
  533. dlg.m_mode = 1;
  534. dlg.m_checkwork = 1;
  535. dlg.DoModal();
  536. }
  537. ///内部消息
  538. {
  539. CString str;
  540. str = "%";
  541. str += g_user.name;
  542. str += "%";
  543. CString filter = "[receiver] like '" + str + "'";
  544. g_sendhead.bsql = 0;
  545. g_sendhead.code[0] = 126;
  546. g_sendhead.tabcount = 1;
  547. g_pMainWnd->ProcessChatMessageRequest2(filter);
  548. if (g_bSendOK == 0)return;
  549. DataToArray(&g_List1array);
  550. str = "," + g_user.name + ",";
  551. for (int i = g_List1array.GetSize() - 1; i >= 0; i--)
  552. {
  553. CString receivers2 = g_List1array.ElementAt(i).ElementAt(4);
  554. receivers2.TrimLeft(",");
  555. receivers2.TrimRight(",");
  556. receivers2 = "," + receivers2 + ",";
  557. if (receivers2.Find(str) != -1)
  558. g_List1array.RemoveAt(i);
  559. }
  560. if (g_List1array.GetSize())
  561. {
  562. ShowMsg dlg;
  563. dlg.DoModal();
  564. }
  565. }
  566. return;
  567. }
  568. }
  569. }
  570. AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
  571. #endif
  572. }
  573. void Login::OnCancel()
  574. {
  575. // TODO: Add extra cleanup here
  576. CDialog::OnCancel();
  577. }
  578. void Login::SaveLongin()
  579. {
  580. CString version = _T("Version 1.0");
  581. if (m_bsave)
  582. {
  583. AfxGetApp()->WriteProfileString(version, _T(m_account), m_psw);
  584. }
  585. else
  586. {
  587. AfxGetApp()->WriteProfileString(version, _T(m_account), "");
  588. }
  589. if (m_userarray.GetSize())
  590. {
  591. if (m_userarray.ElementAt(0) != m_account)
  592. {
  593. RemoveExist(m_account);
  594. m_userarray.InsertAt(0, m_account);
  595. if (m_userarray.GetSize() > 30)
  596. m_userarray.SetSize(30);
  597. }
  598. }
  599. else
  600. {
  601. m_userarray.Add(m_account);
  602. }
  603. CFile f;
  604. if (!f.Open(g_mainpath + "\\loginuser.dat", CFile::modeWrite | CFile::modeCreate))return;
  605. CArchive ar(&f, CArchive::store);
  606. m_userarray.Serialize(ar);
  607. ar.Close();
  608. f.Close();
  609. }
  610. void Login::RemoveExist(CString str)
  611. {
  612. for (int i = 0; i < m_userarray.GetSize(); i++)
  613. {
  614. if (str == m_userarray.ElementAt(i))
  615. {
  616. m_userarray.RemoveAt(i);
  617. return;
  618. }
  619. }
  620. }
  621. void Login::OnPaint()
  622. {
  623. CPaintDC dc(this); // device context for painting
  624. // TODO: Add your message handler code here
  625. // Do not call CDialog::OnPaint() for painting messages
  626. }
  627. void Login::CheckBakState()
  628. {
  629. while (g_bakstatearray.GetSize() > 7)
  630. {
  631. g_bakstatearray.RemoveAt(0);
  632. }
  633. int photocount = 0;
  634. int infocount = 0;
  635. for (int i = 0; i < g_bakstatearray.GetSize(); i++)
  636. {
  637. if (g_bakstatearray.ElementAt(i).ElementAt(1) != "1")photocount++;
  638. if (g_bakstatearray.ElementAt(i).ElementAt(2) != "1")infocount++;
  639. }
  640. int size = g_bakstatearray.GetSize();
  641. if (size == 0)return;
  642. if (g_bakstatearray.ElementAt(size - 1).ElementAt(1) == "1" && g_bakstatearray.ElementAt(size - 1).ElementAt(2) == "1")
  643. return;
  644. if (infocount>1 || photocount > 2)
  645. {
  646. ShowBakState dlg;
  647. dlg.m_pArray = &g_bakstatearray;
  648. dlg.DoModal();
  649. }
  650. }//部
  651. void Login::SetLiaPath(CString path)
  652. {
  653. }