Exemplo n.º 1
0
        private void AddRoomButton_Click(object sender, EventArgs e)
        {
            if (RoomPriceTextBox.Text == "")
            {
                MessageBox.Show("Please, enter at least the room type, price and associated department.");
            }
            else
            {
                int r = controllerObj.A_AddRoom((string)RoomTypeComboBox.SelectedItem,
                                                RoomSizeTextBox.Text.ToString(),
                                                Convert.ToInt32(RoomPriceTextBox.Text.ToString()),
                                                (int)depComboBox.SelectedValue);

                if (r > 0)
                {
                    MessageBox.Show("Room added successfully.");

                    DataTable dt1 = controllerObj.SelectRoomIDs();
                    RoomsComboBox.DataSource    = dt1;
                    RoomsComboBox.DisplayMember = "RID";
                    RoomsComboBox.ValueMember   = "RID";
                }
                else
                {
                    MessageBox.Show("Error in adding room.");
                }
            }
        }