Ejemplo n.º 1
0
        private List <JoinVpToProd> GetVendorProducts(VendorId vendorId, ProductCategoryId catId)
        {
            List <JoinVpToProd> result = new List <JoinVpToProd>();

            using (Ambient.DbSession.Activate())
            {
                Dictionary <int, Product> productDict;
                List <VendorProduct>      venprodList;
                if (catId.Value == VendorProductHelper.AllCategoriesId)
                {
                    VendorProductHelper.LoadForAllCategories(vendorId, out productDict, out venprodList);
                }
                else
                {
                    VendorProductHelper.LoadForCategory(vendorId, catId, out productDict, out venprodList);
                }
                foreach (VendorProduct venprod in venprodList)
                {
                    Product      product = productDict[venprod.ProductId.Value];
                    JoinVpToProd join    = new JoinVpToProd(venprod, product);
                    join.SetExternalData(new ZeroFreightProvider());
                    result.Add(join);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        private JoinVpToProdBindingList GetVendorProducts(VendorId vendorId)
        {
            JoinVpToProdBindingList venprodJoinList = new JoinVpToProdBindingList();

            using (Ambient.DbSession.Activate())
            {
                Dictionary <int, Product> productDict;
                List <VendorProduct>      venprodList;
                if (mProductCategory.Id.Value == VendorProductHelper.AllCategoriesId)
                {
                    VendorProductHelper.LoadForAllCategories(vendorId, out productDict, out venprodList);
                }
                else
                {
                    VendorProductHelper.LoadForCategory(vendorId, mProductCategory.Id, out productDict, out venprodList);
                }
                bool showInactive = chkShowInactive.Checked;
                bool showDeleted  = chkShowDeleted.Checked;
                foreach (VendorProduct venprod in venprodList)
                {
                    Product product     = productDict[venprod.ProductId.Value];
                    bool    showProduct = true;
                    if ((product.IsProductDeleted || venprod.IsProductDeleted) && !showDeleted)
                    {
                        showProduct = false;
                    }
                    if ((!product.IsActive || !venprod.IsActive) && !showInactive)
                    {
                        showProduct = false;
                    }
                    if (showProduct)
                    {
                        JoinVpToProd join = new JoinVpToProd(venprod, product);
                        join.SetExternalData(this);
                        venprodJoinList.Add(join);
                    }
                }
            }
            return(venprodJoinList);
        }