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 BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //根据用户ID获取对应的数据权限
            string        usrId     = selectedUserBtn.UserId;
            List <string> allowData = UserAdmin.GetAllowDataByUser(usrId);

            foreach (BtnDataset cbx in panelDataset.Children)
            {
                string dsName = cbx.DatasetName;
                if ((bool)cbx.isSelected)
                {
                    if (!allowData.Contains(dsName))
                    {
                        UserAdmin.AddUserPrivilege(usrId, dsName);
                    }
                }
                else
                {
                    if (allowData.Contains(dsName))
                    {
                        UserAdmin.DeleteUserPrivilege(usrId, dsName);
                    }
                }
            }

            btnSelectAll.IsEnabled  = false;
            btnSelectNone.IsEnabled = false;
            btnSave.IsEnabled       = false;
            btnCancel.IsEnabled     = false;
            panelDataset.IsEnabled  = false;
            panelUser.IsEnabled     = true;
            btnModify.IsEnabled     = true;
            WindowAdmin.notify.SetStatusMessage(string.Format("成功修改了用户{0}的所对应的数据集权限!", usrId));
        }