Exemplo n.º 1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (txtNombreAgr.Text == "" || txtApellidoAgr.Text == "" || txtContactoAgr.Text == "" || cmbPuestosAgr.Items.Count <= 0)
            {
                MessageBox.Show("Debe completar todos los campos", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Empleado        empleado = new Empleado();
                EmpleadoNegocio negocio  = new EmpleadoNegocio();

                empleado.nombre   = txtNombreAgr.Text;
                empleado.apellido = txtApellidoAgr.Text;
                empleado.contacto = txtContactoAgr.Text;
                empleado.puesto   = (Puesto)cmbPuestosAgr.SelectedItem;

                if (rdbPeluqueria.Checked == true)
                {
                    empleado.rubro = rdbPeluqueria.Text;
                }
                if (rdbVeterinaria.Checked == true)
                {
                    empleado.rubro = rdbVeterinaria.Text;
                }

                negocio.CargarEmpleado(empleado);
                cargarGrilla();

                txtApellidoAgr.Text = "";
                txtNombreAgr.Text   = "";
                txtContactoAgr.Text = "";
            }
        }