Exemplo n.º 1
0
        private void buttonAddFlat_Click(object sender, EventArgs e)
        {
            int   number;
            float area;
            int   room;

            try {
                number = Convert.ToInt32(textBoxNumber.Text);
                area   = Convert.ToSingle(textBoxArea.Text);
                room   = Convert.ToInt32(textBoxRoom.Text);
                if (flat > number)
                {
                    string query = "insert into apartment values (" + number + "," + area + "," + room + "," + house + ")";
                    Ado.ExecuteNonQuery(query);
                    Main.RefForm.fillFlats(house);
                    MessageBox.Show("Добавлено!");
                }
                else
                {
                    MessageBox.Show("Количество квартир в доме превышено");
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Exemplo n.º 2
0
        private void buttonDelHouse_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Хотите удалить запись? Все другие записи, связанные с ней будут удалены", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Yes)
            {
                string query = "delete from house where id='" + textBoxId.Text + "'";
                Ado.ExecuteNonQuery(query);
                Main.RefForm.fillBuilds();
                MessageBox.Show("Удалено!");
            }
        }
Exemplo n.º 3
0
        private void buttonAddDweller_Click(object sender, EventArgs e)
        {
            string surn, name, middle, phone;
            int    age;

            try
            {
                surn   = textBoxSurn.Text;
                name   = textBoxName.Text;
                middle = textBoxMiddle.Text;
                phone  = textBoxPhone.Text;
                age    = Convert.ToInt32(textBoxAge.Text);
                string query = "insert into dwellers values ('" + surn + "','" + name + "','" + middle + "','" + phone + "'," + age + "," + flat + ")";
                Ado.ExecuteNonQuery(query);
                Main.RefForm.fillDwellers(flat);
                MessageBox.Show("Добавлено!");
            }
            catch (Exception exc) {
                MessageBox.Show(exc.Message);
            }
        }
Exemplo n.º 4
0
        private void buttonUpdFlat_Click(object sender, EventArgs e)
        {
            int   number;
            float area;
            int   room;

            try
            {
                number = Convert.ToInt32(textBoxNumber.Text);
                room   = Convert.ToInt32(textBoxFlat.Text);
                area   = Convert.ToSingle(textBoxArea.Text);
                string query = "update apartment set number = " + number + ", area=" + area + ",numberofrooms=" + room + " where id = '" + textBoxId.Text + "'";
                Ado.ExecuteNonQuery(query);
                Main.RefForm.fillFlats(house);
                MessageBox.Show("Изменено!");
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Exemplo n.º 5
0
        private void buttonAddHouse_Click(object sender, EventArgs e)
        {
            int    number, floor, entr, flat;
            string street;

            try
            {
                number = Convert.ToInt32(textBoxNumber.Text);
                floor  = Convert.ToInt32(textBoxFloor.Text);
                entr   = Convert.ToInt32(textBoxEntr.Text);
                flat   = Convert.ToInt32(textBoxFlat.Text);
                street = textBoxStreet.Text;
                string query = "insert into house values ('" + number + "','" + street + "','" + floor + "','" + entr + "','" + flat + "')";
                Ado.ExecuteNonQuery(query);
                Main.RefForm.fillBuilds();
                MessageBox.Show("Добавлено!");
            }
            catch (Exception exc) {
                MessageBox.Show(exc.Message);
            }
        }
Exemplo n.º 6
0
        private void buttonUpdHouse_Click(object sender, EventArgs e)
        {
            int    number, floor, entr, flat;
            string street;

            try
            {
                number = Convert.ToInt32(textBoxNumber.Text);
                floor  = Convert.ToInt32(textBoxFloor.Text);
                entr   = Convert.ToInt32(textBoxEntr.Text);
                flat   = Convert.ToInt32(textBoxFlat.Text);
                street = textBoxStreet.Text;
                string query = "update house set number = '" + number + "', street='" + street + "',numberoffloors='" + floor + "',numberofentrances='" + entr + "',numberofflat='" + flat + "' where id = '" + textBoxId.Text + "'";
                Ado.ExecuteNonQuery(query);
                Main.RefForm.fillBuilds();
                MessageBox.Show("Изменено!");
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Exemplo n.º 7
0
        private void buttonUpdFlat_Click(object sender, EventArgs e)
        {
            string surn, name, middle, phone;
            int    age;

            try
            {
                surn   = textBoxSurn.Text;
                name   = textBoxName.Text;
                middle = textBoxMiddle.Text;
                phone  = textBoxPhone.Text;
                age    = Convert.ToInt32(textBoxAge.Text);
                string query = "update dwellers set surname='" + surn + "',name='" + name + "',middlename='" + middle + "',phone='" + phone + "',age=" + age + "where id='" + textBoxId.Text + "'";
                Ado.ExecuteNonQuery(query);
                Main.RefForm.fillDwellers(flat);
                MessageBox.Show("Изменено!");
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }