private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e) { curacc = false; if (listBox1.SelectedItem != null) { string curill = listBox1.SelectedItem.ToString(); string connectionString = @"Data Source=LAPTOP-96NT0MPR;Initial Catalog=kursach;Integrated Security=True"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(); command.Connection = connection; string sqlExpression = "SELECT * FROM Иллюстратор WHERE Логин_иллюстратора = '" + curill + "'"; SqlCommand commandread = new SqlCommand(sqlExpression, connection); SqlDataReader reader = commandread.ExecuteReader(); reader.Read(); long num = 0; if (reader.GetValue(4) == DBNull.Value) { num = 0; } else { num = reader.GetInt64(4); } illustratoraccount = new Account(reader.GetInt32(0), reader.GetString(2), reader.GetString(3), reader.GetString(1), num, "Иллюстратор"); } if (currentaccount.id == illustratoraccount.id && currentaccount.type == illustratoraccount.type) { curacc = true; } IllustratorAccount acc = new IllustratorAccount(curacc); acc.Show(); } }
private void аккаунтToolStripMenuItem_Click(object sender, EventArgs e) { curacc = true; if (currentaccount.type == "Покупатель") { CustomerAccount acc = new CustomerAccount(curacc); acc.Show(); } if (currentaccount.type == "Иллюстратор") { IllustratorAccount acc = new IllustratorAccount(curacc); acc.Show(); } }