Example #1
0
        private void btnGravar_Click(object sender, EventArgs e)
        {
            try
            {
                Types.CargoType type = new Types.CargoType();
                type.Descricao = txtDescricao.Text;
                type.IdDepartamento = Int32.Parse(cmbDepartamento.SelectedValue.ToString());

                CargoBLL itemBLL = new CargoBLL();
                if (txtID.Text == "")
                {
                    txtID.Text = Convert.ToString(itemBLL.insert(type));
                }
                else
                {
                    type.IdCargo = Convert.ToInt32(txtID.Text);
                    itemBLL.alterar(type);
                }
            }
            catch (Exception erro)
            {
                MessageBox.Show("Erro ao gravar. Mensagem: " +
                    erro.Message, "Erro", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            findAll();
        }