/// <summary>
 /// Creates an authorization attribute.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public IAzManAttribute <IAzManAuthorization> CreateAttribute(string key, string value)
 {
     try
     {
         //db.tAuthorizationattributes.Insert(this.authorizationId, key, value);
         int authorizationAttributeId = 0;
         authorizationAttributeId = this.db.AuthorizationAttributeInsert(this.authorizationId, key, value, this.item.Application.ApplicationId);
         this.db.SubmitChanges();
         IAzManAttribute <IAzManAuthorization> result = new SqlAzManAuthorizationAttribute(this.db, this, authorizationAttributeId, key, value, this.ens);
         this.raiseAuthorizationAttributeCreated(this, result);
         if (this.ens != null)
         {
             this.ens.AddPublisher(result);
         }
         return(result);
     }
     catch (System.Data.SqlClient.SqlException sqlex)
     {
         if (sqlex.Number == 2601) //Index Duplicate Error
         {
             throw SqlAzManException.AttributeDuplicateException(key, this, sqlex);
         }
         else
         {
             throw SqlAzManException.GenericException(sqlex);
         }
     }
 }
示例#2
0
 /// <summary>
 /// Creates a store attribute.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public IAzManAttribute <IAzManStore> CreateAttribute(string key, string value)
 {
     try
     {
         int storeAttributeId = this.db.StoreAttributeInsert(this.storeId, key, value);
         IAzManAttribute <IAzManStore> result = new SqlAzManStoreAttribute(this.db, this, storeAttributeId, key, value, this.ens);
         this.raiseStoreAttributeCreated(this, result);
         if (this.ens != null)
         {
             this.ens.AddPublisher(result);
         }
         return(result);
     }
     catch (System.Data.SqlClient.SqlException sqlex)
     {
         if (sqlex.Number == 2601) //Index Duplicate Error
         {
             throw SqlAzManException.AttributeDuplicateException(key, this, sqlex);
         }
         else
         {
             throw SqlAzManException.GenericException(sqlex);
         }
     }
 }
示例#3
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);
         }
     }
 }
示例#4
0
 /// <summary>
 /// Creates the specified application name.
 /// </summary>
 /// <param name="applicationName">Name of the application.</param>
 /// <param name="applicationDescription">The application description.</param>
 /// <returns></returns>
 public IAzManApplication CreateApplication(string applicationName, string applicationDescription)
 {
     try
     {
         int applicationId = this.db.ApplicationInsert(this.storeId, applicationName, applicationDescription);
         IAzManApplication applicationCreated = new SqlAzManApplication(this.db, this, applicationId, applicationName, applicationDescription, this.netsqlazmanFixedServerRole, this.ens);
         this.raiseApplicationCreated(this, applicationCreated);
         if (this.ens != null)
         {
             this.ens.AddPublisher(applicationCreated);
         }
         this.applications = null; //Force cache refresh
         return(applicationCreated);
     }
     catch (System.Data.SqlClient.SqlException sqlex)
     {
         if (sqlex.Number == 2601) //Index Duplicate Error
         {
             throw SqlAzManException.ApplicationDuplicateException(applicationName, 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);
         }
     }
 }
示例#6
0
 /// <summary>
 /// Renames the specified new store name.
 /// </summary>
 /// <param name="newStoreName">New name of the store.</param>
 public void Rename(string newStoreName)
 {
     try
     {
         if (this.name != newStoreName)
         {
             string oldName = this.name;
             this.db.StoreUpdate(newStoreName, this.description, this.storeId);
             this.name = newStoreName;
             this.raiseStoreRenamed(this, oldName);
         }
     }
     catch (System.Data.SqlClient.SqlException sqlex)
     {
         if (sqlex.Number == 2601) //Index Duplicate Error
         {
             throw SqlAzManException.StoreDuplicateException(newStoreName, sqlex);
         }
         else
         {
             throw SqlAzManException.GenericException(sqlex);
         }
     }
 }