/// <summary> /// Gets the store groups. /// </summary> /// <returns></returns> public IAzManStoreGroup[] GetStoreGroups() { var ds = (from tf in this.db.StoreGroups() where tf.StoreId == this.storeId orderby tf.Name select tf).ToList(); int index = 0; IAzManStoreGroup[] storeGroups = new SqlAzManStoreGroup[ds.Count()]; foreach (var row in ds) { storeGroups[index] = new SqlAzManStoreGroup(this.db, this, row.StoreGroupId.Value, new SqlAzManSID(row.ObjectSid.ToArray()), row.Name, row.Description, row.LDapQuery, (GroupType)row.GroupType.Value, this.ens); if (this.ens != null) { this.ens.AddPublisher(storeGroups[index]); } index++; } return(storeGroups); }
/// <summary> /// Gets the store group. /// </summary> /// <param name="name">The name.</param> /// <returns></returns> public IAzManStoreGroup GetStoreGroup(string name) { StoreGroupsResult sgr; if ((sgr = (from tf in this.db.StoreGroups() where tf.Name == name && tf.StoreId == this.storeId select tf).FirstOrDefault()) != null) { int storeGroupid = sgr.StoreGroupId.Value; IAzManSid objectSid = new SqlAzManSID(sgr.ObjectSid.ToArray()); string description = sgr.Description; string lDapQuery = sgr.LDapQuery; GroupType groupType = (GroupType)sgr.GroupType.Value; IAzManStoreGroup result = new SqlAzManStoreGroup(this.db, this, storeGroupid, objectSid, name, description, lDapQuery, groupType, this.ens); if (this.ens != null) { this.ens.AddPublisher(result); } return(result); } else { throw SqlAzManException.StoreGroupNotFoundException(name, this, null); } }