Exemplo n.º 1
0
        private void buttondelete_Click(object sender, EventArgs e)
        {
            if (selected_house > -1)
            {
                House_Data.delete(selected_house);

                refresh();
            }
        }
Exemplo n.º 2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.CurrentCell.RowIndex > -1)
            {
                selected_house = Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value);
                House h = House_Data.find(selected_house);

                textBoxhouse_number.Text     = Convert.ToString(h.house_number);
                number_of_rooms.Value        = Convert.ToDecimal(h.number_of_rooms);
                number_of_bathrooms.Value    = Convert.ToDecimal(h.number_of_bathrooms);
                comboBoxcity.SelectedItem    = h.city;
                comboBoxstate.SelectedItem   = h.state;
                comboBoxcountry.SelectedItem = h.country;
                textBoxprice.Text            = Convert.ToString(h.price);
                textBoxstreet_name.Text      = Convert.ToString(h.street_name);

                if (h.garage == 1)
                {
                    checkBoxgarage.Checked = true;
                }
                else
                {
                    checkBoxgarage.Checked = false;
                }


                if (h.pool == 1)
                {
                    checkBoxpool.Checked = true;
                }
                else
                {
                    checkBoxpool.Checked = false;
                }


                if (h.fireplace == 1)
                {
                    checkBoxfireplace.Checked = true;
                }
                else
                {
                    checkBoxfireplace.Checked = false;
                }
            }
        }
Exemplo n.º 3
0
        private void button5_Click(object sender, EventArgs e)
        {
            int garage = 0, pool = 0, fire_place = 0;

            if (checkBoxgarage.Checked == true)
            {
                garage = 1;
            }
            if (checkBoxpool.Checked == true)
            {
                pool = 1;
            }

            if (checkBoxfireplace.Checked == true)
            {
                fire_place = 1;
            }

            House house = new House();

            house.id                  = 1;
            house.house_number        = Convert.ToInt32(textBoxhouse_number.Text.Trim());
            house.number_of_bathrooms = Convert.ToInt32(number_of_bathrooms.Value);
            house.number_of_rooms     = Convert.ToInt32(number_of_rooms.Value);
            house.pool                = pool;
            house.fireplace           = fire_place;
            house.garage              = garage;
            house.city                = comboBoxcity.SelectedItem.ToString();
            house.state               = comboBoxstate.SelectedItem.ToString();
            house.country             = comboBoxcountry.SelectedItem.ToString();
            house.price               = Convert.ToInt32(textBoxprice.Text.Trim());
            house.street_name         = textBoxstreet_name.Text.Trim();


            house_list.Add(house);
            House_Data.Save_house(house);
            dataGridView1.DataSource = house_list;
        }