示例#1
0
        private void edit_button_Click(object sender, EventArgs e)
        {
            string    morada = casas_dataGrid.CurrentRow.Cells[0].Value.ToString();
            CasaModel tmp    = new CasaModel();

            data.connectToDB();
            //String sql = String.Format("SELECT * FROM proj_casa WHERE morada = '" + morada + "'");
            //MessageBox.Show(sql);
            SqlCommand com = new SqlCommand("getCasaByMorada", data.connection());

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@morada", morada);
            SqlDataReader reader;

            reader = com.ExecuteReader();
            while (reader.Read())
            {
                tmp.morada     = reader.GetString(0);
                tmp.n_quartos  = reader.GetInt32(1);
                tmp.cidade     = reader.GetString(2);
                tmp.max_hab    = reader.GetInt32(3);
                tmp.descricao  = reader.GetString(4);
                tmp.condominio = reader.GetDecimal(5);
            }
            data.close();

            AddCasa addCasa = new AddCasa(tmp);

            addCasa.ShowDialog(this);
        }
示例#2
0
        private void add_bt_Click(object sender, EventArgs e)
        {
            AddCasa add = new AddCasa();

            add.ShowDialog();
        }
示例#3
0
        private void button3_Click(object sender, EventArgs e)
        {
            AddCasa add = new AddCasa(getCasa(casa_selected()));

            add.ShowDialog(this);
        }
示例#4
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddCasa add = new AddCasa();

            add.ShowDialog(this);
        }