123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- // ChoosePhotoSkin.cpp: implementation of the ChoosePhotoSkin class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "YLGL.h"
- #include "ChoosePhotoSkin.h"
- #include "SearchClient.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- ChoosePhotoSkin::ChoosePhotoSkin()
- {
- m_mode = 0;
- m_exitcode = 0;
- m_bsave = 0;
- g_pMainWnd->GetSkin();
- }
- ChoosePhotoSkin::~ChoosePhotoSkin()
- {
- }
- void ChoosePhotoSkin::OnFSCommand(LPCTSTR command, LPCTSTR args)
- {
- }
- void ChoosePhotoSkin::Init()
- {
- g_bInSkin = 1;
- if (1)//g_bRedSkin)
- {
- Graphics graph(m_pBk);
- Image *img = NULL;
- if (m_mode == 0)
- ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\选片.jpg");
- else
- ::LoadImageFromBuf(&img, g_mainpath + "\\图片\\看设计.jpg");
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(img, 0, 0);
- delete img;
- ((MyBmpButton2*)m_picarray.ElementAt(5))->EnableWindow(0);
- ((MyBmpButton2*)m_picarray.ElementAt(6))->EnableWindow(0);
- ((MyBmpButton2*)m_picarray.ElementAt(7))->EnableWindow(0);
- }
- else
- {
- Graphics graph(m_pBk);
- Image *img = NULL;
- if (m_mode == 0)
- ::LoadImageFromBuf(&img, g_mainpath + "\\skin\\标题-选片.jpg");
- else
- ::LoadImageFromBuf(&img, g_mainpath + "\\skin\\标题-看设计.jpg");
- graph.SetSmoothingMode(SmoothingModeHighQuality);
- graph.DrawImage(img, 0, 0);
- delete img; ((MyBmpButton2*)m_picarray.ElementAt(5))->ShowWindow(SW_HIDE);
- }
- m_combobox.Create(WS_VSCROLL | WS_CHILD | CBS_DROPDOWN, m_rcarray.ElementAt(2), this, 100);
- m_combobox.ShowWindow(SW_SHOW);
- CRect rc = m_rcarray.ElementAt(2);
- rc.bottom += 200;
- m_combobox.MoveWindow(rc);
- m_combobox.GetWindowRect(rc);
- int hei = rc.Height();
- rc = m_rcarray.ElementAt(3);
- rc.bottom = rc.top + hei + 5;
- m_edit.Create(ES_AUTOHSCROLL | WS_CHILD | ES_LEFT | WS_BORDER | ES_PASSWORD | WS_EX_WINDOWEDGE, rc, this, 200);
- m_edit.ShowWindow(SW_SHOW);
- rc = m_rcarray.ElementAt(4);
- rc.bottom = rc.top + 13;
- rc.right = rc.left + 13;
- m_button.Create("", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_FLAT, rc, this, 300);
- tpFont.CreatePointFont(180, _T("黑体"));
- m_edit.SetFont(&tpFont);
- m_combobox.SetFont(&tpFont);
- /////////////////////////
- #if JEFF_TEST_ON
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 24;
- g_sendhead.code[1] = 29;
- g_sendhead.code[2] = 5;
- g_sendhead.code[3] = 1;
- if (g_branchname == "")
- {
- g_sendhead.code[4] = 152;
- g_sendhead.tabcount = 5;
- }
- else
- g_sendhead.tabcount = 4;
- int g_nYearposTemp = g_nYearpos;
- g_nYearpos = -1;
- g_pMainWnd->ProcessChatMessageRequest2(";;;;;");
- g_nYearpos = g_nYearposTemp;
- if (g_bSendOK == 0)
- {
- CDialog::OnCancel();
- return;
- }
- CArray<CStringArray, CStringArray>patharray;
- CArray<CStringArray, CStringArray>userarray;
- if (g_branchname == "")
- DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_brancharray);
- else
- DataToArray( &g_cominfoarray, &patharray, &userarray, &g_hisyeararray);
- #else
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 23;
- g_sendhead.code[1] = 24;
- g_sendhead.code[2] = 29;
- g_sendhead.code[3] = 5;
- g_sendhead.code[4] = 1;
- if (g_branchname == "")
- {
- g_sendhead.code[5] = 152;
- g_sendhead.tabcount = 6;
- }
- else
- g_sendhead.tabcount = 5;
- int g_nYearposTemp = g_nYearpos;
- g_nYearpos = -1;
- g_pMainWnd->ProcessChatMessageRequest2("[dimission]<>'离职' or [dimission] is null;;;;;;");
- g_nYearpos = g_nYearposTemp;
- if (g_bSendOK == 0)
- {
- CDialog::OnCancel();
- return;
- }
- CArray<CStringArray, CStringArray>patharray;
- CArray<CStringArray, CStringArray>userarray;
- if (g_branchname == "")
- DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray, &g_brancharray);
- else
- DataToArray(&m_List1array, &g_cominfoarray, &patharray, &userarray, &g_hisyeararray);
- #endif
- if (g_branchname == "")
- {
- g_cominfoarraylocal.SetSize(1, 1);
- g_cominfoarraylocal.ElementAt(0).Copy(g_cominfoarray.ElementAt(0));
- }
- if (g_branchname == "")
- {
- g_domain = patharray.ElementAt(0).ElementAt(0);
- if (g_domain.Find(".ly.com") == -1)g_domain.Empty();
- g_bSaveUploadTask1 = atoi(g_cominfoarray.ElementAt(0).ElementAt(67));
- g_bSaveUploadTask2 = atoi(g_cominfoarray.ElementAt(0).ElementAt(68));
- g_bSaveUploadTask3 = atoi(g_cominfoarray.ElementAt(0).ElementAt(69));
- g_bSaveUploadTask4 = atoi(g_cominfoarray.ElementAt(0).ElementAt(70));
- }
- BOOL bHide = atoi(g_cominfoarray.ElementAt(0).ElementAt(58));
- AfxGetApp()->WriteProfileInt(LYFZVERSION, "hidewindow2", bHide);
- g_userarray.SetSize(userarray.GetSize(), 1);
- int count = 0;
- for (int ii = 0; ii < userarray.GetSize(); ii++)
- {
- if (userarray.ElementAt(ii).ElementAt(10) == "在职")
- g_userarray.ElementAt(count++).Copy(userarray.ElementAt(ii));
- }
- g_userarray.SetSize(count, 1);
- // 设置版本号;
- CString strVersion;
- strVersion.Format("%02d%02d", g_arrFileVersion[2], g_arrFileVersion[3]);
- if (g_cominfoarray.ElementAt(0).ElementAt(0) != strVersion)
- {
- AfxMessageBox("您必须更新软件才能继续使用, 请与系统管理员联系!", MB_ICONINFORMATION);
- CDialog::OnCancel();
- g_pMainWnd->AutoUpdate();
- return;
- }
- #ifndef ENTERPRISE_VERSION
- {
- #ifndef CHILD_VERSION
- #ifdef BASIC_VERSION
- if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="0")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0);return;
- }
- #else
- if(g_cominfoarray.ElementAt(0).ElementAt(46)!="1")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0);return;
- }
- #endif
- #else
- #ifdef BASIC_VERSION
- if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="2")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0);return;
- }
- #else
- if(g_cominfoarray.ElementAt(0).ElementAt(46)!="3")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0);return;
- }
- #endif
- #endif
- }
- #else
- {
- #ifndef CHILD_VERSION
- #ifdef BASIC_VERSION
- if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="4")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0);return;
- }
- #else
- if(g_cominfoarray.ElementAt(0).ElementAt(46)!="5")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0);return;
- }
- #endif
- #else
- #ifdef BASIC_VERSION
- if(g_cominfoarray.ElementAt(0).ElementAt( 46)!="6")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0);return;
- }
- #else
- if (g_cominfoarray.ElementAt(0).ElementAt(46) != "7")
- {
- AfxMessageBox("软件客户端与服务器版本不匹配, 请与系统管理员联系!", MB_ICONSTOP);
- exit(0); return;
- }
- #endif
- #endif
- }
- #endif
- g_title = g_cominfoarray.ElementAt(0).ElementAt(10);
- WriteTitle(g_cominfoarray.ElementAt(0).ElementAt(10));
- g_date = g_cominfoarray.ElementAt(0).ElementAt(1);
- if (g_hisyeararray.GetSize())
- {
- g_pMainWnd->AddHistoryMenu(&g_hisyeararray);
- }
- if (g_brancharray.GetSize() && g_branchname == "")
- {
- g_pMainWnd->AddBranchMenu(&g_brancharray);
- }
- if (g_branchname == "")
- {
- if (g_server == "127.0.0.1")
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 63;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- if (g_bSendOK == 0)
- {
- CDialog::OnCancel();
- return;
- }
- DataToArray(&g_List1array);
- g_path1 = g_List1array.ElementAt(0).ElementAt(0) + "\\客户原片(管理软件)$";
- g_path2 = g_List1array.ElementAt(0).ElementAt(0) + "\\修好的片(管理软件)$";
- g_path3 = g_List1array.ElementAt(0).ElementAt(0) + "\\设计好的片(管理软件)$";
- g_path4 = g_List1array.ElementAt(0).ElementAt(0) + "\\精修好的片(管理软件)$";
- g_path5 = g_List1array.ElementAt(0).ElementAt(0) + "\\礼服图片(管理软件)$";
- g_path6 = g_List1array.ElementAt(0).ElementAt(0) + "\\电话录音(管理软件)$";
- g_path7 = g_path1 + "\\效果图";
- }
- else if (patharray.GetSize())
- {
- g_path1 = g_path2 = g_path3 = g_path4 = g_path5 = g_path6 = g_path7 = g_serverbak;
- g_path1 = "\\\\" + g_path1 + "\\客户原片(管理软件)$";
- g_path2 = "\\\\" + g_path2 + "\\修好的片(管理软件)$";
- g_path3 = "\\\\" + g_path3 + "\\设计好的片(管理软件)$";
- g_path4 = "\\\\" + g_path4 + "\\精修好的片(管理软件)$";
- g_path5 = "\\\\" + g_path5 + "\\礼服图片(管理软件)$";
- g_path6 = "\\\\" + g_path6 + "\\电话录音(管理软件)$";
- g_path7 = g_path1 + "\\效果图";
- }
- g_path1bak = g_path1;
- g_path2bak = g_path2;
- g_path3bak = g_path3;
- g_path4bak = g_path4;
- g_path5bak = g_path5;
- g_path6bak = g_path6;
- g_path7bak = g_path7;
- }
- try
- {
- CFile fp;
- if (fp.Open(g_mainpath + "\\loginuser.dat", CFile::modeRead))
- {
- DWORD length = fp.GetLength();
- if (!length)return;
- CArchive ar(&fp, CArchive::load);
- m_userarray.Serialize(ar);
- fp.Close();
- for (int i = 0; i < m_userarray.GetSize(); i++)
- {
- m_combobox.AddString(m_userarray.ElementAt(i));
- }
- if (m_combobox.GetCount()>0)
- {
- m_combobox.SetCurSel(0);
- m_combobox.GetLBText(0, m_account);
- }
- if (!m_account.IsEmpty())
- {
- m_psw = AfxGetApp()->GetProfileString(LYFZVERSION, _T(m_account));
- if (!m_psw.IsEmpty())
- m_bsave = TRUE;
- }
- // SetDlgItemText(100, m_account);
- SetDlgItemText(200, m_psw);
- m_button.SetCheck(m_bsave);
- }
- }
- catch (...)
- {
- }
- }
- void ChoosePhotoSkin::Destory()
- {
- }
- void ChoosePhotoSkin::BtnClick(WPARAM wParam, LPARAM lParam)
- {
- int id = lParam;
- id -= 99;
- switch (id)
- {
- case 1:
- {
- #if JEFF_TEST_ON
- m_combobox.GetWindowText(m_account);
- // GetDlgItemText(100, m_account);
- GetDlgItemText(200, m_psw);
- m_bsave = m_button.GetCheck();
- if (m_account.IsEmpty())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- CString strSQL;
- BYTE byPsw[50] = {0};
- #ifndef UNICODE
- memcpy(byPsw, (LPCSTR)m_psw, m_psw.GetLength());
- #endif
- CMD5 md5;
- md5.SetBYTEText(byPsw, strlen((char*)byPsw));
- strSQL.Format(_T("account='%s' and psw='%s'"), m_account, md5.GetMD5Digest());
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 23;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(strSQL);
- //CArray<CStringArray, CStringArray> arryOfAccountInfo;
- if (!g_bSendOK)
- {
- MessageBox(_T("提示"),_T("连接服务器失败"),MB_OK | MB_TOPMOST);
- }
- m_List1array.RemoveAll();
- DataToArray(&m_List1array);
- if (m_List1array.GetSize() == 0)
- {
- //AfxMessageBox("账号或密码错误");
- MessageBox(_T("提示"),_T("账号或密码错误"),MB_OK | MB_TOPMOST);
- return;
- }
- else
- {
- g_user.bLongin = 1;
- g_user.account = m_account;
- g_user.name = m_List1array.ElementAt(0).ElementAt(1);
- g_user.rights = m_List1array.ElementAt(0).ElementAt(3);
- g_user.rights2 = m_List1array.ElementAt(0).ElementAt(4);
- g_user.m_discount = m_List1array.ElementAt(0).ElementAt(5);
- g_user.m_discount2 = m_List1array.ElementAt(0).ElementAt(6);
- g_user.level = m_List1array.ElementAt(0).ElementAt(7);
- SaveLongin();
- g_pMainWnd2->RefreshOutlookBar();
- CString str;
- str = "当前用户:" + g_user.name;
- #ifndef NEW_SKIN
- g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
- #endif
- SearchClient dlg;
- dlg.m_mode = m_mode;
- dlg.SetLiaPath("2.lia");
- if (dlg.DoModal() != IDOK)
- return;
- m_exitcode = dlg.m_exitcode;
- CDialog::OnOK();
- return;
- }
- #else
- m_combobox.GetWindowText(m_account);
- // GetDlgItemText(100, m_account);
- GetDlgItemText(200, m_psw);
- m_bsave = m_button.GetCheck();
- if (m_account.IsEmpty())
- {
- AfxMessageBox("资料不全!", MB_ICONINFORMATION);
- return;
- }
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (m_account == m_List1array.ElementAt(i).ElementAt(0))
- {
- if (m_psw != m_List1array.ElementAt(i).ElementAt(2))
- {
- AfxMessageBox("密码错误, 请重新输入!", MB_ICONINFORMATION); return;
- }
- else
- {
- g_user.bLongin = 1;
- g_user.account = m_account;
- g_user.name = m_List1array.ElementAt(i).ElementAt(1);
- g_user.rights = m_List1array.ElementAt(i).ElementAt(3);
- g_user.rights2 = m_List1array.ElementAt(i).ElementAt(4);
- g_user.m_discount = m_List1array.ElementAt(i).ElementAt(5);
- g_user.m_discount2 = m_List1array.ElementAt(i).ElementAt(6);
- g_user.level = m_List1array.ElementAt(i).ElementAt(7);
- // g_user.bm=GetBm(g_user.name,g_userarray);
- SaveLongin();
- g_pMainWnd2->RefreshOutlookBar();
- CString str;
- str = "当前用户:" + g_user.name;
- #ifndef NEW_SKIN
- g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE);
- #endif
- SearchClient dlg;
- dlg.m_mode = m_mode;
- dlg.SetLiaPath("2.lia");
- if (dlg.DoModal() != IDOK)
- return;
- m_exitcode = dlg.m_exitcode;
- CDialog::OnOK();
- return;
- }
- }
- }
- AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION);
- #endif
- }
- break;
- case 2:
- CDialog::OnCancel();
- break;
- }
- }
- BOOL ChoosePhotoSkin::PreTransMsg(MSG* pMsg)
- {
- if (pMsg->message == WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_F2:
- if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
- if (m_mode)
- m_exitcode = 2;
- CDialog::OnOK();
- return 1;
- case VK_F3:
- if (g_pMainWnd->m_bCheckF2F3 && (g_pMainWnd->IsShiftDown() == 0 || g_pMainWnd->IsCtrlDown() == 0))return 1;
- if (m_mode == 0)
- m_exitcode = 3;
- CDialog::OnOK();
- return 1;
- case VK_RETURN:
- BtnClick(0, 100);
- return 1;
- }
- }
- else if (pMsg->message == WM_LBUTTONDOWN)
- {
- g_bNeedDrawParent = 1;
- CPoint pt;
- ::GetCursorPos(&pt);
- ScreenToClient(&pt);
- CRect rc;
- m_button.GetWindowRect(rc);
- ScreenToClient(rc);
- if (rc.PtInRect(pt))return CDialog::PreTranslateMessage(pMsg);
- if (m_rcarray.ElementAt(4).PtInRect(pt))
- {
- m_button.SetCheck(!m_button.GetCheck());
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- void ChoosePhotoSkin::SaveLongin()
- {
- if (m_bsave)
- {
- AfxGetApp()->WriteProfileString(LYFZVERSION, _T(m_account), m_psw);
- }
- else
- {
- AfxGetApp()->WriteProfileString(LYFZVERSION, _T(m_account), "");
- }
- if (m_userarray.GetSize())
- {
- if (m_userarray.ElementAt(0) != m_account)
- {
- RemoveExist(m_account);
- m_userarray.InsertAt(0, m_account);
- if (m_userarray.GetSize() > 30)
- m_userarray.SetSize(30);
- }
- }
- else
- {
- m_userarray.Add(m_account);
- }
- CFile f;
- if (!f.Open(g_mainpath + "\\loginuser.dat", CFile::modeWrite | CFile::modeCreate))return;
- CArchive ar(&f, CArchive::store);
- m_userarray.Serialize(ar);
- ar.Close();
- f.Close();
- }
- void ChoosePhotoSkin::RemoveExist(CString str)
- {
- for (int i = 0; i < m_userarray.GetSize(); i++)
- {
- if (str == m_userarray.ElementAt(i))
- {
- m_userarray.RemoveAt(i);
- return;
- }
- }
- }
|