Example #1
0
        private void BtnEliminarEmpleado_Click(object sender, EventArgs e)
        {
            try
            {
                ClsEmp       cEmp   = new ClsEmp();
                DialogResult result = MessageBox.Show("¿Desea eliminar los contactos seleccionados?", "Contactos", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    if (dgvContactos.SelectedRows.Count > 0)
                    {
                        DataGridViewSelectedRowCollection Seleccionados = dgvContactos.SelectedRows;

                        foreach (DataGridViewRow item in Seleccionados)
                        {
                            Type type = item.DataBoundItem.GetType();
                            cEmp.IdEmpleado = (int)type.GetProperty("IdEmpleado")
                                              .GetValue(item.DataBoundItem, null);

                            cEmp.EliminarEmpleado();
                        }
                        CargarGrid(txtIntroduzcaTexto.Text, Convert.ToInt32(cmbClientes.SelectedValue));
                    }
                    else
                    {
                        MessageBox.Show("No hay contactos seleccionado", "Contactos", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    }
                }
            }
            catch (Exception ex)
            {
                _ = ex.Message;
            }
        }
Example #2
0
        private void BtnEditarEmpleado_Click(object sender, EventArgs e)
        {
            try
            {
                ClsEmp cEmp = new ClsEmp();
                using (GendocsModeloDatos.models.GenDocsContext db = new GendocsModeloDatos.models.GenDocsContext())
                {
                    var lst = (from d in db.GdEmpleados
                               where (d.Empleado.Contains(txtIntroduzcaTexto.Text))
                               orderby d.IdEmpleado
                               select d.IdEmpleado

                               ).ToList();

                    cEmp.LstId = lst;
                    cEmp.CargarFrmEmpleados();
                }
                cmbClientes.SelectedIndex = -1;
                txtIntroduzcaTexto.Text   = string.Empty;
                txtIntroduzcaTexto.Focus();
                CargarGrid();
            }
            catch (Exception ex)
            {
                _ = ex.Message;
            }
        }
Example #3
0
 private void BtnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         ClsEmp cEmp = new ClsEmp();
         using (GendocsModeloDatos.models.GenDocsContext db = new GendocsModeloDatos.models.GenDocsContext())
         {
             List <int> miLista = new List <int>();
             for (int i = 0; i < dgvContactos.SelectedRows.Count; i++)
             {
                 miLista.Add(Convert.ToInt32(dgvContactos.SelectedRows[i].Cells[0].Value.ToString()));
             }
             cEmp.LstId   = miLista.ToList();
             cEmp.EsNuevo = false;
             cEmp.CargarFrmEmpleados();
         }
         cmbClientes.SelectedIndex = 0;
         txtIntroduzcaTexto.Text   = string.Empty;
         txtIntroduzcaTexto.Focus();
         CargarGrid();
     }
     catch (Exception ex)
     {
         _ = ex.Message;
     }
 }
Example #4
0
        private void BtnEtiquetas_Click(object sender, EventArgs e)
        {
            ClsEmp CEmp = new ClsEmp
            {
                IdEmpleado = Int32.Parse(txtIdEmpleado.Text)
            };

            CEmp.AsignarEtiquetasFML();
            //CargarForm();
            txtEtiquetas.Text = CEmp.Etiquetas;
        }
Example #5
0
 private void BtnNuevo_Click(object sender, EventArgs e)
 {
     try
     {
         ClsEmp cEmp = new ClsEmp
         {
             EsAlta  = true,
             EsNuevo = true
         };
         cEmp.CargarFrmEmpleados();
         cmbClientes.SelectedIndex = -1;
         txtIntroduzcaTexto.Text   = string.Empty;
         txtIntroduzcaTexto.Focus();
         CargarGrid();
     }
     catch (Exception ex)
     {
         _ = ex.Message;
     }
 }
Example #6
0
        private void DgvContactos_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                ClsEmp cEmp = new ClsEmp();
                using GendocsModeloDatos.models.GenDocsContext db = new GendocsModeloDatos.models.GenDocsContext();
                var lst = (from d in db.GdEmpleados
                           where (d.IdEmpleado == Convert.ToInt32(dgvContactos.Rows[e.RowIndex].Cells[0].Value))
                           select d.IdEmpleado

                           ).ToList();

                cEmp.LstId = lst;
                cEmp.CargarFrmEmpleados();
            }
            catch (Exception ex)
            {
                _ = ex.Message;
            }
        }
Example #7
0
 public FrmMantenimientoEmpleados(ClsEmp Cemp)
 {
     CEmp = Cemp;
     InitializeComponent();
 }
 public FrmEtiquetarEmpleado(ClsEmp cemp)
 {
     CEmp = cemp;
     InitializeComponent();
 }