Esempio n. 1
0
        private void treePermissions_DoubleClick(object sender, System.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;
            }
            FormGroupPermEdit FormG = new FormGroupPermEdit(perm);

            FormG.ShowDialog();
            if (FormG.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            FillTreePerm();
            changed = true;
        }
Esempio n. 2
0
        private DialogResult userControlSecurityTabs_GroupPermissionChecked(object sender, SecurityEventArgs e)
        {
            FormGroupPermEdit FormG = new FormGroupPermEdit(e.Perm);

            FormG.IsNew = true;
            FormG.ShowDialog();
            return(FormG.DialogResult);
        }
Esempio n. 3
0
 private void treePermissions_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     clickedPermNode = treePermissions.GetNodeAt(e.X, e.Y);
     if (clickedPermNode == null)
     {
         return;
     }
     //treePermissions.BeginUpdate();
     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))
         {
             FormGroupPermEdit FormG = new FormGroupPermEdit(perm);
             FormG.IsNew = true;
             FormG.ShowDialog();
             if (FormG.DialogResult == DialogResult.Cancel)
             {
                 treePermissions.EndUpdate();
                 return;
             }
         }
         else
         {
             try{
                 GroupPermissions.InsertOrUpdate(perm, true);
             }
             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();
     changed = true;
 }
Esempio n. 4
0
		private void treePermissions_DoubleClick(object sender, System.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;
			}
			FormGroupPermEdit FormG=new FormGroupPermEdit(perm);
			FormG.ShowDialog();
			if(FormG.DialogResult==DialogResult.Cancel){
				return;
			}
			FillTreePerm();
			changed=true;
		}
Esempio n. 5
0
		private void treePermissions_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) {
			clickedPermNode=treePermissions.GetNodeAt(e.X,e.Y);
			if(clickedPermNode==null){
				return;
			}
			//treePermissions.BeginUpdate();
			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)){
					FormGroupPermEdit FormG=new FormGroupPermEdit(perm);
					FormG.IsNew=true;
					FormG.ShowDialog();
					if(FormG.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();
			changed=true;		
		}