Esempio n. 1
0
        /// <summary>
        /// Returns a DataSet designed for use with a nested repeater to show offers with the products they contain.
        /// We want to browse by offer, only offers can be added to a cart as products are only sold through offers.
        /// </summary>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalPages"></param>
        /// <returns></returns>
        public DataSet GetOfferPageWithProducts(
            int pageNumber,
            int pageSize,
            out int totalPages)
        {
            DataSet dataSet = new DataSet();

            DataTable offersTable = Offer.GetPublicPage(this.guid, pageNumber, pageSize, out totalPages);

            offersTable.TableName = "Offers";
            dataSet.Tables.Add(offersTable);

            DataTable offerProductsTable = Product.GetListForPageOfOffers(this.guid, pageNumber, pageSize);

            offerProductsTable.TableName = "OfferProducts";
            dataSet.Tables.Add(offerProductsTable);

            // create a releationship
            dataSet.Relations.Add("offerprods",
                                  dataSet.Tables["Offers"].Columns["Guid"],
                                  dataSet.Tables["OfferProducts"].Columns["OfferGuid"]);


            return(dataSet);
        }