Пример #1
0
        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);
        }
Пример #2
0
        private void add_button_Click(object sender, EventArgs e)
        {
            AddEmpresa add = new AddEmpresa();

            add.ShowDialog(this);
        }
Пример #3
0
        private void add_bt_Click(object sender, EventArgs e)
        {
            AddEmpresa em = new AddEmpresa();

            em.ShowDialog();
        }
Пример #4
0
        private void edit_button_Click(object sender, EventArgs e)
        {
            AddEmpresa add = new AddEmpresa(GetEmpresaInfo(empresa_selected()));

            add.ShowDialog(this);
        }