Exemple #1
0
 private bool OnProfilChange(object item)
 {
     if (item != null && item is RightsGroup)
     {
         RightsGroup group     = (RightsGroup)item;
         bool        duplicate = IsDuplicateProfil(group);
         if (!duplicate)
         {
             if (this.EditedObject != null)
             {
                 Object elt      = group.ProfilComboBox.SelectedItem;
                 bool   isProfil = elt != null && elt is Domain.Profil;
                 foreach (Right right in group.GetCheckRights())
                 {
                     if (isProfil)
                     {
                         right.profil = (Domain.Profil)elt;
                     }
                     else
                     {
                         right.user = (Domain.User)elt;
                     }
                     this.EditedObject.rightsListChangeHandler.AddUpdated(right);
                 }
             }
             OnChange();
             TryToAddDefaultGroup();
         }
         else
         {
             Object elt        = group.ProfilComboBox.SelectedItem;
             bool   isProfil   = elt is Domain.Profil;
             string profilText = elt is Domain.Profil ? "Profil":"User";
             MessageDisplayer.DisplayWarning("Duplicate " + profilText, "Another group with " + profilText + " '" + group.ProfilComboBox.SelectedItem + "' already exits!");
         }
         return(!duplicate);
     }
     return(true);
 }
Exemple #2
0
 private void OnGroupDelete(object item)
 {
     if (item != null && item is RightsGroup)
     {
         RightsGroup group = (RightsGroup)item;
         if (this.EditedObject != null)
         {
             foreach (Right right in group.GetCheckRights())
             {
                 if (right.oid.HasValue)
                 {
                     this.EditedObject.rightsListChangeHandler.AddDeleted(right);
                 }
                 else
                 {
                     this.EditedObject.rightsListChangeHandler.forget(right);
                 }
             }
         }
         RemoveGroup(group);
     }
     OnChange();
     TryToAddDefaultGroup();
 }