示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Stok eklemek için ürün arama butonu
            dataGridView1.Rows.Clear();
            List <ProductModel> pm = new List <ProductModel>();

            if (comboBox1.SelectedIndex == 0)
            {
                pm = HelperProduct.GetListByProductname(textBox1.Text);
            }
            else if (comboBox1.SelectedIndex == 1)
            {
                pm = HelperProduct.GetListByCompanyName(textBox1.Text);
            }
            else if (comboBox1.SelectedIndex == 2)
            {
                pm = HelperProduct.GetListByCategoryName(textBox1.Text);
            }

            foreach (var item in pm)
            {
                if (item.IsActive == true)
                {
                    dataGridView1.Rows.Add(item.productID, item.productName, item.Supplier.companyName, item.category.categoryName, item.unitPrice, item.dateOfAdded, item.stringDiscounted);
                }
            }
            textBox1.Clear();
        }