private void button1_Click(object sender, EventArgs e) { bool x = false; Quarto q = new Quarto(); Cliente c = new Cliente(); if (codH.Text.Length != 0 && numQ.Text.Length != 0 && numC.Text.Length != 0 && extra.Text.Length != 0) { c.NumeroCliente = Int32.Parse(numC.Text); q = new Quarto(c, Convert.ToDateTime(fimR.Text)); x = ControlaQuartos.AddQuarto(q, Int32.Parse(numQ.Text), Int32.Parse(codH.Text)); } else { MessageBox.Show("Campos por preencher!!!"); } try { q = new Quarto(c, Convert.ToDateTime(fimR)); } catch (Exception ex) { throw new Exception(ex.Message); } if (x == false) { MessageBox.Show("Reserva ao quarto " + codH.Text + " adicionada!"); this.Hide(); } this.Close(); m1 = new Thread(volta_Menu); m1.TrySetApartmentState(ApartmentState.STA); m1.Start(); }