private void edit_bt_Click(object sender, EventArgs e) { string nif = empresas_dataGridView1.CurrentRow.Cells["nif"].Value.ToString(); // ir buscar à bd a empresa com o nif selecionado data.connectToDB(); EmpresaModel tmp = new EmpresaModel(); //String sql = String.Format("SELECT * FROM proj_empresa WHERE nif = '" + nif + "'"); //MessageBox.Show(sql); SqlCommand com = new SqlCommand("getEmpresaByNif", data.connection()); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@nif", nif); SqlDataReader reader; reader = com.ExecuteReader(); while (reader.Read()) { tmp.nome = reader["nome"].ToString(); tmp.nif = Decimal.Parse(reader["nif"].ToString()); tmp.email = reader["email"].ToString(); tmp.contacto = Decimal.Parse(reader["contacto"].ToString()); } data.close(); AddEmpresa emp = new AddEmpresa(tmp); emp.ShowDialog(this); }
private void add_button_Click(object sender, EventArgs e) { AddEmpresa add = new AddEmpresa(); add.ShowDialog(this); }
private void add_bt_Click(object sender, EventArgs e) { AddEmpresa em = new AddEmpresa(); em.ShowDialog(); }
private void edit_button_Click(object sender, EventArgs e) { AddEmpresa add = new AddEmpresa(GetEmpresaInfo(empresa_selected())); add.ShowDialog(this); }