private void cBoxIndexSelectedExc ursion object sender EventArgs try L

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
private void cBoxIndexSelectedExcursion(object sender, EventArgs e)
{
try
{
List<string> mas = new List<string>();
foreach (var sBox in ExcursionPanel.Controls.OfType<ComboBox>())
{
mas.Add(sBox.Text);
}
mas[0] = mas[0] != "" ? " and cost= '" + mas[0] + "'" : mas[0];
mas[1] = mas[1] != "" ? " and graphic= '" + mas[1] + "'" : mas[1];
mas[2] = mas[2] != "" ? " and personal.secondname= '" + mas[2] + "'" : mas[2];
string comandExcursion = "select graphic as График, st_time as Время, start as Начало, end as Конец, cost as Цена, personal.name as Имя, personal.secondName as Фамилия, personal.patronomyc as Отчество, personal.post as Должность from excursion, personal where personal.id = ic" + mas[0] + mas[1] + mas[2] + ";";
dataGridView1.DataSource = querry.getTable(comandExcursion);
mas.Clear();
}
catch (Exception ex)
{
MessageBox.Show("Something went wrong:\n" + ex.ToString());
}
}