Example #1
0
        void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //根据数据集名字获取对应的用户权限
            string        dsName    = selectedDatasetBtn.DatasetName;
            List <string> allowUser = UserAdmin.GetAllowUserByData(dsName);

            foreach (BtnUserInfo cbx in panelUser.Children)
            {
                string usrId = cbx.UserId;
                if ((bool)cbx.isSelected)
                {
                    if (!allowUser.Contains(usrId))
                    {
                        UserAdmin.AddUserPrivilege(usrId, dsName);
                    }
                }
                else
                {
                    if (allowUser.Contains(usrId))
                    {
                        UserAdmin.DeleteUserPrivilege(usrId, dsName);
                    }
                }
            }

            btnSelectAll.IsEnabled  = false;
            btnSelectNone.IsEnabled = false;
            btnSave.IsEnabled       = false;
            btnCancel.IsEnabled     = false;
            panelUser.IsEnabled     = false;
            panelDataset.IsEnabled  = true;
            btnModify.IsEnabled     = true;
            WindowAdmin.notify.SetStatusMessage(string.Format("成功修改了数据集{0}的所对应的用户权限!", dsName));
        }
Example #2
0
        void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            btnSelectAll.IsEnabled  = false;
            btnSelectNone.IsEnabled = false;
            btnSave.IsEnabled       = false;
            btnCancel.IsEnabled     = false;
            panelDataset.IsEnabled  = true;
            panelUser.IsEnabled     = false;
            btnModify.IsEnabled     = true;

            //根据数据集名字获取对应的用户权限
            List <string> allowUser = UserAdmin.GetAllowUserByData(selectedDatasetBtn.DatasetName);

            foreach (BtnUserInfo cbx in panelUser.Children)
            {
                cbx.isSelected = (allowUser.Contains(cbx.UserId));
            }
        }
Example #3
0
        //选中某个数据集时,可以修改该数据集对应的用户权限
        private void btnDataset_Click(object sender, RoutedEventArgs e)
        {
            BtnDataset btnDataset = sender as BtnDataset;

            if (selectedDatasetBtn != null)
            {
                selectedDatasetBtn.isSelected = false;
            }
            selectedDatasetBtn    = btnDataset;
            btnDataset.isSelected = true;
            btnModify.IsEnabled   = true;

            //根据数据集名字获取对应的用户权限
            List <string> allowUser = UserAdmin.GetAllowUserByData(btnDataset.DatasetName);

            foreach (BtnUserInfo cbx in panelUser.Children)
            {
                cbx.isSelected = (allowUser.Contains(cbx.UserId));
            }
        }