private void CmdAgregar_Click(object sender, EventArgs e) { FrmEdBase frmEd = new FrmEdBase(); frmEd.con = con; frmEd.modo = "C"; switch (valorSeleccionado) { case "Empleados": FrmEdEmpleados frmEmp = new FrmEdEmpleados(); frmEmp.modo = "C"; frmEmp.con = con; frmEmp.ShowDialog(); break; case "Departamentos": FrmEdDepartamentos frmDep = new FrmEdDepartamentos(); frmDep.modo = "C"; frmDep.con = con; frmDep.ShowDialog(); break; case "Marcas": FrmEdMarcas frmMarcas = new FrmEdMarcas(); frmMarcas.modo = "C"; frmMarcas.con = con; frmMarcas.ShowDialog(); break; case "Unidades_Medida": FrmEdUnidades frmUd = new FrmEdUnidades(); frmUd.con = con; frmUd.modo = "C"; frmUd.ShowDialog(); break; case "Proveedores": FrmEdProveedores frmPro = new FrmEdProveedores(); frmPro.con = con; frmPro.modo = "C"; frmPro.ShowDialog(); break; case "Articulos": FrmEdArticulos frmArt = new FrmEdArticulos(); frmArt.con = con; frmArt.modo = "C"; frmArt.ShowDialog(); break; case "Solicitud_Articulos": FrmEdSolicitudes frmSol = new FrmEdSolicitudes(); frmSol.con = con; frmSol.modo = "C"; frmSol.ShowDialog(); break; case "Orden_Compras": FrmEdOrdenes frmOrd = new FrmEdOrdenes(); frmOrd.con = con; frmOrd.modo = "C"; frmOrd.ShowDialog(); break; } }
private void DgvResultados_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { DataGridViewRow row = this.DgvResultados.SelectedRows[0]; FrmEdBase frmEd = new FrmEdBase(); switch (valorSeleccionado) { case "Empleados": FrmEdEmpleados frmEmp = new FrmEdEmpleados(); frmEmp.ID = (int)row.Cells[0].Value; frmEmp.cedula = row.Cells[1].Value.ToString(); frmEmp.nombre = row.Cells[2].Value.ToString(); frmEmp.departamento = row.Cells[3].Value.ToString(); frmEmp.estado = row.Cells[4].Value.ToString(); frmEmp.con = con; frmEmp.modo = "U"; frmEmp.ShowDialog(); break; case "Departamentos": FrmEdDepartamentos frmDep = new FrmEdDepartamentos(); frmDep.ID = (int)row.Cells[0].Value; frmDep.nombre = row.Cells[1].Value.ToString(); frmDep.estado = row.Cells[2].Value.ToString(); frmDep.con = con; frmDep.modo = "U"; frmDep.ShowDialog(); break; case "Marcas": FrmEdMarcas frmMarcas = new FrmEdMarcas(); frmMarcas.ID = (int)row.Cells[0].Value; frmMarcas.descripcion = row.Cells[1].Value.ToString(); frmMarcas.estado = row.Cells[2].Value.ToString(); frmMarcas.con = con; frmMarcas.modo = "U"; frmMarcas.ShowDialog(); break; case "Unidades_Medida": FrmEdUnidades frmUd = new FrmEdUnidades(); frmUd.ID = (int)row.Cells[0].Value; frmUd.descripcion = row.Cells[1].Value.ToString(); frmUd.estado = row.Cells[2].Value.ToString(); frmUd.con = con; frmUd.modo = "U"; frmUd.ShowDialog(); break; case "Proveedores": FrmEdProveedores frmPro = new FrmEdProveedores(); frmPro.ID = (int)row.Cells[0].Value; frmPro.cedula = row.Cells[1].Value.ToString(); frmPro.nombre = row.Cells[2].Value.ToString(); frmPro.estado = row.Cells[3].Value.ToString(); frmPro.con = con; frmPro.modo = "U"; frmPro.ShowDialog(); break; case "Articulos": FrmEdArticulos frmArt = new FrmEdArticulos(); frmArt.ID = (int)row.Cells[0].Value; frmArt.descripcion = row.Cells[1].Value.ToString(); frmArt.marca = row.Cells[2].Value.ToString(); frmArt.unidad = row.Cells[3].Value.ToString(); frmArt.existencia = (int)row.Cells[4].Value; frmArt.costoUnitario = (int)row.Cells[5].Value; frmArt.estado = row.Cells[6].Value.ToString(); frmArt.con = con; frmArt.modo = "U"; frmArt.ShowDialog(); break; case "Solicitud_Articulos": FrmEdSolicitudes frmSol = new FrmEdSolicitudes(); frmSol.ID = (int)row.Cells[0].Value; frmSol.empleadoSolicitante = row.Cells[1].Value.ToString(); frmSol.fechaSolicitud = row.Cells[2].Value.ToString(); frmSol.articulo = row.Cells[3].Value.ToString(); frmSol.cantidad = (int)row.Cells[4].Value; frmSol.unidad = row.Cells[5].Value.ToString(); frmSol.estado = row.Cells[6].Value.ToString(); frmSol.con = con; frmSol.modo = "U"; frmSol.ShowDialog(); break; case "Orden_Compras": FrmEdOrdenes frmOrd = new FrmEdOrdenes(); frmOrd.ID = (int)row.Cells[0].Value; frmOrd.idSolicitud = row.Cells[1].Value.ToString(); frmOrd.fechaOrden = row.Cells[2].Value.ToString(); frmOrd.estado = row.Cells[3].Value.ToString(); frmOrd.articulo = row.Cells[4].Value.ToString(); frmOrd.cantidad = (int)row.Cells[5].Value; frmOrd.con = con; frmOrd.modo = "U"; frmOrd.ShowDialog(); break; } } catch (Exception ex) { MessageBox.Show("Error. " + ex.Message); } }