public string Edit(DMoneda Entity) { result = ""; using (SqlConnection connect = Dconexion.Getconectar()) { connect.Open(); try { using (cmd = new SqlCommand()) { cmd.Connection = connect; cmd.CommandText = "manto.SP_EditMoneda"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@idmoneda", Entity.Idmoneda); cmd.Parameters.AddWithValue("@codigo", Entity.Nom_moneda); cmd.Parameters.AddWithValue("@nom_moneda", Entity.Abrev); cmd.Parameters.AddWithValue("@simbolo", Entity.Simbolo); cmd.Parameters.AddWithValue("@descripcion", Entity.Descripcion); result = cmd.ExecuteNonQuery() == 1 ? "Se Modifico Correctamente!" : "Error al Modificar"; cmd.Parameters.Clear(); } } catch (Exception ex) { result = ex.Message; } } return(result); }
public List <DMoneda> Getdata(DMoneda Entity) { using (SqlConnection connect = Dconexion.Getconectar()) { connect.Open(); using (cmd = new SqlCommand()) { cmd.Connection = connect; cmd.CommandText = "manto.SP_ShowMon"; cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dtr = cmd.ExecuteReader(); using (DataTable dt = new DataTable()) { dt.Load(dtr); dtr.Dispose(); listmoneda = new List <DMoneda>(); foreach (DataRow item in dt.Rows) { listmoneda.Add(new DMoneda() { Idmoneda = Convert.ToInt32(item[0]), Codigo = item[1].ToString(), Nom_moneda = item[2].ToString(), Abrev = item[3].ToString(), Simbolo = item[4].ToString(), Descripcion = item[5].ToString() }); } } } } return(listmoneda); }
private void button3_Click(object sender, EventArgs e) { try { var c = new DMoneda(); c.idmoneda = Convert.ToInt32(textBox1.Text); if (NMoneda.Eliminar(c)) { MessageBox.Show("Se elimino correctamente", "Aviso"); id(); limpiar(); listado(); button1.Enabled = true; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; } else { MessageBox.Show("Error", "Aviso"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { try { if (textBox2.Text != "") { var c = new DMoneda(); c.idmoneda = Convert.ToInt32(textBox1.Text); c.nombre = textBox2.Text.ToUpper(); if (NMoneda.Guardar(c)) { MessageBox.Show("Datos guardados correctamente", "Aviso"); id(); limpiar(); listado(); } else { MessageBox.Show("Error", "Aviso"); } } else { MessageBox.Show("Debe ingresar Datos", "Aviso"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static DMoneda EntidadMoneda(MySqlDataReader entidad) { var e = new DMoneda(); e.idmoneda = Convert.ToInt32(entidad["Id_Moneda"]); e.nombre = Convert.ToString(entidad["Nombre"]); return(e); }
public FrmMoneda() { InitializeComponent(); dMoneda = new DMoneda(); rMoneda = new RMoneda(); Show_moneda(); Tabla(); Dgv_moneda.AutoGenerateColumns = false; }
public static bool Eliminar(DMoneda c) { try { MySqlConnection cn = new MySqlConnection(Conexion.Cadena); var cmd = new MySqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = cn; cmd.CommandText = "EliminarMoneda"; cmd.Parameters.AddWithValue("@id", c.idmoneda); cn.Open(); return(Convert.ToBoolean(cmd.ExecuteNonQuery())); } catch (Exception) { return(false); } }
public string Delete(DMoneda Entity) { using (SqlConnection conn = Dconexion.Getconectar()) { conn.Open(); cmd = null; using (cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandText = "manto.SP_DeleteMoneda"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@idmoneda", Entity.Idmoneda); result = cmd.ExecuteNonQuery() == 1 ? "Se Elimino Correctamente!" : "Error al Eliminar"; cmd.Parameters.Clear(); } } return(result); }
public string Add(DMoneda Entity) { using (SqlConnection connect = Dconexion.Getconectar()) { connect.Open(); try { using (cmd = new SqlCommand()) { cmd.Connection = connect; cmd.CommandText = "manto.SP_AddMoneda"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@codigo", Entity.Codigo); cmd.Parameters.AddWithValue("@nom_moneda", Entity.Nom_moneda); cmd.Parameters.AddWithValue("@abrev", Entity.Abrev); cmd.Parameters.AddWithValue("@simbolo", Entity.Simbolo); cmd.Parameters.AddWithValue("@descripcion", Entity.Descripcion); result = cmd.ExecuteNonQuery() == 1 ? "Registrado Correctamente!" : "Error al Regsitrar"; cmd.Parameters.Clear(); } } catch (Exception ex) { SqlException sqlex = ex as SqlException; if (sqlex != null && sqlex.Number == 2627) { result = "EL CODIGO INGRESADO YA SE ENCUENTRA REGISTRADO"; } else { result = ex.Message; } } } //aqui esta cerrando la conexion. return(result); }
public static bool Eliminar(DMoneda e) { return(AdMoneda.Eliminar(e)); }
public static bool Actualizar(DMoneda e) { return(AdMoneda.Actualizar(e)); }
public static bool Guardar(DMoneda e) { return(AdMoneda.Agregar(e)); }
/// <summary> /// Consulta de catálogo : Author JUVA /// </summary> /// <returns>Monedas</returns> public List <OMoneda> ObtenerLista(string zonaMoneda) { DMoneda moneda = new DMoneda(); return(moneda.ObtenerLista(zonaMoneda)); }
public FrmV_Moneda() { InitializeComponent(); dMoneda = new DMoneda(); rMoneda = new RMoneda(); }