예제 #1
0
 private void telephoneClientBTN_Click(object sender, EventArgs e)
 {
     try
     {
         MySqlConnection con = new MySqlConnection(connectBD);
         con.Open();
         string       request = "SELECT client from ttelephone WHERE telephone='" + telephoneClient.Text + "';";
         MySqlCommand command = new MySqlCommand(request, con);
         command.ExecuteNonQuery();
         ClientForm cf = new ClientForm(Convert.ToInt32(command.ExecuteScalar().ToString()), this);
         cf.Show();
         con.Close();
     }
     catch
     {
         MessageBox.Show("Клиент с данным номером телефона не найден!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #2
0
        private void idClientBTN_Click(object sender, EventArgs e)
        {
            MySqlConnection con = new MySqlConnection(connectBD);

            con.Open();
            string       request = "SELECT name from client where id_client=" + idClient.Text + ";";
            MySqlCommand command = new MySqlCommand(request, con);

            try
            {
                if (command.ExecuteScalar().ToString() != "")
                {
                    con.Close();
                    ClientForm cf = new ClientForm(Convert.ToInt32(idClient.Text), this);
                    cf.Show();
                }
            }
            catch
            {
                MessageBox.Show("Пользователь с таким ID не найден!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                con.Close();
            }
            idClient.Text = "";
        }
예제 #3
0
        private void newClient_Click(object sender, EventArgs e)
        {
            ClientForm cf = new ClientForm(0, this);

            cf.Show();
        }