public static ModelRecepcion ObtenerRecepcion(int IdLinea) { var pMr = new ModelRecepcion(); var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"SELECT * FROM recepcion WHERE IDLinea ='{IdLinea}'", connec); var reader = comando.ExecuteReader(); while (reader.Read()) { RecepcionSelect.IdLinea = reader.GetInt32(0); RecepcionSelect.Circuito = reader.GetString(1); RecepcionSelect.Fecha = reader.GetString(2); RecepcionSelect.MInicial = reader.GetString(3); RecepcionSelect.MFinal = reader.GetString(4); RecepcionSelect.MEnjuague = reader.GetString(5); RecepcionSelect.TAInicial = reader.GetString(6); RecepcionSelect.TAFinal = reader.GetString(7); RecepcionSelect.TAEnjuague = reader.GetString(8); RecepcionSelect.TTA = reader.GetString(9); RecepcionSelect.TipoLavado = reader.GetString(10); RecepcionSelect.TLInicial = reader.GetString(11); RecepcionSelect.TLFinal = reader.GetString(12); RecepcionSelect.TLEnjuague = reader.GetString(13); RecepcionSelect.TTLavado = reader.GetString(14); RecepcionSelect.Color1 = reader.GetString(15); RecepcionSelect.Color2 = reader.GetString(16); RecepcionSelect.Titulacion = reader.GetString(17); RecepcionSelect.RT1 = reader.GetString(18); RecepcionSelect.RT2 = reader.GetString(19); RecepcionSelect.Operador = reader.GetString(20); RecepcionSelect.Analista = reader.GetString(21); } connec.Close(); return(pMr); }
/// <summary> /// metodo para exportar funciona todo /// </summary> public static int Exportar(ModelRecepcion pRecepcion, int pOperacion) { var retorno = 0; var conexion = ConexionMySql.ObtenerConexion(); MySqlCommand comando; switch (pOperacion) { case 1: //exportar todos los datos comando = new MySqlCommand( $"Select * from recepcion('{pOperacion}','{pRecepcion.IdLinea}','{pRecepcion.Circuito}','{pRecepcion.Fecha}','{pRecepcion.MInicial}','{pRecepcion.MFinal}','{pRecepcion.MEnjuague}','{pRecepcion.TAInicial}','{pRecepcion.TAFinal}','{pRecepcion.TAEnjuague}','{pRecepcion.TTA}','{pRecepcion.TipoLavado}','{pRecepcion.TLInicial}','{pRecepcion.TLFinal}','{pRecepcion.TLEnjuague}','{pRecepcion.TTLavado}','{pRecepcion.Color1}','{pRecepcion.Color2}','{pRecepcion.Titulacion}','{pRecepcion.RT1}','{pRecepcion.RT2}','{pRecepcion.Operador}','{pRecepcion.Analista}'),'a','a')", conexion); retorno = comando.ExecuteNonQuery(); break; case 2: //exportar los datos de muestras comando = new MySqlCommand( $"Select * from recepcion('{pOperacion}','{pRecepcion.IdLinea}','{pRecepcion.Fecha}','{pRecepcion.MInicial}','{pRecepcion.MFinal}','{pRecepcion.MEnjuague}')", conexion); retorno = comando.ExecuteNonQuery(); break; case 3: //exportar los datos de titulacion comando = new MySqlCommand( $"Select * from recepcion('{pOperacion}','{pRecepcion.IdLinea}','{pRecepcion.Fecha}','{pRecepcion.Titulacion}','{pRecepcion.RT1}','{pRecepcion.RT2}')", conexion); retorno = comando.ExecuteNonQuery(); break; } return(retorno); }
/// <summary> /// metodo para agregar /// </summary> public static int Agregar(ModelRecepcion pMr) { var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"CALL sp_Recepcion('{pMr.IdLinea}','{pMr.Circuito}','{pMr.Fecha}','{pMr.MInicial}','{pMr.MFinal}','{pMr.MEnjuague}','{pMr.TAInicial}','{pMr.TAFinal}','{pMr.TAEnjuague}','{pMr.TTA}','{pMr.TipoLavado}','{pMr.TLInicial}','{pMr.TLFinal}','{pMr.TLEnjuague}','{pMr.TTLavado}','{pMr.Color1}','{pMr.Color2}','{pMr.Titulacion}','{pMr.RT1}','{pMr.RT2}','{pMr.Operador}','{pMr.Analista}')", connec); var retorno = comando.ExecuteNonQuery(); return(retorno); }
/// <summary> /// metodo para actualizar /// </summary> public static int Actualizar(ModelRecepcion pRecepcion) { var retorno = 0; var conexion = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand(string.Format($"UPDATE recepcion SET Circuito = '{pRecepcion.Circuito}', Fecha = '{pRecepcion.Fecha}', MInicial = '{pRecepcion.MInicial}', MFinal = '{pRecepcion.MFinal}', MEnjuague = '{pRecepcion.MEnjuague}', TAInicial = '{pRecepcion.TAInicial}', TAFinal = '{pRecepcion.TAFinal}', TAEnjuague = '{pRecepcion.TAEnjuague}', TTAnalisis = '{pRecepcion.TTA}', TipoLavado = '{pRecepcion.TipoLavado}', TLInicial = '{pRecepcion.TLInicial}', TLFinal = '{pRecepcion.TLFinal}', TLEnjuague = '{pRecepcion.TAEnjuague}', TTLavado = '{pRecepcion.TTLavado}', Color1 = '{pRecepcion.Color1}', Color2 = '{pRecepcion.Color2}', Titulacion = '{pRecepcion.Titulacion}', RT1 = '{pRecepcion.RT1}', RT2 = '{pRecepcion.RT2}', Operador = '{pRecepcion.Operador}', Analista = '{pRecepcion.Analista}' WHERE IDLinea = '{pRecepcion.IdLinea}';"), conexion); retorno = comando.ExecuteNonQuery(); return(retorno); }
/// <summary> /// metodo para buscar /// </summary> public static List <ModelRecepcion> Buscar(string pCircuito) { var lista = new List <ModelRecepcion>(); var connec = ConexionMySql.ObtenerConexion(); var comando = new MySqlCommand($"SELECT * FROM recepcion WHERE Circuito='{pCircuito}'", connec); var reader = comando.ExecuteReader(); while (reader.Read()) { var pRecepcion = new ModelRecepcion { 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(pRecepcion); } return(lista); }