Beispiel #1
0
        private void UpdateRoomButton_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_UpdateRoom(Convert.ToInt32(RoomsComboBox.SelectedValue),
                                                   (string)RoomTypeComboBox.SelectedItem,
                                                   RoomSizeTextBox.Text.ToString(),
                                                   Convert.ToInt32(RoomPriceTextBox.Text.ToString()),
                                                   (int)depComboBox.SelectedValue);

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

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