private void btnGuardarDetalle_Click(object sender, EventArgs e) { string[] empresa = Globales.Empresa.CapturarEmpresa(); string[] usuario = Globales.Usuario.CapturarUsuario(); poliza_BO orden = new poliza_BO(); poliza_Entity oc = new poliza_Entity(); try { oc.nombre = txtNombre.Text; oc.descripcion = txtDescripcion.Text; oc.idempresa = Convert.ToInt32(empresa[0].ToString()); oc.fecha = dtfecha.Value.ToString("yyyy-MM-dd"); orden.insertPoliza(oc); int id = Convert.ToInt32(orden.dtConsultarUltimaPoliza().Rows[0][0].ToString()); detalle_poliza_BO detalle = new detalle_poliza_BO(); detalle_poliza_Entity det = new detalle_poliza_Entity(); det.idpoliza = id; det.idcuenta = Convert.ToInt32(cboCuentaContable.SelectedValue.ToString()); det.total = Convert.ToDecimal(txttotal.Text.ToString()); det.clasificacion = txtClasificacion.Text; detalle.insertDetallePoliza(det); MessageBox.Show("Póliza Guardada."); Globales.Usuario.RegistrarBitácora(Globales.Conexion, "Bitacora", "Ingreso de Póliza:" + txtDescripcion.Text); this.Close(); } catch (Exception ex) { String error = ex.ToString(); MessageBox.Show("Error en el Registro de Datos"); } }
//MRP_BD cnn = new MRP_BD("sa", "ja", "SAD2017", @"LAPTOP-BN23V9UD\SQLEXPRESS"); public void insertdetallepoliza(detalle_poliza_Entity est) { try { cnn.insertSQL("INSERT INTO DETALLEPOLIZA (idPoliza, idCuenta, clasificacion, valor)values(" + est.idpoliza + "," + est.idcuenta + ",'" + est.clasificacion + "', " + est.total + ")"); } catch (Exception ex) { String error = ex.ToString(); } }
public void insertDetallePoliza(detalle_poliza_Entity est) { try { detalle_poliza_DAL estado = new detalle_poliza_DAL(); estado.insertdetallepoliza(est); } catch (Exception ex) { String error = ex.ToString(); } }