using System; using System.Data; using System.Data.SqlClient; using System.Windows.Forms; namespace Servise.Forms.User { public partial class AddClient : Form { public AddClient() { InitializeComponent(); } DataBase conect = new DataBase(); private void saveClient_Click(object sender, EventArgs e) { conect.openConect(); string nc = textNameClient.Text; string sc = textSurnameClient.Text; string pc = maskedPhoneClient.Text; var indert = "INSERT INTO client (name_client, surname_client, phone_client) VALUES ('" + nc + "','" + sc + "','" + pc + "');"; var command = new SqlCommand(indert, conect.getConect()); command.ExecuteNonQuery(); Main.upd("SELECT * FROM client", dataClient, "id_client"); conect.closeConect(); } private void AddClient_Load(object sender, EventArgs e) { Main.upd("SELECT * FROM client", dataClient, "id_client"); } private void AddClient_FormClosed(object sender, FormClosedEventArgs e) { Application.Exit(); } private void button1_Click(object sender, EventArgs e) { if (textNameClient.Text == "") { textNameClient.Text = " "; } if (textSurnameClient.Text == "") { textSurnameClient.Text = " "; } if (maskedPhoneClient.Text == "") { maskedPhoneClient.Text = " "; } Main.upd("SELECT * FROM client where name_client LIKE '%" + textNameClient.Text + "%' or surname_client LIKE '%" + textSurnameClient.Text + "%' or phone_client LIKE '%" + maskedPhoneClient.Text + "%'", dataClient, "id_client"); } private void button2_Click(object sender, EventArgs e) { this.Hide(); Users goUser = new Users(); goUser.Show(); } private void label1_Click(object sender, EventArgs e) { } private void textSurnameClient_TextChanged(object sender, EventArgs e) { } } }