views:

15

answers:

0

I've catalogs of a list items, each catolog containing a list product. I would like to display each category in a separate popup. The objective of this solution is to extract the categories and list product associated with the possibility to modify this list of products. objective was to modify the following two properties: product name and the reference quantity in stock (only in presentation, I will not try to save changes to a database, I work for that session.

catalogs information from a database.

I display a popup products in a listview. during the first connection we have no products in category. we will add products in a listview which store in session. with an opportunity to return to the previous category.

public class Catalog
    {
        private string name;
        private string reference;
        private string unite;
    private List<Products> Products;
    }

catalogToDisplay.cs class "command" connected to the default.aspx.cs

private int _indexProduct;

        public int indexProduct {

            get { return this._indexStock; }
            set{singleton.IndexStock = value;}
        }

I have a singleton session for storage: - Iteration index - List of catalogs

// Constructor command
public catalogToDisplay():
    {


            // getting list of catalogs
            listeCatalogs = singleton.ListCatalogs as List<Catalog>
            try
            {
                _indexProduct = singleton.IndexStock;
            }
            catch
            {
                _indexProduct = 0;
            }

default.aspx.cs

protected void callMultiplePopup()
        {
            int nextIndex;


            int nbrproducts = command.getListeCatalogs().Count;

    // index stored in session.

            if (index < nbrStocks)
            {

                modalPopup.Show();

        // Load catalog data
                mdeTxtName.Text = command.getListeCatalogs()[index].Name;
                mdeTxtReference.Text = command.getListeCatalogs()[index].Reference;




                indexNext = index + 1;
                command.indexProduct = indexNext;
            }
            else
            {

                HidePopup();
            }

        }

I feel that I go to the wrong way. Is there a better pattern to replace or complete it?

Thank you in advance for your help.