using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BimaryDetect
{
    public partial class frmJostoJoo : Form
    {
        public frmJostoJoo()
        {
            InitializeComponent();
        }

        protected void dbSearch()
        {
            FirstClass db = new FirstClass();
            DataTable dt = new DataTable();
            dt = db.dbOut(@"SELECT     dbo.Bimary.BimaryID AS [کد بیماری], dbo.Bimary.BimaryName AS [نام بیماری], dbo.Bimary.AlamatHa AS علامتها, dbo.Bimary.Tozihat AS توضیحات, 
                            dbo.DarooHa.DarooName AS [نام دارو], dbo.DarooTypes.DarooTypeDescription AS [نوع دارو] FROM         dbo.Bimary INNER JOIN
                            dbo.DarooHa ON dbo.Bimary.DarooID = dbo.DarooHa.DarooID INNER JOIN dbo.DarooTypes ON dbo.DarooHa.DarooType = dbo.DarooTypes.DarooTypeID
                            WHERE     (dbo.Bimary.AlamatHa LIKE N'%" + textBox1.Text.Trim() + "%') OR (dbo.Bimary.AlamatHa LIKE N'%" + textBox2.Text.Trim() + "%') OR (dbo.Bimary.AlamatHa LIKE N'%" + textBox3.Text.Trim() + "%') ");
            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("موردی یافت نشد");
            }
            else
            {
                dataGridView1.DataSource = dt;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            dbSearch();
        }
    }
}