/// <summary> /// metodo para exportar funciona todo /// </summary> public static int Exportar(ModelGrasas pGrasas, int pOperacion) { var retorno = 0; var conexion = ConexionMySql.ObtenerConexion(); MySqlCommand comando; switch (pOperacion) { case 1: //exportar todos los datos comando = new MySqlCommand( $"Select * from grasas('{pOperacion}','{pGrasas.IdLinea}','{pGrasas.Circuito}','{pGrasas.Fecha}','{pGrasas.MInicial}','{pGrasas.MFinal}','{pGrasas.MEnjuague}','{pGrasas.TAInicial}','{pGrasas.TAFinal}','{pGrasas.TAEnjuague}','{pGrasas.TTA}','{pGrasas.TipoLavado}','{pGrasas.TLInicial}','{pGrasas.TLFinal}','{pGrasas.TLEnjuague}','{pGrasas.TTLavado}','{pGrasas.Color1}','{pGrasas.Color2}','{pGrasas.Titulacion}','{pGrasas.RT1}','{pGrasas.RT2}','{pGrasas.Operador}','{pGrasas.Analista}'),'a','a')", conexion); retorno = comando.ExecuteNonQuery(); break; case 2: //exportar los datos de muestras comando = new MySqlCommand( $"Select * from grasas('{pOperacion}','{pGrasas.IdLinea}','{pGrasas.Fecha}','{pGrasas.MInicial}','a','a','{pGrasas.MFinal}','{pGrasas.MEnjuague}')", conexion); retorno = comando.ExecuteNonQuery(); break; case 3: //exportar los datos de titulacion comando = new MySqlCommand( $"Select * from grasas('{pOperacion}','{pGrasas.IdLinea}','{pGrasas.Fecha}','{pGrasas.Titulacion}','{pGrasas.RT1}','{pGrasas.RT2}')", conexion); retorno = comando.ExecuteNonQuery(); break; } return(retorno); }
public static ModelGrasas ObtenerGR(int IdLinea) { var pMsv = new ModelGrasas(); var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"SELECT * FROM grasas WHERE IDLinea ='{IdLinea}'", connec); var reader = comando.ExecuteReader(); while (reader.Read()) { GrasasSelect.IdLinea = reader.GetInt32(0); GrasasSelect.Circuito = reader.GetString(1); GrasasSelect.Fecha = reader.GetString(2); GrasasSelect.MInicial = reader.GetString(3); GrasasSelect.MFinal = reader.GetString(4); GrasasSelect.MEnjuague = reader.GetString(5); GrasasSelect.TAInicial = reader.GetString(6); GrasasSelect.TAFinal = reader.GetString(7); GrasasSelect.TAEnjuague = reader.GetString(8); GrasasSelect.TTA = reader.GetString(9); GrasasSelect.TipoLavado = reader.GetString(10); GrasasSelect.TLInicial = reader.GetString(11); GrasasSelect.TLFinal = reader.GetString(12); GrasasSelect.TLEnjuague = reader.GetString(13); GrasasSelect.TTLavado = reader.GetString(14); GrasasSelect.Color1 = reader.GetString(15); GrasasSelect.Color2 = reader.GetString(16); GrasasSelect.Titulacion = reader.GetString(17); GrasasSelect.RT1 = reader.GetString(18); GrasasSelect.RT2 = reader.GetString(19); GrasasSelect.Operador = reader.GetString(20); GrasasSelect.Analista = reader.GetString(21); } connec.Close(); return(pMsv); }
/// <summary> /// metodo para actualizar /// </summary> public static int Actualizar(ModelGrasas pGrasas) { var retorno = 0; var conexion = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"UPDATE grasas SET Circuito='{pGrasas.Circuito}', Fecha='{pGrasas.Fecha}', MInicial='{pGrasas.MInicial}', MFinal='{pGrasas.MFinal}', MEnjuague='{pGrasas.MEnjuague}', TAInicial='{pGrasas.TAInicial}', TAFinal='{pGrasas.TAFinal}', TAEnjuague='{pGrasas.TAEnjuague}', TTAnalisis='{pGrasas.TTA}', TipoLavado='{pGrasas.TipoLavado}', TLInicial='{pGrasas.TLInicial}', TLFinal='{pGrasas.TLFinal}', TLEnjuague='{pGrasas.TLEnjuague}', TTLavado='{pGrasas.TTLavado}', Color1='{pGrasas.Color1}', Color2='{pGrasas.Color2}', Titulacion='{pGrasas.Titulacion}', RT1='{pGrasas.RT1}', RT2='{pGrasas.RT2}', Operador='{pGrasas.Operador}', Analista='{pGrasas.Analista}' WHERE IDLinea='{pGrasas.IdLinea}'", conexion); retorno = comando.ExecuteNonQuery(); return(retorno); }
/// <summary> /// metodo para agregar /// </summary> public static int Agregar(ModelGrasas pMgr) { var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand( $"CALL sp_Grasas('{pMgr.IdLinea}','{pMgr.Circuito}','{pMgr.Fecha}','{pMgr.MInicial}','{pMgr.MFinal}','{pMgr.MEnjuague}','{pMgr.TAInicial}','{pMgr.TAFinal}','{pMgr.TAEnjuague}','{pMgr.TTA}','{pMgr.TipoLavado}','{pMgr.TLInicial}','{pMgr.TLFinal}','{pMgr.TLEnjuague}','{pMgr.TTLavado}','{pMgr.Color1}','{pMgr.Color2}','{pMgr.Titulacion}','{pMgr.RT1}','{pMgr.RT2}','{pMgr.Operador}','{pMgr.Analista}')", connec); var retorno = comando.ExecuteNonQuery(); return(retorno); }
/// <summary> /// metodo para mostrar los tipolavado y titulacion los combobox /// </summary> public static List <ModelGrasas> Llenarcombo() { var lista = new List <ModelGrasas>(); var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand("SELECT * FROM grasas", connec); var reader = comando.ExecuteReader(); while (reader.Read()) { var pGR = new ModelGrasas { IdLinea = reader.GetInt32(0), Operador = reader.GetString(20), Analista = reader.GetString(21) }; lista.Add(pGR); } return(lista); }
/// <summary> /// metodo para buscar aun no funciona /// </summary> public static List <ModelGrasas> Buscar(string pCircuito) { var lista = new List <ModelGrasas>(); var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"SELECT * FROM grasas WHERE Circuito='{pCircuito}'", connec); var reader = comando.ExecuteReader(); while (reader.Read()) { var pGrasas = new ModelGrasas { IdLinea = reader.GetInt32(0), Circuito = reader.GetString(1), Fecha = reader.GetString(2), MInicial = reader.GetString(3), MFinal = reader.GetString(4), MEnjuague = reader.GetString(5), TAInicial = reader.GetString(6), TAFinal = reader.GetString(7), TAEnjuague = reader.GetString(8), TTA = reader.GetString(9), TipoLavado = reader.GetString(10), TLInicial = reader.GetString(11), TLFinal = reader.GetString(12), TLEnjuague = reader.GetString(13), TTLavado = reader.GetString(14), Color1 = reader.GetString(15), Color2 = reader.GetString(16), Titulacion = reader.GetString(17), RT1 = reader.GetString(18), RT2 = reader.GetString(19), Operador = reader.GetString(20), Analista = reader.GetString(21) }; lista.Add(pGrasas); } return(lista); }