public void BD_Registrar_Credito(EN_Credito cre) { SqlConnection cn = new SqlConnection(); try { cn.ConnectionString = Conectar(); SqlCommand cmd = new SqlCommand("Sp_Registrar_Credito", cn); cmd.CommandTimeout = 20; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@idnotacredito", cre.IdCredito); cmd.Parameters.AddWithValue("@idDoc", cre.IdDoc); cmd.Parameters.AddWithValue("@Fecha_Credito", cre.FechaCredito); cmd.Parameters.AddWithValue("@nomcliente", cre.NomCliente); cmd.Parameters.AddWithValue("@total_ped", cre.TotalCredito); cmd.Parameters.AddWithValue("@Saldo_Pdnte", cre.SaldoPdnte); cmd.Parameters.AddWithValue("@Fecha_vncmnto", cre.FechaVencimiento); cn.Open(); cmd.ExecuteNonQuery(); cn.Close(); credSaved = true; } catch (Exception ex) { credSaved = false; if (cn.State == ConnectionState.Open) { cn.Close(); } MessageBox.Show("Error al guardar" + ex.Message, "Capa Datos Producto", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void RN_Registrar_Credito(EN_Credito cre) { BD_Credito obj = new BD_Credito(); obj.BD_Registrar_Credito(cre); }