private void sellTourBtn_Click(object sender, RoutedEventArgs e) { SQLite connection = new SQLite(); if (checkFull()) { if (Check.checkFloatNumber(priceBox.Text)) { connection.WriteData(string.Format("INSERT INTO Tours (SID, CID, Date, Count, Discount, Price) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", routeId, clientId, dateBox.Text, int.Parse(countBox.Text), discountBox.Text, float.Parse(priceBox.Text))); MessageBox.Show("Путевка успешно добавлена!", "Предупреждение", MessageBoxButton.OK); Close(); } else { MessageBox.Show("В поле \"Стоимость\" должно быть введено число!", "Предупреждение", MessageBoxButton.OK); } } else { MessageBox.Show("Заполните все поля!", "Предупреждение", MessageBoxButton.OK); } }
/* удаление клиента */ private void DeleteClientBtn_Click(object sender, RoutedEventArgs e) { if (clientsList.SelectedItem != null) { if (Confirm("Удалить выбранного клиента?")) { var id = (clientsList.SelectedItem as Client).Id; SQLite connection = new SQLite(); connection.WriteData(string.Format("DELETE FROM Clients WHERE ID = '{0}'", id)); UpdateClientsList(null); } } else { MessageBox.Show("Клиент не выбран!", "Предупреждение", MessageBoxButton.OK); } }
/* удаление маршрута */ private void DeleteRouteBtn_Click(object sender, RoutedEventArgs e) { if (routesList.SelectedItem != null) { if (Confirm("Удалить выбранный маршрут?")) { var id = (routesList.SelectedItem as Route).Id; SQLite connection = new SQLite(); connection.WriteData(string.Format("DELETE FROM Scopes WHERE ID = '{0}'", id)); loadRoutes(); } } else { MessageBox.Show("Маршрут не выбран!", "Предупреждение", MessageBoxButton.OK); } }