示例#1
0
 /// <summary>
 /// Creates the store group.
 /// </summary>
 /// <param name="storeGroupSid">The store group sid.</param>
 /// <param name="name">The name.</param>
 /// <param name="description">The description.</param>
 /// <param name="lDapQuery">The ldap query.</param>
 /// <param name="groupType">Type of the group.</param>
 /// <returns></returns>
 public IAzManStoreGroup CreateStoreGroup(IAzManSid storeGroupSid, string name, string description, string lDapQuery, GroupType groupType)
 {
     try
     {
         if (DirectoryServices.DirectoryServicesUtils.TestLDAPQuery(lDapQuery))
         {
             this.db.StoreGroupInsert(this.storeId, storeGroupSid.BinaryValue, name, description, lDapQuery, (byte)groupType);
             IAzManStoreGroup result = this.GetStoreGroup(name);
             this.raiseStoreGroupCreated(this, result);
             if (this.ens != null)
             {
                 this.ens.AddPublisher(result);
             }
             this.storeGroups = null; //Force cache refresh
             return(result);
         }
         else
         {
             throw new ArgumentException("LDAP Query syntax error or unavailable Domain.", "lDapQuery");
         }
     }
     catch (System.Data.SqlClient.SqlException sqlex)
     {
         if (sqlex.Number == 2601) //Index Duplicate Error
         {
             throw SqlAzManException.StoreGroupDuplicateException(name, this, sqlex);
         }
         else
         {
             throw SqlAzManException.GenericException(sqlex);
         }
     }
 }
 /// <summary>
 /// Renames the specified new name.
 /// </summary>
 /// <param name="newName">The new name.</param>
 public void Rename(string newName)
 {
     try
     {
         if (this.name != newName)
         {
             string oldName = this.name;
             this.db.StoreGroupUpdate(this.store.StoreId, this.SID.BinaryValue, newName, this.description, this.LDAPQuery, (byte)this.groupType, this.storeGroupId);
             this.name = newName;
             this.raiseStoreGroupRenamed(this, oldName);
         }
     }
     catch (System.Data.SqlClient.SqlException sqlex)
     {
         if (sqlex.Number == 2601) //Index Duplicate Error
         {
             throw SqlAzManException.StoreGroupDuplicateException(newName, this.store, sqlex);
         }
         else
         {
             throw SqlAzManException.GenericException(sqlex);
         }
     }
 }