public FilterSubjectData() { InitializeComponent(); OleDbDataBase _database = new OleDbDataBase(new FileInfo(Properties.Settings.Default.ConnectionPath)); OleDbResult _result; _result = _database.Request("Select [НаименованиеПредмета] from [Предметы]"); SubjectName.Items.Clear(); SubjectName.Items.Add("Не выбрано"); foreach (DataRow _row in _result.Table.Rows) { SubjectName.Items.Add(_row[0].ToString()); } SubjectName.SelectedIndex = 0; _result = _database.Request("Select [Фамилия] from [Преподаватели]"); Teacher.Items.Clear(); Teacher.Items.Add("Не выбрано"); foreach (DataRow _row in _result.Table.Rows) { Teacher.Items.Add(_row[0].ToString()); } Teacher.SelectedIndex = 0; _database.Dispose(); }
public FilterSpecialty() { InitializeComponent(); OleDbDataBase _database = new OleDbDataBase(new FileInfo(Properties.Settings.Default.ConnectionPath)); OleDbResult _result = _database.Request("Select [КодСпециальности] from [Специальность]"); // Сбор данных DataTable _data = _result.Table; _database.Dispose(); specCode.Items.Clear(); specCode.Items.Add("Не выбрано"); foreach (DataRow _row in _result.Table.Rows) { specCode.Items.Add(_row[0].ToString()); } specCode.SelectedIndex = 0; save.Click += (f, a) => { String Request = "SELECT [Специальность].[Код], [Специальность].[КодСпециальности], " + " [НаименованиеСпециальности] " + "FROM [Специальность]"; String Where = ""; if (specCode.SelectedIndex > 0 || _name.Text != "") { Where += " Where "; Where += (specCode.SelectedIndex > 0) ? $"[Специальность].[КодСпециальности] = '{specCode.Items[specCode.SelectedIndex].ToString()}' and " : ""; Where += (_name.Text != "") ? $"[НаименованиеСпециальности] Like '%{_name.Text}%' and " : ""; Where = Where.Remove(Where.Length - 5); } (this.Owner as Specialty).Filter( (this.Owner as Specialty).specialtyDataTable, Request + Where); Close(); }; cancel.Click += (f, a) => this.Close(); }
public FilterDiplomData() { InitializeComponent(); OleDbDataBase _database = new OleDbDataBase(new FileInfo(Properties.Settings.Default.ConnectionPath)); OleDbResult _result = _database.Request("Select [Фамилия] from [Преподаватели]"); // Сбор данных DataTable _data = _result.Table; _database.Dispose(); Teacher.Items.Clear(); Teacher.Items.Add("Не выбрано"); foreach (DataRow _row in _result.Table.Rows) { Teacher.Items.Add(_row[0].ToString()); } Teacher.SelectedIndex = 0; }
public FilterOzenkiData() { InitializeComponent(); OleDbDataBase _database = new OleDbDataBase(new FileInfo(Properties.Settings.Default.ConnectionPath)); OleDbResult _result = _database.Request("Select [НаименованиеПредмета] from [Предметы]"); // Сбор данных DataTable _data = _result.Table; _database.Dispose(); ozenkiSubject.Items.Clear(); ozenkiSubject.Items.Add("Не выбрано"); foreach (DataRow _row in _result.Table.Rows) { ozenkiSubject.Items.Add(_row[0].ToString()); } ozenkiSubject.SelectedIndex = 0; }