// Login3.cpp: implementation of the Login3 class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "YLGL.h" #include "Login3.h" #include "DigitalWorkSet2.h" #include "ShowMsg.h" #include "ShowBakState.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// //extern void WriteClientLog(CString str); // Jeff写客户端日志; Login3::Login3() { m_psw = _T(""); m_bsave = FALSE; m_account = _T(""); g_pMainWnd->GetSkin(); } Login3::~Login3() { } void Login3::OnFSCommand(LPCTSTR command, LPCTSTR args) { } void Login3::Init() { m_combobox.Create(WS_VSCROLL|WS_CHILD|CBS_DROPDOWN,m_rcarray.ElementAt (2),this,100); m_combobox.ShowWindow(SW_SHOW); // m_combobox.SetFocus(); // Add by Jeff //无效; 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); ///////////////////////// g_sendhead.bsql=0; g_sendhead.code[0]=23; // Jeff.accountview视图;用户 g_sendhead.code[1]=24; // Jeff.version表;版本信息; g_sendhead.code[2]=29; // Jeff.path表;路径 g_sendhead.code[3]=5; // Jeff.renyuan表;人员表; g_sendhead.code[4]=1; // Jeff.historydb表;历史数据库; g_sendhead.code[5]=171; // Jeff.childmsg表;其实就是"资料与相片备份状态" if(g_branchname=="") { g_sendhead.code[6]=152; // Jeff.不读任何表,读brachinfo.dat文件里的数据; g_sendhead.tabcount=7; } else g_sendhead.tabcount=6; 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; } CArraypatharray; CArrayuserarray; if(g_branchname=="") DataToArray(&m_List1array,&g_cominfoarray,&patharray,&userarray,&g_hisyeararray,&g_bakstatearray,&g_brancharray); else DataToArray(&m_List1array,&g_cominfoarray,&patharray,&userarray,&g_hisyeararray,&g_bakstatearray); if(g_branchname=="") { g_cominfoarraylocal.SetSize(1, 1); g_cominfoarraylocal.ElementAt(0).Copy(g_cominfoarray.ElementAt(0)); } CheckBakState(); // Jeff.启用客户端时,先检测"资料与照片备份状态" if(g_branchname=="") { g_domain=patharray.ElementAt(0).ElementAt(0); if(g_domain.Find (".ly.com")==-1)g_domain.Empty (); // MessageBox(g_domain); 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)); } CString version = _T ("Version 1.0"); BOOL bHide=atoi(g_cominfoarray.ElementAt(0).ElementAt(58)); AfxGetApp()->WriteProfileInt (version, "hidewindow2", bHide); g_userarray.SetSize( userarray.GetSize (), 1 ); int count=0; for(int ii=0; iiAutoUpdate(); 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=="") { // WriteClientLog("启动集团版菜单"); g_pMainWnd->AddBranchMenu(&g_brancharray); // 添加操作分店菜单; } if(g_branchname=="") { ////////////////////////////////////////////////////////////////////////// // 获取NetShareInfo表; if ( g_aryOfSharePathInfo.GetSize() == 0) { g_pMainWnd->GetSharePathInfo(); } 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_serverbak="PC-110817-VYCJ"; 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; i0) { m_combobox.SetCurSel (0); m_combobox.GetLBText (0, m_account); } if(!m_account.IsEmpty ()) { CString version = _T ("Version 1.0"); m_psw=AfxGetApp()->GetProfileString (version, _T (m_account)); if(!m_psw.IsEmpty ()) m_bsave=TRUE; } SetDlgItemText(200, m_psw); m_button.SetCheck (m_bsave); } } catch(...) { } //CWnd *pWnd = GetFocus(); //pWnd->OnKillFocus(pWnd); //m_combobox.SetFocus(); } void Login3::Destory() { } void Login3::BtnClick(WPARAM wParam, LPARAM lParam) { int id=lParam; id-=99; switch(id) { case 2: { MyOnOK(); } break; case 1: CDialog::OnCancel (); break; } } BOOL Login3::PreTransMsg(MSG* pMsg) { #if 0 // Add Jeff:使用tab键切换控件; if (pMsg->message == WM_KEYDOWN && pMsg->message == VK_TAB) { // 当前拥有焦点的控件 == m_combobox控件; if(GetFocus()->GetSafeHwnd() == m_combobox.GetSafeHwnd()) { // 使m_edit拥有焦点 m_edit.SetFocus(); return TRUE; } else if (GetFocus()->GetSafeHwnd() == m_edit.GetSafeHwnd()) { m_button->SetFocus(); return TRUE; } } else if(pMsg->message == WM_KEYDOWN) #else if(pMsg->message == WM_KEYDOWN) #endif { switch (pMsg->wParam) { case VK_RETURN: MyOnOK(); break;// return 1; case VK_TAB: { #if 0 CWnd *pParent = GetParent(); CWnd *pWnd = GetFocus(); //CString strText; int nCtrlId = pWnd->GetDlgCtrlID(); //m_combobox.m // LOG4C((LOG_NOTICE,"VK_TAB:%d,%d,%d"),nCtrlId,m_combobox.GetDlgCtrlID(),pParent->GetDlgCtrlID()); #endif HWND _hwnd = GetFocus()->GetSafeHwnd(); if(_hwnd != m_combobox.m_hWnd && _hwnd != m_edit.m_hWnd && _hwnd != m_button.m_hWnd) //if( _hwnd == m_combobox.m_hWnd ) { //LOG4C((LOG_NOTICE,"使m_edit拥有焦点")); // 使m_edit拥有焦点 m_edit.SetFocus(); // 使密码框的内容清空或者全靠; //m_combobox.SetFocus(); return TRUE; } // else if ( _hwnd == m_combobox.m_hWnd) // { // m_edit.SetFocus(); // return TRUE; // } else if (_hwnd == m_edit.m_hWnd/*m_edit.GetSafeHwnd()*/) { //LOG4C((LOG_NOTICE,"将焦点返回给commbox")); m_combobox.SetFocus(); return TRUE; } } break; } } 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 Login3::SaveLongin() { CString version = _T ("Version 1.0"); if(m_bsave) { AfxGetApp()->WriteProfileString (version, _T (m_account), m_psw); } else { AfxGetApp()->WriteProfileString (version, _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 Login3::RemoveExist(CString str) { for(int i=0; i7) { g_bakstatearray.RemoveAt(0); } int photocount=0; int infocount=0; for(int i=0; i1 || photocount>2) { // Jeff."资料与照片备份状态"对话框; ShowBakState dlg; dlg.m_pArray=&g_bakstatearray; dlg.DoModal (); } } void Login3::MyOnOK() { //AfxMessageBox("login3");//Jeff m_combobox.GetWindowText (m_account); GetDlgItemText(200, m_psw); m_bsave= m_button.GetCheck (); if(m_account.IsEmpty()) { AfxMessageBox("资料不全!", MB_ICONINFORMATION); return; } for(int i=0; iRefreshOutlookBar(); CDialog::OnOK(); CString str; str="当前用户:"+g_user.name; #ifndef NEW_SKIN g_pMainWnd->m_wndStatusBar.SetPaneText(1,str,TRUE); #endif if(g_pMainWnd2)g_pMainWnd2->DrawLogin(); #ifdef TEST_LOCAL CString sql; sql= "update path set path1='"+g_server+"',path2='"+g_server+"',path3='"+g_server+"',path4='"+g_server+"'"; g_sendhead.bsql=1; g_pMainWnd->ProcessChatMessageRequest2(sql); CString path1="客户原片(管理软件)$"; CString path2="修好的片(管理软件)$"; CString path3="设计好的片(管理软件)$"; CString path4="精修好的片(管理软件)$"; ::CreateDirectory (g_mainpath+"\\"+path1, NULL); CString temp; temp.Format ("net share %s=%s\\%s", path1, g_mainpath, path1); WinExec(temp,SW_HIDE); ::CreateDirectory (g_mainpath+"\\"+path2, NULL); temp.Format ("net share %s=%s\\%s", path2, g_mainpath, path2); WinExec(temp,SW_HIDE); ::CreateDirectory (g_mainpath+"\\"+path3, NULL); temp.Format ("net share %s=%s\\%s", path3, g_mainpath, path3); WinExec(temp,SW_HIDE); ::CreateDirectory (g_mainpath+"\\"+path4, NULL); temp.Format ("net share %s=%s\\%s", path4, g_mainpath, path4); WinExec(temp,SW_HIDE); #endif if(1)//g_user.bm=="数码部" || g_user.bm=="摄影部" || g_user.bm=="制作部") { DigitalWorkSet2 dlg; dlg.m_mode=1; dlg.m_checkwork=1; dlg.DoModal(); } ///内部消息 { CString str; str="%"; str+=g_user.name; str+="%"; CString filter="[receiver] like '"+str+"'"; g_sendhead.bsql=0; g_sendhead.code[0]=126; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(filter); if(g_bSendOK==0)return; DataToArray(&g_List1array); str=","+g_user.name+","; for(int i=g_List1array.GetSize()-1; i>=0; i--) { CString receivers2=g_List1array.ElementAt (i).ElementAt (4); receivers2.TrimLeft(","); receivers2.TrimRight(","); receivers2=","+receivers2+","; if(receivers2.Find(str)!=-1) g_List1array.RemoveAt(i); } if(g_List1array.GetSize()) { ShowMsg dlg; dlg.DoModal(); } } return; } } } AfxMessageBox("没有这个账号, 请重新输入!", MB_ICONINFORMATION); } CString Login3::GetBm(CString &name, CArray&m_renyuanarray ) { for(int i=0; i