Esempio n. 1
0
 private void searchbtn_Click(object sender, EventArgs e)
 {
     if (categorycb.Text == "All" && statuscb.Text == "All")
     {
         dataGridView1.DataSource       = lc.getCustomerAll();
         dataGridView1.Columns[0].Width = 30;
         dataGridView1.Columns[1].Width = 60;
         dataGridView1.Columns[2].Width = 140;
         dataGridView1.Columns[3].Width = 160;
         dataGridView1.Columns[6].Width = 80;
         dataGridView1.Columns[7].Width = 80;
         dataGridView1.Columns[8].Width = 50;
     }
     else if (categorycb.Text != "All" && statuscb.Text == "All")
     {
         dataGridView1.DataSource       = lc.getCustomerByCategory(Convert.ToInt32(categorycb.SelectedValue));
         dataGridView1.Columns[0].Width = 30;
         dataGridView1.Columns[1].Width = 60;
         dataGridView1.Columns[2].Width = 140;
         dataGridView1.Columns[3].Width = 160;
         dataGridView1.Columns[6].Width = 80;
         dataGridView1.Columns[7].Width = 80;
         dataGridView1.Columns[8].Width = 50;
     }
     else if (categorycb.Text == "All" && statuscb.Text != "All")
     {
         dataGridView1.DataSource       = lc.getCustomerByStatus(statuscb.Text);
         dataGridView1.Columns[0].Width = 30;
         dataGridView1.Columns[1].Width = 60;
         dataGridView1.Columns[2].Width = 140;
         dataGridView1.Columns[3].Width = 160;
         dataGridView1.Columns[6].Width = 80;
         dataGridView1.Columns[7].Width = 80;
         dataGridView1.Columns[8].Width = 50;
     }
     else if (categorycb.Text != "All" && statuscb.Text != "All")
     {
         dataGridView1.DataSource       = lc.getCustomerByCategoryAndStatus(Convert.ToInt32(categorycb.SelectedValue), statuscb.Text);
         dataGridView1.Columns[0].Width = 30;
         dataGridView1.Columns[1].Width = 60;
         dataGridView1.Columns[2].Width = 140;
         dataGridView1.Columns[3].Width = 160;
         dataGridView1.Columns[6].Width = 80;
         dataGridView1.Columns[7].Width = 80;
         dataGridView1.Columns[8].Width = 50;
     }
 }