private void ButtonClickSave(object sender, RoutedEventArgs e) { try { if (String.IsNullOrEmpty(TextFamile.Text) && String.IsNullOrEmpty(TextName.Text) && String.IsNullOrEmpty(TextDoubleName.Text) && String.IsNullOrEmpty(TextAdres.Text) && String.IsNullOrEmpty(TextPostalAdres.Text) && String.IsNullOrEmpty(TextMS.Text) && String.IsNullOrEmpty(TextNumberPhone.Text) && String.IsNullOrEmpty(TextEmaill.Text) && String.IsNullOrEmpty(TextBank.Text) && String.IsNullOrEmpty(TextPaymentAccount.Text) && String.IsNullOrEmpty(TextINNAndKPP.Text) && String.IsNullOrEmpty(TextBIC.Text) && String.IsNullOrEmpty(TextCorrespondentAccount.Text)) { MessageBox.Show("Не все поля заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string query = $"insert Clients (Surname,Name,Otchestvo,Emall,Phone,Adres,MailingAddress,INNandKPP,PaymentAccount,Bank,CorrespondentAccount,BIC,MsPassport)" + $" values " + $"(N'{TextFamile.Text}',N'{TextName.Text}',N'{TextDoubleName.Text}',N'{TextEmaill.Text}',N'{TextNumberPhone.Text}',N'{TextAdres.Text}',N'{TextPostalAdres.Text}',N'{TextINNAndKPP.Text}',N'{TextPaymentAccount.Text}',N'{TextBank.Text}',{TextCorrespondentAccount.Text},N'{TextBIC.Text}',N'{TextMS.Text}')"; DateClass Add = new DateClass(); Add.NewAdd(ConnectionString, query); Close(); View.Show(); } } catch { } }
private void ButtonClickRegistration(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(TextFamile.Text) && String.IsNullOrEmpty(TextName.Text) && String.IsNullOrEmpty(TextDoubleName.Text) && String.IsNullOrEmpty(TextEmail.Text) && String.IsNullOrEmpty(TextNumber.Text)) { MessageBox.Show("Не все поля заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string query = $"insert Insurance_agent (Surname,Name,Otchestvo,Emall,Phone) values (N'{TextFamile.Text}',N'{TextName.Text}',N'{TextDoubleName.Text}',N'{TextEmail.Text}',N'{TextNumber.Text}')"; DateClass Add = new DateClass(); Add.NewAdd(MainWindow.connectionString, query); main.Show(); this.Close(); } }