예제 #1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                EmpleadoBL empleado   = new EmpleadoBL();
                DataSet    dsEmpleado = new DataSet();
                dsEmpleado = empleado.buscarId(Convert.ToInt32(txtidentificador.Text));
                if (dsEmpleado.Tables.Count > 0)
                {
                    if (dsEmpleado.Tables[0].Rows.Count > 0)
                    {
                        txtidentificador.Text = dsEmpleado.Tables[0].Rows[0][0].ToString();
                    }
                    txtNombreEmp.Text = dsEmpleado.Tables[0].Rows[0][1].ToString();
                    cmbGeneroEmp.Text = dsEmpleado.Tables[0].Rows[0][2].ToString();
                    cmbCargoEmp.Text  = dsEmpleado.Tables[0].Rows[0][3].ToString();
                    dtFecha.Value     = Convert.ToDateTime(dsEmpleado.Tables[0].Rows[0][4].ToString());
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
예제 #2
0
        public IActionResult Index()
        {
            List <Empleado> lista = new EmpleadoBL().GetEmpleados();

            ViewData["ListaEmpleados"] = lista;
            return(View());
        }
예제 #3
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DialogResult opcion;

            opcion = MessageBox.Show("Realmente desea borrar empleado?", "sistema de ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (opcion == DialogResult.OK)
            {
                var result = true;
                empRules = new EmpleadoBL();
                result   = empRules.Delete(txtId.Text);

                if (result)
                {
                    GetMessageInfo("Eliminado con exito");
                }
                else
                {
                    GetMessageError("Error");
                }
            }

            ClearTextBoxes(this.Controls);
            dglist.DataSource = null;
        }
예제 #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            EmpleadoBL      contexto = new EmpleadoBL();
            List <Empleado> lista    = contexto.GetEmpleados();

            listBox1.DataSource    = lista;
            listBox1.DisplayMember = "Nombre";
            listBox1.ValueMember   = "Id";
        }
예제 #5
0
        public void LlenarGridEmpleado()
        {
            EmpleadoBL cli = new EmpleadoBL();

            dgvEmp.DataSource = cli.LlenarEmpleados();

            CambiarTextoColumnasDG();
            CambiarNombreColumnasDG();
        }
예제 #6
0
        protected void btnMostrarNombre_Click(object sender, EventArgs e)
        {
            EmpleadoBL logica   = new EmpleadoBL();
            EmpleadoBE empleado = new EmpleadoBE();

            empleado = logica.getEmpleado();

            txtNombre.Text = empleado.Nombre;
            txtEdad.Text   = empleado.Edad.ToString();
        }
        // GET: Empleados
        public ActionResult Index()
        {
            EmpleadoBL empleadoBD = new EmpleadoBL();

            var             _empleado = empleadoBD.ObtenerTodos();
            List <Empleado> result    = (_empleado).Cast <Empleado>().ToList();


            return(View(result));
        }
예제 #8
0
        // GET: Empleados
        public ActionResult Index()
        {
            EmpleadoBL               neg   = new EmpleadoBL();
            List <EmpleadoM>         Lst   = neg.ObtenerLista().ToList();
            List <ViewModelEmpleado> Lista = new List <ViewModelEmpleado>();

            foreach (EmpleadoM item in Lst)
            {
                ViewModelEmpleado tem = new ViewModelEmpleado(item);
                Lista.Add(tem);
            }
            return(View(Lista));
        }
예제 #9
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                EmpleadoBL empleado = new EmpleadoBL();
                empleado.actualizar(Convert.ToInt32(txtIdEmp.Text), txtNombreEmp.Text, cmbGeneroEmp.Text, cmbCargoEmp.Text, dtpFechaNacEmp.Value);
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
예제 #10
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                EmpleadoBL empleado = new EmpleadoBL();
                empleado.eliminar(Convert.ToInt32(txtIdEmp.Text));
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
예제 #11
0
        public ActionResult Edit([Bind(Include = "Id,Id_Tipo_Documento,Numero_Documento,Nombre,Apellido,EStado")] ViewModelEmpleado viewModelEmpleado)
        {
            if (ModelState.IsValid)
            {
                db.Entry(viewModelEmpleado).State = EntityState.Modified;

                EmpleadoM  item = viewModelEmpleado.Castear();
                EmpleadoBL neg  = new EmpleadoBL();
                neg.Modificar(item);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(viewModelEmpleado));
        }
예제 #12
0
        public ActionResult Create([Bind(Include = "Id,Id_Tipo_Documento,Numero_Documento,Nombre,Apellido,EStado")] ViewModelEmpleado viewModelEmpleado)
        {
            if (ModelState.IsValid)
            {
                EmpleadoBL neg = new EmpleadoBL();
                viewModelEmpleado.Estado = true;
                EmpleadoM item = viewModelEmpleado.Castear();
                neg.Crear(item);
                //db.ViewModelEmpleadoes.Add(viewModelEmpleado);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(viewModelEmpleado));
        }
예제 #13
0
 //GET: Planilla/Ver
 public ActionResult Ver(int id = 0)
 {
     if (Session["TipoUsuario"] != null && (Session["TipoUsuario"].ToString().Equals("EMPLEADO") || Session["TipoUsuario"].ToString().Equals("ADMINISTRADOR")))
     {
         try
         {
             if (id != 0)
             {
                 AltaPlanillaViewModel viewModel = new AltaPlanillaViewModel();
                 viewModel.planilla = planillaBL.obtener(id);
                 EmpleadoBL emp = new EmpleadoBL();
                 viewModel.Empleado            = emp.obtener(Convert.ToInt32(Session["IdUsuario"]));
                 viewModel.planilla.empleado   = emp.obtener(viewModel.planilla.empleado.Id);
                 viewModel.CantidadEmpleados88 = emp.obtenerCantidadEmpleados88();
                 viewModel.PorcentajeFirmas    = viewModel.planilla.Empleados.Count * 100 / (viewModel.CantidadEmpleados88 - 1);
                 if (Session["TipoUsuario"] != null && Session["TipoUsuario"].ToString().Equals("EMPLEADO"))
                 {
                     viewModel.comprobarFirmas();
                 }
                 return(View(viewModel));
             }
             else
             {
                 ViewBag.Mensaje = "No selecciono el usuario correctamente.";
                 return(View("~/Views/Shared/_Mensajes.cshtml"));
             }
         }
         catch (ProyectoException ex)
         {
             ViewBag.Mensaje = ex.Message;
             return(View("~/Views/Shared/_Mensajes.cshtml"));
         }
     }
     else
     {
         try
         {
             ViewBag.Mensaje = "No tiene permisos para relalizar esta acción.";
             return(View("~/Views/Shared/_Mensajes.cshtml"));
         }
         catch (ProyectoException ex)
         {
             ViewBag.Mensaje = ex.Message;
             return(View("~/Views/Shared/_Mensajes.cshtml"));
         }
     }
 }
예제 #14
0
        static void Main(string[] args)
        {
            Console.WriteLine("Trabajando con Base de datos en C#");
            EmpleadoBL      contexto = new EmpleadoBL();
            List <Empleado> lista    = contexto.GetEmpleados();

            foreach (Empleado item in lista)
            {
                Console.WriteLine(item.Nombre);
            }
            //ConectarASQLServer();
            //MostrarDatosDeEmpleado();
            //InsertarNuevoEmpleado("David", 34, 600.00M);
            //ActualizarEmpleado("Juan", 1500);
            //EliminarEmpleado();
            //CerrarConexion();
        }
예제 #15
0
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            string mensaje = "Debe seleccionar un registro válido antes de eliminar." +
                             " Por favor seleccione un registro en la pestaña de busqueda que" +
                             "desea eliminar y vuelva a intentarlo.";

            try
            {
                if (ID < 1)
                {
                    MessageBox.Show(mensaje, "Error de eliminación",
                                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    tabControl1.SelectedIndex = 0;
                }
                else
                {
                    mensaje = "Realmente desea eliminar el registro de nombre: " +
                              txtEmpleado.Text + "?";
                    DialogResult resultado = MessageBox.Show(mensaje, "¿Desea eliminar?",
                                                             MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                             MessageBoxDefaultButton.Button2);

                    if (resultado == DialogResult.Yes)
                    {
                        mensaje = "Registro Eliminado.";
                        Empleados  entidad  = new Empleados();
                        EmpleadoBL eliminar = new EmpleadoBL();
                        entidad.CodEmp = ID;
                        eliminar.EliminarEmpleado(entidad);

                        LlenarGridEmpleado();
                        btnNuevo.PerformClick();
                        tabControl1.SelectedIndex = 0;

                        MessageBox.Show(mensaje, "Eliminación",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #16
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            empRules = new EmpleadoBL();

            if (cbOptiones.Text == "Departamento" && cbDepartamentos.Text != string.Empty)
            {
                var empleados = empRules.GetByDepartment(cbDepartamentos.Text);
                dglist.DataSource = empleados;
            }
            if (cbOptiones.Text == "Nombre" && txtBuscar.Text != string.Empty)
            {
                var empleados = empRules.GetByName(txtBuscar.Text);
                dglist.DataSource = empleados;
            }
            else if (cbOptiones.Text == string.Empty)
            {
                GetMessageInfo("Debe Seleccionar una opcion de busqueda");
            }
        }
예제 #17
0
        public ActionResult DeleteConfirmed(string id)
        {
            //ViewModelEmpleado viewModelEmpleado = db.ViewModelEmpleadoes.Find(id);
            EmpleadoBL neg  = new EmpleadoBL();
            EmpleadoM  temp = new EmpleadoM
            {
                Id_Empleado     = id,
                Estado_Empleado = true
            };

            temp = neg.ObtenerLista(temp).FirstOrDefault();
            if (temp != null)
            {
                temp.Estado_Empleado = false;
                neg.Modificar(temp);
            }
            //db.ViewModelEmpleadoes.Remove(viewModelEmpleado);
            //db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #18
0
        private void EmpleadoUI_Load(object sender, EventArgs e)
        {
            try
            {
                EmpleadoBL empleado   = new EmpleadoBL();
                DataSet    dsEmpleado = new DataSet();
                dsEmpleado = empleado.buscarTodo();
                if (dsEmpleado.Tables.Count > 0)
                {
                    dtgEmpleado.DataSource = dsEmpleado.Tables[0];
                    //dtgEmpleado.AllowUserToAddRows = false;
                    //  dtgEmpleado.Columns[2].Visible = false;
                    //  dtgEmpleado.Columns[4].Visible = false;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
예제 #19
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("¿Estás seguro que quiere actualizar este empleado al sistema?", "",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                else
                {
                    EmpleadoBL empleado = new EmpleadoBL();
                    empleado.actualizar(Convert.ToInt32(this.dtgEmpleado.CurrentRow.Cells[0].Value.ToString()), txtNombreEmp.Text, cmbGeneroEmp.Text, cmbCargoEmp.Text, Convert.ToDateTime(dtFecha.Text));
                    this.EmpleadoUI_Load(sender, e);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
예제 #20
0
        /// <summary>
        /// Obtiene un Empleado por Id para implementar la ayuda.
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public EmpleadoInfo ObtenerPorID(EmpleadoInfo info)
        {
            EmpleadoInfo empleadoInfo;

            try
            {
                Logger.Info();
                empleadoInfo = new EmpleadoInfo();
                var bl = new EmpleadoBL();
                empleadoInfo = bl.ObtenerPorID(info.EmpleadoID);
            }
            catch (ExcepcionGenerica)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
            return(empleadoInfo);
        }
예제 #21
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("¿Estás seguro que quiere eliminar este empleado del sistema?", "",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                else
                {
                    EmpleadoBL empleado = new EmpleadoBL();
                    empleado.eliminar(Convert.ToInt32(this.dtgEmpleado.CurrentRow.Cells[0].Value.ToString()));
                    this.EmpleadoUI_Load(sender, e);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
예제 #22
0
        /// <summary>
        ///     Obtiene un lista paginada de Empelados
        /// </summary>
        /// <param name="pagina"></param>
        /// <param name="filtro"></param>
        /// <returns></returns>
        public ResultadoInfo <EmpleadoInfo> ObtenerPorPagina(PaginacionInfo pagina, EmpleadoInfo filtro)
        {
            ResultadoInfo <EmpleadoInfo> resultado;

            try
            {
                Logger.Info();
                resultado = new ResultadoInfo <EmpleadoInfo>();
                var bl = new EmpleadoBL();
                resultado = bl.ObtenerPorPagina(pagina, filtro);
            }
            catch (ExcepcionGenerica)
            {
                throw;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex);
            }
            return(resultado);
        }
예제 #23
0
        public MainWindowViewModel()
        {
            EmpleadoActual = new EmpleadoModel();
            InitializeEmpleadoActual();

            empleadoBL      = new EmpleadoBL();
            empleadoCargoBL = new EmpleadoCargoBL();

            Empleados = new ObservableCollection <EmpleadoModel>();
            LoadEmpleados();
            Cargos = new ObservableCollection <string>();
            LoadCargos();

            //ATTACH METHOD TO COMMAND
            GuardarCambios = new BaseCommand(SaveChanges);

            Actualizar = new BaseCommand((args) =>
            {
                var emp = (EmpleadoModel)args;
                EmpleadoActual.IdEmpleado       = emp.IdEmpleado;
                EmpleadoActual.NombreEmpleado   = emp.NombreEmpleado;
                EmpleadoActual.ApellidoEmpleado = emp.ApellidoEmpleado;
                EmpleadoActual.CargoEmpleado    = emp.CargoEmpleado;
                EmpleadoActual.EdadEmpleado     = emp.EdadEmpleado;
                //MessageBox.Show($"Actualizando {args}");
            });

            Eliminar = new BaseCommand((args) =>
            {
                var rpta = MessageBox.Show("¿Esta seguro que desea eliminar este empleado?", "Confirmacion", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (rpta == MessageBoxResult.Yes)
                {
                    empleadoBL.Delete(args);
                }
                //MessageBox.Show($"Eliminando {args}");
                LoadEmpleados();
            });
        }
예제 #24
0
        // GET: Empleados/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmpleadoBL neg  = new EmpleadoBL();
            EmpleadoM  temp = new EmpleadoM
            {
                Id_Empleado     = id,
                Estado_Empleado = true
            };

            temp = neg.ObtenerLista(temp).FirstOrDefault();
            ViewBag.TiposDocumento = ObtenerTipoDocumentos();
            ViewModelEmpleado viewModelEmpleado = new ViewModelEmpleado(temp); //db.ViewModelEmpleadoes.Find(id);

            if (viewModelEmpleado == null)
            {
                return(HttpNotFound());
            }
            return(View(viewModelEmpleado));
        }
예제 #25
0
        private void btnInsertar_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("¿Estás seguro que quiere agregar este empleado al sistema?", "",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
                else
                {
                    EmpleadoBL empleado = new EmpleadoBL();
                    //   empleado.insertar(Convert.ToInt32(txtIdEmp.Text), txtNombreEmp.Text, cmbGeneroEmp.Text, cmbCargoEmp.Text, dtpFechaNacEmp.Value);
                    empleado.insertar(txtNombreEmp.Text, cmbGeneroEmp.Text, cmbCargoEmp.Text, Convert.ToDateTime(dtFecha.Text));
                    this.EmpleadoUI_Load(sender, e);
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }
        }
예제 #26
0
        private void TxtBusqueda_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (e.KeyChar == '\r')
                {
                    e.Handled = true;

                    EmpleadoBL busqueda = new EmpleadoBL();
                    if (rbNombre.Checked == true)
                    {
                        dgvEmp.DataSource = busqueda.BusquedaEmpleado(txtBusqueda.Text, rbNombre.Text);
                    }
                    else if (rbSalario.Checked == true)
                    {
                        dgvEmp.DataSource = busqueda.BusquedaEmpleado(txtBusqueda.Text, rbSalario.Text);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-ES");

                try {
                    ProyectoBL pBL = new ProyectoBL();
                    cboProyecto.DataSource     = pBL.ListarProyectos();
                    cboProyecto.DataTextField  = "Nombre";
                    cboProyecto.DataValueField = "ID Proyecto";
                    cboProyecto.DataBind();
                } catch (Exception ex) {
                    lblMensaje.Text = "Error al poblar opciones de proyecto : " + ex.Message;
                    mpeMensaje.Show();
                }

                try {
                    EmpleadoBL eBL = new EmpleadoBL();
                    cboEncargado.DataSource     = eBL.ListarEmpleadosFull();
                    cboEncargado.DataTextField  = "Nombre Completo";
                    cboEncargado.DataValueField = "ID Empleado";
                    cboEncargado.DataBind();
                } catch (Exception ex) {
                    lblMensaje.Text = "Error al poblar opciones de persona : " + ex.Message;
                    mpeMensaje.Show();
                }

                try {
                    EmpleadoBL eBL = new EmpleadoBL();
                    cboAprobadoPor.DataSource     = eBL.ListarEmpleadosFull();
                    cboAprobadoPor.DataTextField  = "Nombre Completo";
                    cboAprobadoPor.DataValueField = "ID Empleado";
                    cboAprobadoPor.DataBind();
                } catch (Exception ex) {
                    lblMensaje.Text = "Error al poblar opciones de persona : " + ex.Message;
                    mpeMensaje.Show();
                }

                try {
                    ClienteBL clBL = new ClienteBL();
                    cboEnviar.DataSource     = clBL.ListarClientesFull();
                    cboEnviar.DataTextField  = "Nombre Cliente";
                    cboEnviar.DataValueField = "ID Persona";
                    cboEnviar.DataBind();
                } catch (Exception ex) {
                    lblMensaje.Text = "Error al poblar opciones de persona : " + ex.Message;
                    mpeMensaje.Show();
                }

                try {
                    ArticuloBL eBL = new ArticuloBL();
                    cboProducto.DataSource     = eBL.ListarArticulos();
                    cboProducto.DataTextField  = "nom_articulo";
                    cboProducto.DataValueField = "id_item";
                    cboProducto.DataBind();
                } catch (Exception ex) {
                    lblMensaje.Text = "Error al poblar opciones de producto : " + ex.Message;
                    mpeMensaje.Show();
                }
                CrearTabla();
            }
        }
        public ActionResult AbrirEmpleadoComite(string codigo)
        {
            var model = EmpleadoBL.ListarEmpleadoDeComite(codigo);

            return(PartialView("_ListaEmpleado", model));
        }
예제 #29
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            if (validar())
            {
                string respuesta;
                string mensaje = "Registro agregado con éxito.";

                EmpleadoBL cli     = new EmpleadoBL();
                Empleados  entidad = new Empleados();

                if (txtEmpleado.Text == string.Empty)
                {
                    txtEmpleado.Text = null;
                }
                if (txtSueldoInic.Text == string.Empty)
                {
                    txtSueldoInic.Text = "0.00";
                }
                if (txtSueldoAct.Text == string.Empty)
                {
                    txtSueldoAct.Text = "0.00";
                }

                if (cbDepto.SelectedValue.ToString() == string.Empty || cbDepto.SelectedValue.ToString() == "A")
                {
                    entidad.DeptoId = null;
                }
                else
                {
                    entidad.DeptoId = cbDepto.SelectedValue.ToString();
                }

                if (ID > 0)
                {
                    entidad.CodEmp = ID;

                    mensaje = "Este ID ya se encuentra registrado. Favor cambiarlo o " +
                              "hacer click en Actualizar si desea cambiar el registro. Gracias.";
                    MessageBox.Show(mensaje, "Error al Guardar",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                entidad.NombreEmp  = txtEmpleado.Text;
                entidad.SueldoInic = float.Parse(txtSueldoInic.Text);
                entidad.SueldoAct  = float.Parse(txtSueldoAct.Text);
                entidad.Activo     = chkActivo.Checked;

                respuesta = cli.RegEmpleado(entidad);

                switch (respuesta)
                {
                case "exito":
                    MessageBox.Show(mensaje, "Agregado",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information
                                    );
                    btnNuevo.PerformClick();
                    LlenarGridEmpleado();
                    tabControl1.SelectedIndex = 0;
                    break;

                case "existe":
                    mensaje = "Este ID ya se encuentra registrado. Favor cambiarlo o " +
                              "hacer click en Actualizar si desea cambiar el registro. Gracias.";
                    MessageBox.Show(mensaje, "Error al Guardar",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error
                                    );
                    break;

                default:
                    MessageBox.Show(
                        respuesta,
                        "Error al Registrar",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error
                        );
                    break;
                }
            }
            else
            {
                MessageBox.Show("Hay campos que son obligatorios y se encuentran vacios.", "Error de validación", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
예제 #30
0
        private void BtnActualizar_Click(object sender, EventArgs e)
        {
            string mensaje = "Debe seleccionar un registro válido antes de actualizar. " +
                             "Por favor seleccione un registro en la pestaña de busqueda que " +
                             "desea actualizar y vuelva a intentarlo.";

            try
            {
                Empleados  entidad    = new Empleados();
                EmpleadoBL actualizar = new EmpleadoBL();

                if (txtEmpleado.Text == string.Empty)
                {
                    txtEmpleado.Text = null;
                }
                if (txtSueldoInic.Text == string.Empty)
                {
                    txtSueldoInic.Text = "0.00";
                }
                if (txtSueldoAct.Text == string.Empty)
                {
                    txtSueldoAct.Text = "0.00";
                }

                if (cbDepto.SelectedValue.ToString() == string.Empty || cbDepto.SelectedValue.ToString() == "A")
                {
                    entidad.DeptoId = null;
                }
                else
                {
                    entidad.DeptoId = cbDepto.SelectedValue.ToString();
                }

                if (ID < 1)
                {
                    MessageBox.Show(mensaje, "Error de Actualización",
                                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    tabControl1.SelectedIndex = 0;
                }
                else
                {
                    mensaje            = "Registro Actualizado.";
                    entidad.CodEmp     = ID;
                    entidad.NombreEmp  = txtEmpleado.Text;
                    entidad.SueldoInic = float.Parse(txtSueldoInic.Text);
                    entidad.SueldoAct  = float.Parse(txtSueldoAct.Text);
                    entidad.Activo     = chkActivo.Checked;

                    actualizar.ActualizarEmpleado(entidad);

                    LlenarGridEmpleado();
                    MessageBox.Show(mensaje, "Actualización",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    btnNuevo.PerformClick();
                    tabControl1.SelectedIndex = 0;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }