Example #1
0
        private DialogResult userControlSecurityTabs_GroupPermissionChecked(object sender, SecurityEventArgs e)
        {
            FormCentralGroupPermEdit FormCG = new FormCentralGroupPermEdit(e.Perm);

            FormCG.ShowDialog();
            return(FormCG.DialogResult);
        }
Example #2
0
		private void treePermissions_MouseDown(object sender,MouseEventArgs e) {
			_clickedPermNode=treePermissions.GetNodeAt(e.X,e.Y);
			if(_clickedPermNode==null) {
				return;
			}
			if(_clickedPermNode.Parent==null) {//level 1
				if(e.X<5 || e.X>17) {
					return;
				}
			}
			else if(_clickedPermNode.Parent.Parent==null) {//level 2
				if(e.X<24 || e.X>36) {
					return;
				}
			}
			else if(_clickedPermNode.Parent.Parent.Parent==null) {//level 3
				if(e.X<43 || e.X>55) {
					return;
				}
			}
			if(_clickedPermNode.ImageIndex==1) {//unchecked, so need to add a permission
				GroupPermission perm=new GroupPermission();
				perm.PermType=(Permissions)_clickedPermNode.Tag;
				perm.UserGroupNum=_selectedGroupNum;
				if(GroupPermissions.PermTakesDates(perm.PermType)) {
					FormCentralGroupPermEdit FormCG=new FormCentralGroupPermEdit(perm);
					perm.IsNew=true;
					FormCG.ShowDialog();
					if(FormCG.DialogResult==DialogResult.Cancel) {
						treePermissions.EndUpdate();
						return;
					}
				}
				else {
					try {
						GroupPermissions.Insert(perm);
					}
					catch(Exception ex) {
						MessageBox.Show(ex.Message);
						return;
					}
				}
			}
			else if(_clickedPermNode.ImageIndex==2) {//checked, so need to delete the perm
				try {
					GroupPermissions.RemovePermission(_selectedGroupNum,(Permissions)_clickedPermNode.Tag);
				}
				catch(Exception ex) {
					MessageBox.Show(ex.Message);
					return;
				}
			}
			FillTreePerm();
		}
Example #3
0
		private void treePermissions_DoubleClick(object sender,EventArgs e) {
			if(_clickedPermNode==null){
				return;
			}
			Permissions permType=(Permissions)_clickedPermNode.Tag;
			if(!GroupPermissions.PermTakesDates(permType)){
				return;
			}
			GroupPermission perm=GroupPermissions.GetPerm(_selectedGroupNum,(Permissions)_clickedPermNode.Tag);
			if(perm==null){
				return;
			}
			FormCentralGroupPermEdit FormCG=new FormCentralGroupPermEdit(perm);
			FormCG.ShowDialog();
			if(FormCG.DialogResult==DialogResult.Cancel){
				return;
			}
			FillTreePerm();
		}