Exemplo n.º 1
0
        private void btnFilter_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFilter.Text))
            {
                MessageBox.Show("Please enter text to filter with first.");
                return;
            }
            JoinVpToProdBindingList filteredList = new JoinVpToProdBindingList();

            foreach (JoinVpToProd join in mUnfilteredVendorProducts)
            {
                if ((join.Product_ProductName.IndexOf(txtFilter.Text, StringComparison.InvariantCultureIgnoreCase) >= 0) ||
                    (join.VendorProduct_VendorPartNum.IndexOf(txtFilter.Text, StringComparison.InvariantCultureIgnoreCase) >= 0))
                {
                    filteredList.Add(join);
                }
            }
            mHelper.DataSource = null;
            mHelper.DataSource = filteredList;
        }
Exemplo n.º 2
0
 private void LoadList(Vendor vendor, ProductCategory category)
 {
     if (vendor != mVendor)
     {
         mVendor = vendor;
         if (mVendor.Shipping.EndsWith("%"))
         {
             txtFreightPercent.Text = mVendor.Shipping.Substring(0, mVendor.Shipping.Length - 1);
         }
         else
         {
             txtFreightPercent.Text = "";
         }
     }
     mProductCategory   = category;
     mHelper.DataSource = null;
     if (chkShowAllSubcats.Checked || category.Id.Value == VendorProductHelper.AllCategoriesId)
     {
         mHelper.SetProductSubCategories(GetAllSubCategories());
     }
     else
     {
         mHelper.SetProductSubCategories(GetSubCategoriesOfCategory());
     }
     mUnfilteredVendorProducts     = GetVendorProducts(vendor.Id);
     mHelper.DataSource            = mUnfilteredVendorProducts;
     mHelper.VendorId              = vendor.Id;
     grdMain.Visible               = true;
     lblBrand.Visible              = true;
     cboBrand.Visible              = true;
     lblFreightPercent.Visible     = true;
     txtFreightPercent.Visible     = true;
     btnUseExistingProduct.Visible = true;
     btnImport.Visible             = true;
     btnShowOrdersUsedBy.Visible   = true;
     txtFilter.Visible             = true;
     btnFilter.Visible             = true;
     btnClearFilter.Visible        = true;
     btnPrint.Visible              = true;
     btnRefreshOrders.Visible      = true;
 }
Exemplo n.º 3
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);
        }