Esempio n. 1
0
        private void btnAddSearch_Click(object sender, EventArgs e)
        {
            ProductQuery query = new ProductQuery();

            query.Keywords   = keywords;
            query.CategoryId = categoryId;
            query.SaleStatus = ProductSaleStatus.OnSale;

            IList <int> productIds        = ProductHelper.GetProductIds(query);
            IList <int> subjectProductIds = ProductHelper.GetSubjectProductIds(subjectType);

            IList <int> idsList = new List <int>();

            foreach (int pid in productIds)
            {
                if (!subjectProductIds.Contains(pid))
                {
                    idsList.Add(pid);
                }
            }

            if ((idsList.Count > 0) && ProductHelper.AddSubjectProducts(subjectType, idsList))
            {
                Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
        }