473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Collectionbase problems

I have a class provided by Microsoft.solutions.framework which is
derived from CollectionBase. I have inherited from this class as I
wished to modify the constructor sightly.

The problem that I have is that I seem to be adding the product
objects into the base as when I check the list the count is being
incremented. however when I try to retrieve any of the objects via
enumeration there is no data being retrieved.

There is probably something easy missing but just can't see what.

any help would be greatly appreciated.

Cheers.

-------------------------------------------------
using System;
using System.Data;
using System.Collections;
using Microsoft.CommerceServer.Runtime;
using Microsoft.CommerceServer.Runtime.Catalog;
using Microsoft.Solutions.Framework;

namespace Microsoft.Solutions.Applications.Components
{
/// <summary>
/// Summary description for CatalogueHelper.
/// </summary>
public class RelatedProductCollection : ProductCollection
{

private string _catalogueName;
private string _productId;
private int _recordCount;

public int RecordCount
{
get{return _recordCount;}
}

public string CatalogueName
{
get{return _catalogueName;}
}

public string ProductId
{
get{return _productId;}
}

public int BaseCount
{
get{return base.List.Count;}
}

public RelatedProductCollection(string catalogueName, string
productId)
{
_productId = productId;
_catalogueName = catalogueName;

CatalogContext _catalogueContext =
CommerceContext.Current.CatalogSystem;
ProductCatalog _productCatalog =
_catalogueContext.GetCatalog(catalogueName);
if(_productCatalog != null)
{
Product _product = _productCatalog.GetProduct(productId);
if(_product != null)
{
DataSet relatedProducts = _product.GetRelatedProducts();
_recordCount = relatedProducts.Tables[0].Rows.Count;
foreach(DataRow _relatedProduct in
relatedProducts.Tables[0].Rows)
{
base.List.Add(_productCatalog.GetProduct(_relatedP roduct["productId"].ToString()));

}
}
}


}

new protected IList List
{
get{return base.List;}
}

public override Product this[int index]
{
get
{
return (Product) base.List[index];
}
set
{
base.List[index] = value;
}
}

}
}
Nov 16 '05 #1
0 960

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve M | last post by:
I have subclassed CollectionBase. I have also implemented GetEnumerator(). I have tried to set the DataSource of a DataGrid to an instance of my subclass. However, the items in the grid are not...
7
by: m. pollack | last post by:
Hi all, I've been using the CollectionBase class to implement a strongly-typed collection, but I have noticed that the RemoveAt method does not seem to call the "On" hook methods (OnRemove,...
2
by: m.pollack | last post by:
Hi all, I have an application which uses a class object that contains a collection. In order to use the PropertyGrid control to expose properties to the user at runtime, I created a...
1
by: alanrn | last post by:
I've implemented a number of strongly-typed collections that inherit from CollectionBase and recently noticed something that I don't fully understand. CollectionBase defines method RemoveAt(). ...
5
by: Eric Johannsen | last post by:
I have a simple object that inherits from CollectionBase and overrides the Count property: namespace MyTest { public class CollTest : System.Collections.CollectionBase { public override int...
4
by: Jannik Anker | last post by:
I have a standard CollectionBase implementation called UnitCollection. And yes, the collection items are class Unit ;-) Code: public class Row { public Row() { ... }
2
by: Narshe | last post by:
I have a collection class that inherits from CollectionBase, and implements IBindingList, and I'm having problems with recursion or List not having an instance. This is a simple version of the...
2
by: Samuel R. Neff | last post by:
What's the advantage of inheriting from CollectionBase as opposed to just implementing IList? It seems that it saves you from having to implement a few properties (Clear, CopyTo, Count,...
0
by: LIJO CHEERAN | last post by:
Hello friends I am trying to study about CollectionBase. I have inherited CollectionBase in the class TheCollection.cs. I am using the “TheCollection. in an aspx page to store objects...
3
by: Tony Johansson | last post by:
Hello! Sorry for opening up this task again. I want to fully understand this List that is return from CollectionBase. According to you is List in CollectionBase implemented something like...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.