123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665 |
- // Dlg_GroupManage.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "Dlg_GroupManage.h"
- #include "Dlg_AddGroup.h"
- // CDlg_GroupManage 对话框
- IMPLEMENT_DYNAMIC(CDlg_GroupManage, CDialog)
- CDlg_GroupManage::CDlg_GroupManage(CWnd* pParent /*=NULL*/)
- : CDialog(CDlg_GroupManage::IDD, pParent)
- {
- m_hRoot = NULL;
- m_hCurretItem = NULL;
- m_bIsLookStatus = false;
- m_nGroupID = -1;
- m_nType = 0;
- }
- CDlg_GroupManage::~CDlg_GroupManage()
- {
- }
- void CDlg_GroupManage::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_TREE_GROUP, m_wndTree);
- DDX_Control(pDX, IDC_LIST_SRC, m_ctrlListBoxSrc);
- DDX_Control(pDX, IDC_LIST_DEST, m_ctrlListBoxDest);
- DDX_Control(pDX, IDC_BTN_SEL_SINGLE, m_btnSetSingle);
- DDX_Control(pDX, IDC_BTN_SEL_ALL, m_btnSetAll);
- DDX_Control(pDX, IDC_BTN_REVERSE_SEL_SINGLE, m_btnDelSingle);
- DDX_Control(pDX, IDC_BTN_REVERSE_SEL_ALL, m_btnDelAll);
- DDX_Control(pDX, IDC_LIST_SRC2, m_ctrlListBoxSrc1);
- DDX_Control(pDX, IDC_LIST_DEST2, m_ctrlListBoxDest1);
- DDX_Control(pDX, IDC_BTN_SEL_SINGLE2, m_btnSetSingle1);
- DDX_Control(pDX, IDC_BTN_SEL_ALL2, m_btnSetAll1);
- DDX_Control(pDX, IDC_BTN_REVERSE_SEL_SINGLE2, m_btnDelSingle1);
- DDX_Control(pDX, IDC_BTN_REVERSE_SEL_ALL2, m_btnDelAll1);
- DDX_Control(pDX, IDC_LIST_SRC3, m_ctrlListBoxSrc2);
- DDX_Control(pDX, IDC_LIST_DEST3, m_ctrlListBoxDest2);
- DDX_Control(pDX, IDC_BTN_SEL_SINGLE3, m_btnSetSingle2);
- DDX_Control(pDX, IDC_BTN_SEL_ALL3, m_btnSetAll2);
- DDX_Control(pDX, IDC_BTN_REVERSE_SEL_SINGLE3, m_btnDelSingle2);
- DDX_Control(pDX, IDC_BTN_REVERSE_SEL_ALL3, m_btnDelAll2);
- DDX_Control(pDX, IDC_BTN_ADDGROUP, m_btnAddGroup);
- DDX_Control(pDX, IDC_BTN_DELGROUP, m_btnDelGroup);
- DDX_Radio(pDX, IDC_RADIO1, m_nType);
- }
- BEGIN_MESSAGE_MAP(CDlg_GroupManage, CDialog)
- ON_BN_CLICKED(IDC_BTN_ADDGROUP, OnBnClickedBtnAddgroup)
- ON_BN_CLICKED(IDC_BTN_DELGROUP, OnBnClickedBtnDelgroup)
- ON_BN_CLICKED(IDC_BTN_SEL_SINGLE, OnBnClickedBtnSelSingle)
- ON_BN_CLICKED(IDC_BTN_SEL_ALL, OnBnClickedBtnSelAll)
- ON_BN_CLICKED(IDC_BTN_REVERSE_SEL_SINGLE, OnBnClickedBtnReverseSelSingle)
- ON_BN_CLICKED(IDC_BTN_REVERSE_SEL_ALL, OnBnClickedBtnReverseSelAll)
- ON_BN_CLICKED(IDC_BTN_SEL_SINGLE2, OnBnClickedBtnSelSingle1)
- ON_BN_CLICKED(IDC_BTN_SEL_ALL2, OnBnClickedBtnSelAll1)
- ON_BN_CLICKED(IDC_BTN_REVERSE_SEL_SINGLE2, OnBnClickedBtnReverseSelSingle1)
- ON_BN_CLICKED(IDC_BTN_REVERSE_SEL_ALL2, OnBnClickedBtnReverseSelAll1)
- ON_BN_CLICKED(IDC_BTN_SEL_SINGLE3, OnBnClickedBtnSelSingle2)
- ON_BN_CLICKED(IDC_BTN_SEL_ALL3, OnBnClickedBtnSelAll2)
- ON_BN_CLICKED(IDC_BTN_REVERSE_SEL_SINGLE3, OnBnClickedBtnReverseSelSingle2)
- ON_BN_CLICKED(IDC_BTN_REVERSE_SEL_ALL3, OnBnClickedBtnReverseSelAll2)
- ON_BN_CLICKED(IDOK, OnBnClickedOk)
- ON_NOTIFY(NM_DBLCLK, IDC_TREE_GROUP, OnNMDblclkTreeGroup)
- ON_BN_CLICKED(IDC_RADIO1, OnBnClickedRadio1)
- ON_BN_CLICKED(IDC_RADIO2, OnBnClickedRadio2)
- ON_BN_CLICKED(IDC_RADIO3, OnBnClickedRadio3)
- END_MESSAGE_MAP()
- // CDlg_GroupManage 消息处理程序
- BOOL CDlg_GroupManage::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: 在此添加额外的初始化
- InitTreeInfo();
- if( -1==PMS_VerifyUserPermit( g_nUserID,PMS_GROUP_INFO_ALLOC,"" ) )
- {
- m_btnSetSingle.ShowWindow( false );
- m_btnSetAll.ShowWindow( false );
- m_btnDelSingle.ShowWindow( false );
- m_btnDelAll.ShowWindow( false );
- m_btnAddGroup.ShowWindow( false );
- m_btnDelGroup.ShowWindow( false );
- GetDlgItem(IDOK)->ShowWindow( false );
- m_bIsLookStatus = true;
- }
- HTREEITEM hSelectedItem = m_wndTree.GetSelectedItem();
- HTREEITEM hParent = m_wndTree.GetParentItem( hSelectedItem );
- //int nGroupID = 0;
- //CString str="操作员";
- //CDBInterface::GetInstancePtr()->GetGroupIDByName( str,nGroupID );
- //m_sCurrentGroupName = str;
- //CDBInterface::GetInstancePtr()->GetGroupPermitByID( &m_ctrlListBoxDest,nGroupID );
- //CDBInterface::GetInstancePtr()->GetGroupPermitByID( &m_ctrlListBoxSrc,&m_ctrlListBoxDest );
- IsVisibleCtrl();
- UpdateData( false );
- return TRUE; // return TRUE unless you set the focus to a control
- // 异常: OCX 属性页应返回 FALSE
- }
- void CDlg_GroupManage::InitTreeInfo(void)
- {
- m_wndTree.ModifyStyle(0, TVS_HASBUTTONS | TVS_LINESATROOT
- | TVS_HASLINES | TVS_DISABLEDRAGDROP
- | TVS_SHOWSELALWAYS);
- m_wndTree.DeleteAllItems();
- m_wndTree.SetItemHeight(20);
- m_wndImageList.DeleteImageList();
- m_wndImageList.Create(IDB_LEFT, 16, 1, RGB(255, 0, 255));
- m_wndTree.SetImageList(&m_wndImageList, LVSIL_NORMAL);
- ////插入串口和设备
- m_hRoot = m_wndTree.InsertItem(g_strGroup, 0, 0);
- CDBInterface::GetInstancePtr()->GetAllGroupToTree( &m_wndTree, m_hRoot );
- //展开树
- m_wndTree.Expand(m_wndTree.GetRootItem(),TVE_EXPAND);
- HTREEITEM handleTreeItem = m_wndTree.GetRootItem();
- while(handleTreeItem)
- {
- handleTreeItem = m_wndTree.GetChildItem(handleTreeItem);
- m_wndTree.Expand(handleTreeItem, TVE_EXPAND);
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnAddgroup()
- {
- CDlg_AddGroup dlg;
- if( dlg.DoModal()==IDOK )
- {
- int nID = 0;
- CHAR szMaxID[MAX_ID] = {0};
-
- CDBInterface::GetInstancePtr()->GetMaxID("t_user_group", "id", szMaxID);
- nID = atoi( szMaxID );
- CDBInterface::GetInstancePtr()->AddGroup(nID+1, (char *)(LPCTSTR)dlg.m_sEdit_GroupName, "");
- m_wndTree.InsertItem(dlg.m_sEdit_GroupName,5,5,m_hRoot);
- CString sContent;
- sContent.Format("%s %s< %s >",g_strAdd,g_strGroup,m_sCurrentGroupName );
-
- CDBInterface::GetInstancePtr()->InsertLogRecord( LOG_GROUP_ADD,0,"",(char *)(LPCTSTR)sContent );
- m_ctrlListBoxDest.ResetContent();
- m_ctrlListBoxSrc.ResetContent();
- m_ctrlListBoxDest1.ResetContent();
- m_ctrlListBoxSrc1.ResetContent();
- m_ctrlListBoxDest2.ResetContent();
- m_ctrlListBoxSrc2.ResetContent();
- CDBInterface::GetInstancePtr()->GetGroupIDByName( dlg.m_sEdit_GroupName,m_nGroupID );
- CDBInterface::GetInstancePtr()->GetGroupPermitByID( &m_ctrlListBoxDest,m_nGroupID );
- CDBInterface::GetInstancePtr()->GetGroupPermitByID( &m_ctrlListBoxSrc,&m_ctrlListBoxDest );
- CDBInterface::GetInstancePtr()->GetGroupUserByID( &m_ctrlListBoxDest2,m_nGroupID );
- CDBInterface::GetInstancePtr()->GetGroupUserByID( &m_ctrlListBoxSrc2,&m_ctrlListBoxDest2 );
- GetGroupDevice();
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnDelgroup()
- {
- if( m_hCurretItem==NULL )
- {
- MessageBox(g_strDClickFirstOperate, g_strTip, MB_ICONWARNING);
- return;
- }
- CString str;
- str.Format(g_strDelGroup,m_sCurrentGroupName );
-
- if( MessageBox( str,g_strTip,MB_YESNO )==IDNO )
- return;
- m_wndTree.DeleteItem( m_hCurretItem );
- int nGroupID=0;
- CDBInterface::GetInstancePtr()->GetGroupIDByName( m_sCurrentGroupName,nGroupID );
- CDBInterface::GetInstancePtr()->DelGroup( nGroupID );
- str.Format( "%d",nGroupID );
- CDBInterface::GetInstancePtr()->DelTableData( "t_role_equip","group_id",(char *)(LPCTSTR)str,2 );
- CDBInterface::GetInstancePtr()->DelTableData( "t_role_user","group_id",(char *)(LPCTSTR)str,2 );
- //int nCount=0;
- //nCount = m_ctrlListBoxSrc.GetCount();
- //for( int i = 0; i < nCount; i++ )
- // m_ctrlListBoxSrc.DeleteString( i );
- //nCount = m_ctrlListBoxDest.GetCount();
- //for( int i = 0; i < nCount; i++ )
- // m_ctrlListBoxDest.DeleteString( i );
- m_hCurretItem = NULL;
- CString sContent;
- sContent.Format("%s %s< %s >",g_strDel,g_strGroup,m_sCurrentGroupName );
-
- CDBInterface::GetInstancePtr()->InsertLogRecord( LOG_GROUP_DELETE,0,"",(char *)(LPCTSTR)sContent );
- m_ctrlListBoxDest.ResetContent();
- m_ctrlListBoxSrc.ResetContent();
- m_ctrlListBoxDest1.ResetContent();
- m_ctrlListBoxSrc1.ResetContent();
- m_ctrlListBoxDest2.ResetContent();
- m_ctrlListBoxSrc2.ResetContent();
- }
- void CDlg_GroupManage::OnBnClickedBtnSelSingle()
- {
- CString str;
- int nCount, i, nIndex = 0;
- CArray<int,int> arrayListSel;
- nCount = m_ctrlListBoxSrc.GetSelCount();
- arrayListSel.SetSize( nCount );
- m_ctrlListBoxSrc.GetSelItems( nCount, arrayListSel.GetData() );
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxSrc.GetText( arrayListSel[i] - nIndex, str );
- m_ctrlListBoxSrc.DeleteString( arrayListSel[i] - nIndex );
- m_ctrlListBoxSrc.SetSel( arrayListSel[i] - nIndex, FALSE );
- m_ctrlListBoxDest.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnSelAll()
- {
- CString str;
- int i, nCount, nIndex = 0;
- nCount = m_ctrlListBoxSrc.GetCount();
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxSrc.GetText( i - nIndex, str );
- m_ctrlListBoxSrc.DeleteString( i - nIndex );
- m_ctrlListBoxDest.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnReverseSelSingle()
- {
- CString str;
- int nCount, i, nIndex = 0;
- CArray<int,int> arrayListSel;
- nCount = m_ctrlListBoxDest.GetSelCount();
- arrayListSel.SetSize( nCount );
- m_ctrlListBoxDest.GetSelItems( nCount, arrayListSel.GetData() );
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest.GetText( arrayListSel[i] - nIndex, str );
- m_ctrlListBoxDest.DeleteString( arrayListSel[i] - nIndex );
- m_ctrlListBoxDest.SetSel( arrayListSel[i] - nIndex, FALSE );
- m_ctrlListBoxSrc.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnReverseSelAll()
- {
- CString str;
- int i, nCount, nIndex = 0;
- nCount = m_ctrlListBoxDest.GetCount();
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest.GetText( i - nIndex, str );
- m_ctrlListBoxDest.DeleteString( i - nIndex );
- m_ctrlListBoxSrc.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedOk()
- {
- if( !m_bIsLookStatus )
- {
- CString sGroupPermit;
- CString str;
- int nID=0;
- int nCount = m_ctrlListBoxDest.GetCount();
- for( int i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest.GetText( i, str );
- CDBInterface::GetInstancePtr()->GetPermitIDByName( str,nID );
- str.Format("%d-",nID );
- sGroupPermit += str;
- }
- sGroupPermit = sGroupPermit.Left( sGroupPermit.GetLength()-1 );
- CDBInterface::GetInstancePtr()->ModifyGroup( m_sCurrentGroupName,sGroupPermit );
- CString sContent;
- sContent.Format("%s %s< %s >",g_strEdit,g_strGroup,m_sCurrentGroupName );
- CDBInterface::GetInstancePtr()->InsertLogRecord( LOG_GROUP_EDIT,0,"",(char *)(LPCTSTR)sContent );
- }
- if( !m_bIsLookStatus )
- {
- CString sUserUid;
- CDBInterface::GetInstancePtr()->DeleteGroupUser( m_nGroupID );
- int i, nCount;
- nCount = m_ctrlListBoxDest2.GetCount();
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest2.GetText( i, sUserUid );
- //CDBInterface::GetInstancePtr()->GetGroupIDByName( sGroupName,nGroupID );
-
- int nID = 0;
- CHAR szMaxID[MAX_ID] = {0};
- CDBInterface::GetInstancePtr()->GetMaxID("t_role_user", "id", szMaxID);
-
- nID = atoi( szMaxID );
- CDBInterface::GetInstancePtr()->AddUserToGroup( nID+1,(char *)(LPCTSTR)sUserUid,m_nGroupID,"" );
- }
- }
- if( !m_bIsLookStatus )
- {
- CString str;
- int i, nCount, nID = 0;
- CHAR szUid[20] = {0};
- CHAR szMaxID[MAX_ID] = {0};
- nCount = m_ctrlListBoxDest1.GetCount();
- CDBInterface::GetInstancePtr()->DelUserDevInfo( m_nGroupID );
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest1.GetText( i, str );
- CDBInterface::GetInstancePtr()->GetDevUID( (char *)(LPCTSTR)str, szUid );
- CDBInterface::GetInstancePtr()->GetMaxID("t_role_equip", "id", szMaxID);
- if( atoi(szMaxID) > 0 )
- {
- nID = atoi(szMaxID) + 1;
- }
- else if( atoi(szMaxID) == 0 )
- {
- nID = 1;
- }
- CDBInterface::GetInstancePtr()->AddUserDevInfo(nID, m_nGroupID, szUid);
- }
- }
- AfxMessageBox( "保存完成!" );
- //OnOK();
- }
- void CDlg_GroupManage::OnNMDblclkTreeGroup(NMHDR *pNMHDR, LRESULT *pResult)//
- {
- // TODO: 在此添加控件通知处理程序代码
- HTREEITEM hSelectedItem = m_wndTree.GetSelectedItem();
- HTREEITEM hParent = m_wndTree.GetParentItem( hSelectedItem );
- CString str;
- if( hParent && m_hCurretItem!=hSelectedItem )
- {
- str = m_wndTree.GetItemText( hSelectedItem );
- CDBInterface::GetInstancePtr()->GetGroupIDByName( str,m_nGroupID );
- m_sCurrentGroupName = str;
- m_hCurretItem = hSelectedItem;
- m_ctrlListBoxDest.ResetContent();
- m_ctrlListBoxSrc.ResetContent();
- m_ctrlListBoxDest1.ResetContent();
- m_ctrlListBoxSrc1.ResetContent();
- m_ctrlListBoxDest2.ResetContent();
- m_ctrlListBoxSrc2.ResetContent();
- CDBInterface::GetInstancePtr()->GetGroupPermitByID( &m_ctrlListBoxDest,m_nGroupID );
- CDBInterface::GetInstancePtr()->GetGroupPermitByID( &m_ctrlListBoxSrc,&m_ctrlListBoxDest );
- CDBInterface::GetInstancePtr()->GetGroupUserByID( &m_ctrlListBoxDest2,m_nGroupID );
- CDBInterface::GetInstancePtr()->GetGroupUserByID( &m_ctrlListBoxSrc2,&m_ctrlListBoxDest2 );
- GetGroupDevice();
- }
- *pResult = 0;
- }
- void CDlg_GroupManage::GetGroupDevice()
- {
- m_ctrlListBoxSrc1.ResetContent();
- m_ctrlListBoxDest1.ResetContent();
- int nChannelsSize = pDevicesManager->m_channels.GetSize();
- int nDeviceSize = 0;
- int nSrcIndex = 0, nDestIndex = 0;
- for( int i = 0; i < nChannelsSize; i++ )
- {
- nDeviceSize = pDevicesManager->m_channels[i]->m_Devices.GetSize();
- for( int j = 0; j < nDeviceSize; j++ )
- {
- if( !CDBInterface::GetInstancePtr()->HasDevAlloc( m_nGroupID,(char *)(LPCTSTR)pDevicesManager->m_channels[i]->m_Devices[j]->m_strUID) )
- {
- m_ctrlListBoxSrc1.InsertString(nSrcIndex, pDevicesManager->m_channels[i]->m_Devices[j]->m_strName);
- nSrcIndex++;
- }
- else
- {
- m_ctrlListBoxDest1.InsertString(nDestIndex, pDevicesManager->m_channels[i]->m_Devices[j]->m_strName);
- nDestIndex++;
- }
- }
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnSelSingle1()
- {
- CString str;
- int nCount, i, nIndex = 0;
- CArray<int,int> arrayListSel;
- nCount = m_ctrlListBoxSrc1.GetSelCount();
- arrayListSel.SetSize( nCount );
- m_ctrlListBoxSrc1.GetSelItems( nCount, arrayListSel.GetData() );
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxSrc1.GetText( arrayListSel[i] - nIndex, str );
- m_ctrlListBoxSrc1.DeleteString( arrayListSel[i] - nIndex );
- m_ctrlListBoxSrc1.SetSel( arrayListSel[i] - nIndex, FALSE );
- m_ctrlListBoxDest1.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnSelAll1()
- {
- CString str;
- int i, nCount, nIndex = 0;
- nCount = m_ctrlListBoxSrc1.GetCount();
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxSrc1.GetText( i - nIndex, str );
- m_ctrlListBoxSrc1.DeleteString( i - nIndex );
- m_ctrlListBoxDest1.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnReverseSelSingle1()
- {
- CString str;
- int nCount, i, nIndex = 0;
- CArray<int,int> arrayListSel;
- nCount = m_ctrlListBoxDest1.GetSelCount();
- arrayListSel.SetSize( nCount );
- m_ctrlListBoxDest1.GetSelItems( nCount, arrayListSel.GetData() );
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest1.GetText( arrayListSel[i] - nIndex, str );
- m_ctrlListBoxDest1.DeleteString( arrayListSel[i] - nIndex );
- m_ctrlListBoxDest1.SetSel( arrayListSel[i] - nIndex, FALSE );
- m_ctrlListBoxSrc1.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnReverseSelAll1()
- {
- CString str;
- int i, nCount, nIndex = 0;
- nCount = m_ctrlListBoxDest1.GetCount();
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest1.GetText( i - nIndex, str );
- m_ctrlListBoxDest1.DeleteString( i - nIndex );
- m_ctrlListBoxSrc1.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnSelSingle2()
- {
- CString str;
- int nCount, i, nIndex = 0;
- CArray<int,int> arrayListSel;
- nCount = m_ctrlListBoxSrc2.GetSelCount();
- arrayListSel.SetSize( nCount );
- m_ctrlListBoxSrc2.GetSelItems( nCount, arrayListSel.GetData() );
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxSrc2.GetText( arrayListSel[i] - nIndex, str );
- m_ctrlListBoxSrc2.DeleteString( arrayListSel[i] - nIndex );
- m_ctrlListBoxSrc2.SetSel( arrayListSel[i] - nIndex, FALSE );
- m_ctrlListBoxDest2.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnSelAll2()
- {
- CString str;
- int i, nCount, nIndex = 0;
- nCount = m_ctrlListBoxSrc2.GetCount();
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxSrc2.GetText( i - nIndex, str );
- m_ctrlListBoxSrc2.DeleteString( i - nIndex );
- m_ctrlListBoxDest2.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnReverseSelSingle2()
- {
- CString str;
- int nCount, i, nIndex = 0;
- CArray<int,int> arrayListSel;
- nCount = m_ctrlListBoxDest2.GetSelCount();
- arrayListSel.SetSize( nCount );
- m_ctrlListBoxDest2.GetSelItems( nCount, arrayListSel.GetData() );
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest2.GetText( arrayListSel[i] - nIndex, str );
- m_ctrlListBoxDest2.DeleteString( arrayListSel[i] - nIndex );
- m_ctrlListBoxDest2.SetSel( arrayListSel[i] - nIndex, FALSE );
- m_ctrlListBoxSrc2.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::OnBnClickedBtnReverseSelAll2()
- {
- CString str;
- int i, nCount, nIndex = 0;
- nCount = m_ctrlListBoxDest2.GetCount();
- for( i = 0; i < nCount; i++ )
- {
- m_ctrlListBoxDest2.GetText( i - nIndex, str );
- m_ctrlListBoxDest2.DeleteString( i - nIndex );
- m_ctrlListBoxSrc2.AddString( str );
- nIndex++;
- }
- }
- void CDlg_GroupManage::IsVisibleCtrl()
- {
- UpdateData( );
- if( m_nType==0 )
- {
- GetDlgItem(IDC_STATIC1)->SetWindowText( "可选权限" );
- GetDlgItem(IDC_STATIC2)->SetWindowText( "已选权限" );
- GetDlgItem(IDC_LIST_SRC)->ShowWindow( true );
- GetDlgItem(IDC_LIST_DEST)->ShowWindow( true );
- GetDlgItem(IDC_BTN_SEL_SINGLE)->ShowWindow( true );
- GetDlgItem(IDC_BTN_SEL_ALL)->ShowWindow( true );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE)->ShowWindow( true );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL)->ShowWindow( true );
- GetDlgItem(IDC_LIST_SRC2)->ShowWindow( false );
- GetDlgItem(IDC_LIST_DEST2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_SINGLE2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_ALL2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL2)->ShowWindow( false );
- GetDlgItem(IDC_LIST_SRC3)->ShowWindow( false );
- GetDlgItem(IDC_LIST_DEST3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_SINGLE3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_ALL3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL3)->ShowWindow( false );
- }
- else if( m_nType==1 )
- {
- GetDlgItem(IDC_STATIC1)->SetWindowText( "可选设备" );
- GetDlgItem(IDC_STATIC2)->SetWindowText( "已选设备" );
- GetDlgItem(IDC_LIST_SRC)->ShowWindow( false );
- GetDlgItem(IDC_LIST_DEST)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_SINGLE)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_ALL)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL)->ShowWindow( false );
- GetDlgItem(IDC_LIST_SRC2)->ShowWindow( true );
- GetDlgItem(IDC_LIST_DEST2)->ShowWindow( true );
- GetDlgItem(IDC_BTN_SEL_SINGLE2)->ShowWindow( true );
- GetDlgItem(IDC_BTN_SEL_ALL2)->ShowWindow( true );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE2)->ShowWindow( true );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL2)->ShowWindow( true );
- GetDlgItem(IDC_LIST_SRC3)->ShowWindow( false );
- GetDlgItem(IDC_LIST_DEST3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_SINGLE3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_ALL3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE3)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL3)->ShowWindow( false );
- }
- else
- {
- GetDlgItem(IDC_STATIC1)->SetWindowText( "可选用户" );
- GetDlgItem(IDC_STATIC2)->SetWindowText( "已选用户" );
- GetDlgItem(IDC_LIST_SRC)->ShowWindow( false );
- GetDlgItem(IDC_LIST_DEST)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_SINGLE)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_ALL)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL)->ShowWindow( false );
- GetDlgItem(IDC_LIST_SRC2)->ShowWindow( false );
- GetDlgItem(IDC_LIST_DEST2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_SINGLE2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_SEL_ALL2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE2)->ShowWindow( false );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL2)->ShowWindow( false );
- GetDlgItem(IDC_LIST_SRC3)->ShowWindow( true );
- GetDlgItem(IDC_LIST_DEST3)->ShowWindow( true );
- GetDlgItem(IDC_BTN_SEL_SINGLE3)->ShowWindow( true );
- GetDlgItem(IDC_BTN_SEL_ALL3)->ShowWindow( true );
- GetDlgItem(IDC_BTN_REVERSE_SEL_SINGLE3)->ShowWindow( true );
- GetDlgItem(IDC_BTN_REVERSE_SEL_ALL3)->ShowWindow( true );
- }
- }
- void CDlg_GroupManage::OnBnClickedRadio1()
- {
- IsVisibleCtrl();
- }
- void CDlg_GroupManage::OnBnClickedRadio2()
- {
- IsVisibleCtrl();
- }
- void CDlg_GroupManage::OnBnClickedRadio3()
- {
- IsVisibleCtrl();
- }
|