Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool x = false;

            if (codE.Text.Length != 0 && codH.Text.Length != 0)
            {
                x = ControlaEmpregados.RemoveEmpregado(Int32.Parse(codE.Text), Int32.Parse(codH.Text));
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }

            if (x)
            {
                MessageBox.Show("O empregado foi removido com sucesso.");
                this.Hide();
            }
            else
            {
                MessageBox.Show("Empregado não existe!");
            }
            this.Close();
            m1 = new Thread(volta_Menu);
            m1.TrySetApartmentState(ApartmentState.STA);
            m1.Start();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool      x   = false;
            Empregado emp = new Empregado();

            if (nome.Text.Length != 0 && idade.Text.Length != 0 && nif.Text.Length != 0 && numTel.Text.Length != 0 && codE.Text.Length != 0 && venc.Text.Length != 0 && codH.Text.Length != 0)
            {
                emp = new Empregado(nome.Text, Int32.Parse(idade.Text), Int32.Parse(nif.Text), Int32.Parse(venc.Text), Int32.Parse(numTel.Text), Int32.Parse(codE.Text));
                x   = ControlaEmpregados.AddEmpregado(emp, Int32.Parse(codE.Text));
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }
            try
            {
                emp = new Empregado(nome.Text, Int32.Parse(idade.Text), Int32.Parse(nif.Text), Int32.Parse(venc.Text), Int32.Parse(numTel.Text), Int32.Parse(codE.Text));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            if (x == false)
            {
                MessageBox.Show("Empregado " + nome.Text + " adicionado!");
                this.Hide();
            }
            this.Close();
            m1 = new Thread(volta_Menu);
            m1.TrySetApartmentState(ApartmentState.STA);
            m1.Start();
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Empregado emp = new Empregado();

            if (codE.Text.Length != 0 && codH.Text.Length != 0)
            {
                ControlaEmpregados.GetEmpregado(Int32.Parse(codE.Text), Int32.Parse(codH.Text));
                if (Int32.Parse(codE.Text) == emp.IDEmpregado)
                {
                    MessageBox.Show("Empregado Encontrado");
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Empregado não existe!");
                }
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }
            this.Close();
            m1 = new Thread(volta_Menu);
            m1.TrySetApartmentState(ApartmentState.STA);
            m1.Start();
        }
Esempio n. 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            Empregado emp = new Empregado();

            if (codE.Text.Length != 0 && codH.Text.Length != 0)
            {
                ControlaEmpregados.GetEmpregado(Int32.Parse(codE.Text), Int32.Parse(codH.Text));
                if (Int32.Parse(codE.Text) == emp.IDEmpregado)
                {
                    dataGridView1.DataSource = ControlaEmpregados.RegistoEmpregado(Int32.Parse(codE.Text), Int32.Parse(codH.Text));
                }
                else
                {
                    MessageBox.Show("Empregado não existe!");
                }
            }
            else
            {
                MessageBox.Show("Campos por preencher!!!");
            }
        }