Exemple #1
0
 public static bool Eliminar(Entidades.Empleados empleado)
 {
     using (var repositorio = new Repositorio <Entidades.Empleados>())
     {
         return(repositorio.Eliminar(empleado));
     }
 }
Exemple #2
0
        private void LlenarDataEmail(Entidades.Empleados empleado)
        {
            dataGridEmail.DataSource = null;
            dataGridEmail.DataSource = empleado.EmailsList.ToList();

            this.dataGridEmail.Columns["Id"].Visible         = false;
            this.dataGridEmail.Columns["EmpleadoId"].Visible = false;
            this.dataGridEmail.Columns["TipoEmail"].Visible  = false;
            //  this.dataGridEmail.Columns["LisRelacion"].Visible = false;
        }
        public static bool Eliminar(Entidades.Empleados existente)
        {
            bool eliminado = false;

            using (var repositorio = new Repositorio <Entidades.Empleados>())
            {
                eliminado = repositorio.Eliminar(existente);
            }

            return(eliminado);
        }
        public static Entidades.Empleados Buscar(Expression <Func <Entidades.Empleados, bool> > tipo)
        {
            Entidades.Empleados Result = null;
            using (var repoitorio = new Repositorio <Entidades.Empleados>())
            {
                Result = repoitorio.Buscar(tipo);
                if (Result != null)
                {
                    Result.Retencion.Count();
                    Result.Detalle.Count();
                }
            }

            return(Result);
        }
        public static bool Modificar(Entidades.Empleados empleado)
        {
            using (var conec = new DAL.Respository <Entidades.Empleados>())
            {
                try
                {
                    return(conec.Modificar(empleado));
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(false);
        }
Exemple #6
0
 public static bool Guardar(Entidades.Empleados empleado)
 {
     using (var repositorio = new Repositorio <Entidades.Empleados>())
     {
         if (Buscar(empleado.EmpleadoId) == null)
         {
             Console.WriteLine("\n\nGuardando\n");
             return(repositorio.Guardar(empleado));
         }
         else
         {
             Console.WriteLine("\n\nModificando\n");
             return(repositorio.Modificar(empleado));
         }
     }
 }
Exemple #7
0
        private void Limpiar()
        {
            empleadoIdMaskedTextBox.Clear();
            nombreTextBox.Clear();
            sueldoMaskedTextBox.Clear();
            nombreTextBox.Focus();
            errorProvider1.Clear();
            comboBoTipo.Text = null;
            textBoxEmail.Clear();
            Idtipo.Text = null;
            dataGridView1.DataSource = null;
            comboBoxRetenciones.Text = null;
            dataGridEmail.DataSource = null;
            Email = new Entidades.EmpleadosEmails();

            empleadoG = new Entidades.Empleados();
        }
 private void Limpiar()
 {
     empleado = new Entidades.Empleados();
     retencionSeleccionada = null;
     detalle = new Entidades.EmpleadosEmails("");
     retencionesDataGridView.DataSource = null;
     emailsDataGridView.DataSource      = null;
     empleadoIdTextBox.Clear();
     nombresTextBox.Clear();
     fechaNacimientoDateTimePicker.Value = DateTime.Today;
     sueldoTextBox.Clear();
     retencionIdTextBox.Clear();
     retencionDescripcionTextBox.Clear();
     retencionValorTextBox.Clear();
     emailIdTextBox.Clear();
     emailTipoTextBox.Clear();
     emailEmailTextBox.Clear();
     nombresTextBox.Focus();
 }
 private void buscarButton_Click(object sender, EventArgs e)
 {
     if (empleadoIdTextBox.Text != "")
     {
         empleado = BLL.EmpleadoBLL.Buscar(Utilidad.ToInt(empleadoIdTextBox.Text));
         if (empleado != null)
         {
             nombresTextBox.Text = empleado.Nombres;
             fechaNacimientoDateTimePicker.Value = empleado.FechaNacimiento;
             sueldoTextBox.Text = empleado.Sueldo.ToString();
             LlenarGridRetenciones();
             LlenarGridEmails();
         }
         else
         {
             MessageBox.Show("No encontrado...");
         }
     }
 }
Exemple #10
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            var empleado = new Entidades.Empleados();
            int id       = 0;

            try
            {
                if (!Validar())
                {
                    MessageBox.Show("Por favor llenar los campos");
                }
                else
                {
                    empleado.Nombre = nombreTextBox.Text;

                    empleado.EmpleadoId      = Utilidades.TOIN(empleadoIdMaskedTextBox.Text);
                    empleado.FechaNacimiento = Convert.ToDateTime(fechaNacimientoDateTimePicker.Text);
                    empleado.Sueldo          = Convert.ToDouble(sueldoMaskedTextBox.Text);

                    empleado.RetencionId = (int)comboBoxRetenciones.SelectedValue;

                    if (id != empleado.EmpleadoId)
                    {
                        BLL.EmpleadoBLL.Mofidicar(empleado);


                        MessageBox.Show("Modificada");
                    }
                    else
                    {
                        BLL.EmpleadoBLL.Guardar(empleado);
                        MessageBox.Show("Agregado con exito!");
                    }
                }
                Limpiar();
            }
            catch (Exception)
            {
                throw;
            }
        }
 public static bool Guardar(Entidades.Empleados empleado)
 {
     using (var db = new Parcial2Ap2Db())
     {
         try
         {
             db.Empleado.Add(empleado);
             foreach (var er in empleado.Retencion)
             {
                 db.Entry(er).State = System.Data.Entity.EntityState.Unchanged;
             }
             db.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
         return(false);
     }
 }
        public static Entidades.Empleados Buscar(Expression <Func <Entidades.Empleados, bool> > criterio)
        {
            var empleado = new Entidades.Empleados();

            using (var conec = new DAL.Respository <Entidades.Empleados>())
            {
                try
                {
                    empleado = conec.Buscar(criterio);

                    if (empleado != null)
                    {
                        empleado.Retenciones.Count();
                        empleado.Relacion.Count();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(empleado);
        }
        public static bool Guardar(Entidades.Empleados empleado)
        {
            using (var conec = new DAL.ParcialDb())
            {
                try
                {
                    conec.Empleado.Add(empleado);

                    foreach (var g in empleado.Retenciones)
                    {
                        conec.Entry(g).State = System.Data.Entity.EntityState.Unchanged;
                    }

                    conec.SaveChanges();
                    return(true);
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(false);
        }
Exemple #14
0
 private void LlenarData(Entidades.Empleados n)
 {
     dataGridView1.DataSource = null;
     dataGridView1.DataSource = n.RetencionesList.ToList();
 }
 private void FrmRegistroEmpleados_Load(object sender, EventArgs e)
 {
     empleado = new Entidades.Empleados();
     detalle  = new Entidades.EmpleadosEmails("");
 }