Beispiel #1
0
        private void button_Click(object sender, EventArgs e)
        {
            Button      button = sender as Button;
            Database    db     = new Database();
            List <Cars> res    = db.getCars(Int32.Parse(button.Name));

            this.Hide();
            ListModels order = new ListModels(mainClient, res);

            order.Closed += (s, args) => this.Close();
            order.Show();
        }
Beispiel #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1 && checkedListBox1.CheckedIndices.Count > 0 && comboBox2.SelectedIndex > -1 &&
         comboBox3.SelectedIndex > -1 && comboBox4.SelectedIndex > -1 && comboBox5.SelectedIndex > -1)
     {
         Database db          = new Database();
         String   extra_names = "";
         foreach (var item in checkedListBox1.CheckedItems)
         {
             extra_names += item.ToString() + ",";
         }
         extra_names = extra_names.Remove(extra_names.Length - 1);
         extra_names = extra_names.Replace("\t", " ");
         while (extra_names.IndexOf("  ") >= 0)
         {
             extra_names = extra_names.Replace("  ", " ");
         }
         int        brandID      = db.getBrandID(comboBox1.Text);
         decimal    mainPrice    = Decimal.Parse(comboBox2.Text);
         int        year         = Int32.Parse(comboBox4.Text);
         int        colorID      = db.getColorID(comboBox3.Text);
         int        km           = Int32.Parse(comboBox5.Text);
         List <int> extra_ids    = db.getExtrasID(extra_names);
         String     extras_query = "";
         foreach (var extr in extra_ids)
         {
             extras_query += extr.ToString() + ",";
         }
         extras_query = extras_query.Remove(extras_query.Length - 1);
         List <Cars> res = db.getFilteredCars(brandID, extras_query, mainPrice, year, colorID, km);
         this.Hide();
         ListModels order = new ListModels(mainClient, res);
         order.Closed += (s, args) => this.Close();
         order.Show();
     }
     else
     {
         MessageBox.Show("Моля попълнете всички критерии");
     }
 }