private void btnNew_Click(object sender, EventArgs e) { Agregar AE = new Agregar(null); AE.TopLevel = false; AE.Dock = DockStyle.None; Controls.Add(AE); Tag = AE; AE.Location = new Point(50, 50); AE.BringToFront(); AE.FormClosed += new FormClosedEventHandler(AE_FormClosed); AE.Show(); }
private void tblEmployesFilter_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { CEEmpleado empleado = new CEEmpleado { documento = tblEmployesFilter.CurrentRow.Cells["DOCUMENTO"].Value.ToString(), codigo = Convert.ToInt32(tblEmployesFilter.CurrentRow.Cells["CODIGO"].Value), nombre1 = tblEmployesFilter.CurrentRow.Cells["NOMBRE1"].Value.ToString(), nombre2 = tblEmployesFilter.CurrentRow.Cells["NOMBRE2"].Value.ToString(), apellido1 = tblEmployesFilter.CurrentRow.Cells["APELLIDO1"].Value.ToString(), apellido2 = tblEmployesFilter.CurrentRow.Cells["APELLIDO2"].Value.ToString(), asiTeclado = Convert.ToBoolean(tblEmployesFilter.CurrentRow.Cells["TECLADO"].Value), asiMouse = Convert.ToBoolean(tblEmployesFilter.CurrentRow.Cells["MOUSE"].Value), asiPuesto = Convert.ToBoolean(tblEmployesFilter.CurrentRow.Cells["PUESTO"].Value), asiBase = Convert.ToBoolean(tblEmployesFilter.CurrentRow.Cells["BASE"].Value), asiMaletin = Convert.ToBoolean(tblEmployesFilter.CurrentRow.Cells["MALETIN"].Value), asiMorral = Convert.ToBoolean(tblEmployesFilter.CurrentRow.Cells["MORRAL"].Value), asiCorreo = Convert.ToBoolean(tblEmployesFilter.CurrentRow.Cells["CORREO"].Value), nombreCompleto = tblEmployesFilter.CurrentRow.Cells["NOMBRES"].Value.ToString(), telefono = tblEmployesFilter.CurrentRow.Cells["TELEFONO"].Value.ToString(), correo = tblEmployesFilter.CurrentRow.Cells["EMP_CORREO"].Value.ToString(), numeroPuesto = tblEmployesFilter.CurrentRow.Cells["PUESTO_N"].Value.ToString(), fechaIngreso = tblEmployesFilter.CurrentRow.Cells["INGRESO"].Value.ToString(), fechaSalida = tblEmployesFilter.CurrentRow.Cells["SALIDA"].Value.ToString(), fechaModifi = tblEmployesFilter.CurrentRow.Cells["FECHAMODIFI"].Value.ToString(), usuarioModifi = tblEmployesFilter.CurrentRow.Cells["USUMODIFI"].Value.ToString(), observacion = tblEmployesFilter.CurrentRow.Cells["OBSERVACION"].Value.ToString(), proyecto = new CEProyecto { id = Convert.ToInt32(tblEmployesFilter.CurrentRow.Cells["PROYECTO_ID"].Value), descripcion = tblEmployesFilter.CurrentRow.Cells["PROYECTO"].Value.ToString() }, sede = new CESede { id = Convert.ToInt32(tblEmployesFilter.CurrentRow.Cells["SEDE_ID"].Value), descripcion = tblEmployesFilter.CurrentRow.Cells["SEDE"].Value.ToString() }, ubicacion = new CEUbicacion { id = Convert.ToInt32(tblEmployesFilter.CurrentRow.Cells["UBICACION_ID"].Value), descripcion = tblEmployesFilter.CurrentRow.Cells["UBICACION"].Value.ToString() } }; if (EmpAsignar == null) { Agregar AE = new Agregar(empleado); AE.TopLevel = false; AE.Dock = DockStyle.None; Controls.Add(AE); Tag = AE; AE.Location = new Point(50, 50); AE.BringToFront(); AE.FormClosed += new FormClosedEventHandler(AE_FormClosed); AE.Show(); } else { switch (EmpAsignar) { case "ASIGNAR": IPersonaAsignar parent = this.Owner as IPersonaAsignar; parent.AgregarPersonaAsignar(empleado); break; case "DEVOLVER": IPersonaDevolver parent2 = this.Owner as IPersonaDevolver; parent2.AgregarPersonaDevolver(empleado); break; case "PRESTAR": IPersonaPrestar parent3 = this.Owner as IPersonaPrestar; parent3.AgregarPersonaPrestar(empleado); break; } Close(); } } } catch (Exception ex) { MessageBox.Show("Hubo un error en tiempo de ejecuciĆ³n: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }