// public DataTable GetChildren(int childTypeId, int maxItems, int portalId) // { // StringBuilder sql = new StringBuilder(); // sql.Append("engageams_spItemListing "); // sql.Append(childTypeId); // sql.Append(", "); // sql.Append(portalId); // DataTable dt = DataProvider.Instance().GetDataTable(sql.ToString(), portalId); // SecurityFilter sf = SecurityFilter.Instance; // sf.FilterCategories(dt); // //remove rows over the limit // if (maxItems != -1) // { // ArrayList al = new ArrayList(); // for (int i = maxItems; i < dt.Rows.Count; i++) // { // al.Add(dt.Rows[i]); // } // foreach (DataRow r in al) // { // data.Rows.Remove(r); // } // } // return dt; // } /// <summary> /// This method is invoked by the Import mechanism and has to take this instance of a ItemRelationship and resolve /// all the id's using the names supplied in the export. hk /// </summary> public override void Import(int currentModuleId, int portalId) { try { RelationshipType type = RelationshipType.GetFromName(this.RelationshipTypeName, typeof(RelationshipType)); this._relationshipTypeId = type.GetId(); // Does this exist in my db? using ( IDataReader dr = DataProvider.Instance().GetItemRelationshipByIdentifiers( this.ParentItemIdentifier, this.ChildItemVersionIdentifier, portalId)) { if (dr.Read()) { // this version does not exist. if (dr["ParentItemId"] is DBNull || dr["ChildItemId"] is DBNull) { // no matching parent or child doesn't exist. Could throw error and stop // but for now we will handle gracefully. } else { this._childItemId = (int)dr["ChildItemId"]; this._childItemVersionId = (int)dr["ChildItemVersionId"]; this._parentItemId = (int)dr["ParentItemId"]; AddItemRelationship( this.ChildItemId, this.ChildItemVersionId, this.ParentItemId, this.RelationshipTypeId, this.StartDate, this.EndDate, this.SortOrder); } } else { Exceptions.LogException(new Exception("No matching Parent or Child could be found to create relationship.")); } } } catch (Exception e) { Exceptions.LogException(e); throw; } }