private void Button_Click(object sender, RoutedEventArgs e) { try { int price = Convert.ToInt32(Price.Text); string number = Number.Text; if (number.Length == 16) { if (price > 0) { mw.Add($"insert into Orders values({UserID}, {IDArticle}, '{number}', {price})"); Article article = GetArticle(); MessageBox.Show($"Заказ успешно Отправлен \n {article.Name}, {article.Brand}, {article.Body}, {article.Price}, {article.Year}, {article.Kpp}, {article.Oil}, {article.Privod}, {article.Type} "); } else { MessageBox.Show("Цена отрицательна"); } } else { MessageBox.Show("Неверный номер карты"); Number.Text = ""; } } catch (Exception err) { MessageBox.Show(err.Message); } }
private void ConrirmClick(object sender, RoutedEventArgs e) { if (mainWindow.RegexLogin(Login.Text)) { if (mainWindow.RegexPassword(Password.Password)) { if (RepeatPassword.Password.Equals(Password.Password)) { try { mainWindow.Add($"insert into Users values('{Login.Text}', '{Password.Password}')"); MessageBox.Show("Успешно создан"); mainWindow.OpenPage(MainWindow.Pages.main); } catch (Exception error) { MessageBox.Show(error.Message); } } else { MessageBox.Show("Пароли не совпадают"); } } else { MessageBox.Show("Пароль обязан быть 8-20 символовв"); } } else { MessageBox.Show("Логин обязан быть 4-15 символов"); } }
private void Delete_Click(object sender, RoutedEventArgs e) { mw.Add($"delete from AutoPrivods where [name] = '{Name.Text}'"); Table.ItemsSource = GetPrivods(); }
private void Delete_Click(object sender, RoutedEventArgs e) { mw.Add($"delete from AutoOils where [name] = '{Content.Text}'"); Table.ItemsSource = GetOils(); }