コード例 #1
0
 private bool AddEditUserGroupsDialog_OKClicked(UserGroupRowData userGroup)
 {
     if (AddEditUserGroupsDialog.EditMode)
     {
         // Commit the change into database
         if (_controller.UpdateUserGroup(userGroup))
         {
             UserGroupsPanel.UpdateUI();
             return(true);
         }
         return(false);
     }
     else
     {
         try
         {
             if (_controller.AddUserGroup(userGroup))
             {
                 UserGroupsPanel.UpdateUI();
                 return(true);
             }
             return(false);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
コード例 #2
0
        private void DeleteConfirmationDialog_Confirmed(object data)
        {
            // delete the device and reload the affected partition.
            UserGroupRowData userGroup = data as UserGroupRowData;

            try
            {
                _controller.DeleteUserGroup(userGroup, true);
            }
            catch (AuthorityGroupIsNotEmptyException ex)
            {
                DeleteNonEmptyGroupConfirmation.Data         = data;
                DeleteNonEmptyGroupConfirmation.Message      = String.Format(SR.AdminUserGroup_DeleteNonEmptyGroupDialog_AreYouSure, ExceptionTranslator.Translate(ex));
                DeleteNonEmptyGroupConfirmation.MessageType  = MessageBox.MessageTypeEnum.YESNO;
                DeleteNonEmptyGroupConfirmation.MessageStyle = "color: red; font-weight: bold";
                DeleteNonEmptyGroupConfirmation.Show();
            }
            catch (Exception ex)
            {
                DeleteErrorMessage.Message      = ExceptionTranslator.Translate(ex);
                DeleteErrorMessage.MessageStyle = "color: red; font-weight: bold";
                DeleteErrorMessage.MessageType  = MessageBox.MessageTypeEnum.ERROR;
                DeleteErrorMessage.Show();
            }
            UserGroupsPanel.UpdateUI();
        }
コード例 #3
0
        private void DeleteNonEmptyGroupConfirmationDialog_Confirmed(object data)
        {
            UserGroupRowData userGroup = data as UserGroupRowData;

            try
            {
                _controller.DeleteUserGroup(userGroup, false /* don't check if the group is empty. User has given the go head*/);
            }
            catch (Exception ex)
            {
                DeleteErrorMessage.Message      = ExceptionTranslator.Translate(ex);
                DeleteErrorMessage.MessageStyle = "color: red; font-weight: bold";
                DeleteErrorMessage.MessageType  = MessageBox.MessageTypeEnum.ERROR;
                DeleteErrorMessage.Show();
            }
            UserGroupsPanel.UpdateUI();
        }