public void Add() { if (TableComboBox.Text == "Клиент") { AddEditClient addEditClient = new AddEditClient(db, datagrid, false); addEditClient.Show(); } if (TableComboBox.Text == "Сотрудник") { AddEditEmployee addEditEmployee = new AddEditEmployee(db, datagrid, false); addEditEmployee.Show(); } if (TableComboBox.Text == "Заказ") { AddEditOrder addEditOrder = new AddEditOrder(db, datagrid, false); addEditOrder.Show(); } if (TableComboBox.Text == "Отель") { AddEditHotel addEditHotel = new AddEditHotel(db, datagrid, false); addEditHotel.Show(); } if (TableComboBox.Text == "Точка остановки") { AddEditTour_point addEditTourPoint = new AddEditTour_point(db, datagrid, false); addEditTourPoint.Show(); } if (TableComboBox.Text == "Тур") { AddEditTour addEditTour = new AddEditTour(db, datagrid, false); addEditTour.Show(); } }
public void Edit() { if (TableComboBox.Text == "Клиент") { if (datagrid.SelectedIndex >= 0 && datagrid.SelectedIndex < db.Clients.Count()) { AddEditClient addEditClient = new AddEditClient(db, datagrid, true); addEditClient.Show(); } } if (TableComboBox.Text == "Сотрудник") { if (datagrid.SelectedIndex >= 0 && datagrid.SelectedIndex < db.Employees.Count()) { AddEditEmployee addEditEmployee = new AddEditEmployee(db, datagrid, true); addEditEmployee.Show(); } } if (TableComboBox.Text == "Заказ") { if (datagrid.SelectedIndex >= 0 && datagrid.SelectedIndex < db.Orders.Count()) { AddEditOrder addEditOrder = new AddEditOrder(db, datagrid, true); addEditOrder.Show(); } } if (TableComboBox.Text == "Отель") { if (datagrid.SelectedIndex >= 0 && datagrid.SelectedIndex < db.Hotels.Count()) { AddEditHotel addEditHotel = new AddEditHotel(db, datagrid, true); addEditHotel.Show(); } } if (TableComboBox.Text == "Точка остановки") { if (datagrid.SelectedIndex >= 0 && datagrid.SelectedIndex < db.Tour_point.Count()) { AddEditTour_point addEditTourPoint = new AddEditTour_point(db, datagrid, true); addEditTourPoint.Show(); } } if (TableComboBox.Text == "Тур") { if (datagrid.SelectedIndex >= 0 && datagrid.SelectedIndex < db.Tours.Count()) { AddEditTour AddEddSym = new AddEditTour(db, datagrid, true); AddEddSym.Show(); } } }