public List <Product> Get(ProductBrandId brandId, ProductCategoryId productCategoryId)
 {
     return(Search("dbo.GetProductsByBrandCategory",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@BrandId", brandId.Value);
         SqlHelper.AddParamInputId(cmd, "@ProductCategoryId", productCategoryId.Value);
     }));
 }
 public List <Product> Get(ProductBrandId brandId, string productName, string size)
 {
     return(Search("dbo.GetProductsByBrandNameSize",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@BrandId", brandId.Value);
         SqlHelper.AddParamVarchar(cmd, "@ProductName", productName);
         SqlHelper.AddParamVarchar(cmd, "@Size", size);
     }));
 }
Exemple #3
0
        private void btnSetBrands_Click(object sender, EventArgs e)
        {
            bool                   onFirstRow    = true;
            ProductBrandId         brandId       = null;
            int                    numberSet     = 0;
            int                    numberSkipped = 0;
            List <DataGridViewRow> sortedRows    = new List <DataGridViewRow>();

            foreach (DataGridViewRow row in grdLines.SelectedRows)
            {
                sortedRows.Add(row);
            }
            sortedRows.Sort((r1, r2) => r1.Index.CompareTo(r2.Index));
            foreach (DataGridViewRow row in sortedRows)
            {
                JoinPlToVpToProd purLine = (JoinPlToVpToProd)row.DataBoundItem;
                if (onFirstRow)
                {
                    brandId = purLine.PurLine_ProductBrandId;
                    ProductBrand brand  = mBrandsById[brandId.Value];
                    string       prompt = "Use brand \"" + brand.BrandName + "\"?";
                    if (MessageBox.Show(prompt, "Confirm", MessageBoxButtons.OKCancel) != DialogResult.OK)
                    {
                        return;
                    }
                    onFirstRow = false;
                }
                else
                {
                    if (purLine.PurLine_VendorProductId.IsNull)
                    {
                        purLine.PurLine_ProductBrandId = brandId;
                        using (Ambient.DbSession.Activate())
                        {
                            OrderingRepositories.PurLine.Update(purLine.InnerPurLine);
                            numberSet++;
                        }
                    }
                    else
                    {
                        numberSkipped++;
                    }
                }
            }
            MessageBox.Show("Set brand for " + numberSet.ToString() + " rows.");
            MessageBox.Show("Skipped " + numberSkipped.ToString() + " rows because they were not manually added or imported to this order.");
            ShowLines();
            ShowTotalCost();
        }
        public List <BrandUsageSummary> Get(ProductBrandId productBrandId)
        {
            List <BrandUsageSummary> results = new List <BrandUsageSummary>();

            using (PooledConnection pooledCon = GetPooledConnection())
            {
                using (SqlCommand cmd = SqlHelper.CreateProc("dbo.GetVendorCategoryByBrand", pooledCon))
                {
                    SqlHelper.AddParamInputId(cmd, "@ProductBrandId", productBrandId.Value);
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            BrandUsageSummary sum = new BrandUsageSummary();
                            sum.VendorId   = new VendorId((int)reader["VendorId"]);
                            sum.CategoryId = new ProductCategoryId((int)reader["ProductCategoryId"]);
                            results.Add(sum);
                        }
                    }
                }
            }
            return(results);
        }