//metodo para agregar public static int Agregar(ModelPagos pModelPago) { var comando = new MySqlCommand($" INSERT INTO pagos (Kilos, Litros, Temperatura, Acidez, pH, Crioscopia, Grasa, Densidad, SNG, ST, Alcohol, Neutralizantes, Ebullicion, Inhibidores, Sabor, Termofilicos, Micro, Disposicion, STArena, Proteina, KilosSAP, LitrosSAP ) VALUES ('{pModelPago.Kilos}','{pModelPago.Litros}','{pModelPago.Temperatura}','{pModelPago.Acidez}','{pModelPago.Ph}','{pModelPago.Crioscopia}','{pModelPago.Grasa}','{pModelPago.Densidad}','{pModelPago.Sng}','{pModelPago.St}','{pModelPago.Alcohol}','{pModelPago.Neutralizantes}','{pModelPago.Ebullicion}','{pModelPago.Inhibidores}','{pModelPago.Sabor}','{pModelPago.Termofilicos}','{pModelPago.Micro}','{pModelPago.Disposicion}','{pModelPago.StArena}','{pModelPago.Proteina}','{pModelPago.KilosSap}','{pModelPago.LitrosSap}')", ConexionMySql.ObtenerConexion()); var retorno = comando.ExecuteNonQuery(); return(retorno); }
//metodo para actualizar public static int Actualizar(ModelPagos pModelPago) { var conexion = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"UPDATE pagos SET Kilos = '{pModelPago.Kilos}', Litros= '{pModelPago.Litros}', Temperatura= '{pModelPago.Temperatura}', Acidez= '{pModelPago.Acidez}', pH= '{pModelPago.Ph}', Crioscopia= '{pModelPago.Crioscopia}', Grasa= '{pModelPago.Grasa}', Densidad= '{pModelPago.Densidad}', SNG = '{pModelPago.Sng}', ST = '{pModelPago.St}', Alcohol = '{pModelPago.Alcohol}', Neutralizantes = '{pModelPago.Neutralizantes}', Ebullicion = '{pModelPago.Ebullicion}', Inhibidores = '{pModelPago.Inhibidores}', Sabor = '{pModelPago.Sabor}', Termofilicos = '{pModelPago.Termofilicos}', Micro = '{pModelPago.Micro}', Disposicion = '{pModelPago.Disposicion}', STArena = '{pModelPago.StArena}', Proteina = '{pModelPago.Proteina}', KilosSAP = '{pModelPago.KilosSap}', LitrosSAP = '{pModelPago.Litros}' WHERE idPago='{pModelPago.IdPagos}'", conexion); var retorno = comando.ExecuteNonQuery(); conexion.Close(); return(retorno); }
public static List <ModelPagos> Llenargrid() { var lista = new List <ModelPagos>(); var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand("SELECT * FROM pagos", connec); var reader = comando.ExecuteReader(); while (reader.Read()) { var pPagos = new ModelPagos { IdPagos = reader.GetInt32(0), Kilos = reader.GetString(1), Litros = reader.GetString(2), Temperatura = reader.GetString(3), Acidez = reader.GetString(4), Ph = reader.GetString(5), Crioscopia = reader.GetString(6), Grasa = reader.GetString(7), Densidad = reader.GetString(8), Sng = reader.GetString(9), St = reader.GetString(10), Alcohol = reader.GetString(11), Neutralizantes = reader.GetString(12), Ebullicion = reader.GetString(13), Inhibidores = reader.GetString(14), Sabor = reader.GetString(15), Termofilicos = reader.GetString(16), Micro = reader.GetString(17), Disposicion = reader.GetString(18), StArena = reader.GetString(19), Proteina = reader.GetString(20), KilosSap = reader.GetString(21), LitrosSap = reader.GetString(22) }; lista.Add(pPagos); } return(lista); }
public static ModelPagos ObtenerPago(int pidPagos) { var pModelPago = new ModelPagos(); var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"SELECT * FROM pagos WHERE IDPago='{pidPagos}'", connec); var reader = comando.ExecuteReader(); while (reader.Read()) { PagoSelec.IdPagos = reader.GetInt32(0); PagoSelec.Kilos = reader.GetString(1); PagoSelec.Litros = reader.GetString(2); PagoSelec.Temperatura = reader.GetString(3); PagoSelec.Acidez = reader.GetString(4); PagoSelec.Ph = reader.GetString(5); PagoSelec.Crioscopia = reader.GetString(6); PagoSelec.Grasa = reader.GetString(7); PagoSelec.Densidad = reader.GetString(8); PagoSelec.Sng = reader.GetString(9); PagoSelec.St = reader.GetString(10); PagoSelec.Alcohol = reader.GetString(11); PagoSelec.Neutralizantes = reader.GetString(12); PagoSelec.Ebullicion = reader.GetString(13); PagoSelec.Inhibidores = reader.GetString(14); PagoSelec.Sabor = reader.GetString(15); PagoSelec.Termofilicos = reader.GetString(16); PagoSelec.Micro = reader.GetString(17); PagoSelec.Disposicion = reader.GetString(18); PagoSelec.StArena = reader.GetString(19); PagoSelec.Proteina = reader.GetString(20); PagoSelec.KilosSap = reader.GetString(21); PagoSelec.LitrosSap = reader.GetString(22); } connec.Close(); return(pModelPago); }