Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            HotelBO h = new HotelBO();

            if (codH.Text.Length != 0)
            {
                ControlaHoteis.InfoHotel(Int32.Parse(codH.Text));
                if (Int32.Parse(codH.Text) == h.Cod)
                {
                    MessageBox.Show("Hotel Encontrado");
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Hotel não existe!");
                }
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }
            this.Close();
            m1 = new Thread(volta_Menu);
            m1.TrySetApartmentState(ApartmentState.STA);
            m1.Start();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool x = false;

            if (codH.Text.Length != 0)
            {
                x = ControlaHoteis.RemoveHotel(Int32.Parse(codH.Text));
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }

            if (x)
            {
                MessageBox.Show("O hotel foi removido com sucesso.");
                this.Hide();
            }
            else
            {
                MessageBox.Show("Hotel não existe!");
            }
            this.Close();
            m1 = new Thread(volta_Menu);
            m1.TrySetApartmentState(ApartmentState.STA);
            m1.Start();
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string x;

            if (codH.Text.Length != 0)
            {
                x = ControlaHoteis.NumQuartosLivres(Int32.Parse(codH.Text)).ToString();
                MessageBox.Show("{0} quartos livres", x);
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }

            /*
             * else
             * {
             *     MessageBox.Show("Codigo Hotel Invalido");
             * }
             */


            this.Close();
            m1 = new Thread(volta_Menu);
            m1.TrySetApartmentState(ApartmentState.STA);
            m1.Start();
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool    x     = false;
            HotelBO hotel = new HotelBO();

            if (nome.Text.Length != 0 && codH.Text.Length != 0 && morada.Text.Length != 0 && numTel.Text.Length != 0 && numQ.Text.Length != 0)
            {
                hotel = new HotelBO(nome.Text, morada.Text, Int32.Parse(numQ.Text), Int32.Parse(codH.Text));
                x     = ControlaHoteis.AddHotel(hotel);
                MessageBox.Show("Hotel " + nome.Text + " adicionado!");
                this.Hide();
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }
            try
            {
                hotel = new HotelBO(nome.Text, morada.Text, Int32.Parse(numQ.Text), Int32.Parse(codH.Text));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            /*
             * if (!x)
             * {
             *  MessageBox.Show("Hotel " + nome.Text + " adicionado!");
             *  this.Hide();
             * }*/
            this.Close();
            m1 = new Thread(volta_Menu);
            m1.TrySetApartmentState(ApartmentState.STA);
            m1.Start();
        }